fix(js): merge gallery.js with main.js
This commit is contained in:
parent
46acd4fae9
commit
6833693d29
|
@ -1,21 +0,0 @@
|
|||
document.addEventListener('DOMContentLoaded', () => {
|
||||
$('.article img:not(".not-gallery-item")').each(function() {
|
||||
// wrap images with link and add caption if possible
|
||||
if ($(this).parent('a').length === 0) {
|
||||
$(this).wrap('<a class="gallery-item" href="' + $(this).attr('src') + '"></a>');
|
||||
if (this.alt) {
|
||||
$(this).after('<p class="has-text-centered is-size-6 caption">' + this.alt + '</p>');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof $.fn.lightGallery === 'function') {
|
||||
$('.article').lightGallery({ selector: '.gallery-item' });
|
||||
}
|
||||
if (typeof $.fn.justifiedGallery === 'function') {
|
||||
if ($('.justified-gallery > p > .gallery-item').length) {
|
||||
$('.justified-gallery > p > .gallery-item').unwrap();
|
||||
}
|
||||
$('.justified-gallery').justifiedGallery();
|
||||
}
|
||||
});
|
|
@ -1,5 +1,25 @@
|
|||
/* eslint-disable node/no-unsupported-features/node-builtins */
|
||||
(function($, moment, ClipboardJS, config) {
|
||||
$('.article img:not(".not-gallery-item")').each(function() {
|
||||
// wrap images with link and add caption if possible
|
||||
if ($(this).parent('a').length === 0) {
|
||||
$(this).wrap('<a class="gallery-item" href="' + $(this).attr('src') + '"></a>');
|
||||
if (this.alt) {
|
||||
$(this).after('<p class="has-text-centered is-size-6 caption">' + this.alt + '</p>');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof $.fn.lightGallery === 'function') {
|
||||
$('.article').lightGallery({ selector: '.gallery-item' });
|
||||
}
|
||||
if (typeof $.fn.justifiedGallery === 'function') {
|
||||
if ($('.justified-gallery > p > .gallery-item').length) {
|
||||
$('.justified-gallery > p > .gallery-item').unwrap();
|
||||
}
|
||||
$('.justified-gallery').justifiedGallery();
|
||||
}
|
||||
|
||||
if (!$('.columns .column-right-shadow').children().length) {
|
||||
$('.columns .column-right-shadow').append($('.columns .column-right').children().clone());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue