From 6833693d291604ce77e5e70f969cd69ac7192801 Mon Sep 17 00:00:00 2001 From: ppoffice Date: Mon, 9 Mar 2020 23:13:55 -0400 Subject: [PATCH] fix(js): merge gallery.js with main.js --- source/js/gallery.js | 21 --------------------- source/js/main.js | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 21 deletions(-) delete mode 100644 source/js/gallery.js diff --git a/source/js/gallery.js b/source/js/gallery.js deleted file mode 100644 index 6c3611b..0000000 --- a/source/js/gallery.js +++ /dev/null @@ -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(''); - if (this.alt) { - $(this).after('

' + this.alt + '

'); - } - } - }); - - 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(); - } -}); diff --git a/source/js/main.js b/source/js/main.js index 87081a3..4f5a9ae 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -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(''); + if (this.alt) { + $(this).after('

' + this.alt + '

'); + } + } + }); + + 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()); }