j1-template 2021.0.8 → 2021.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/procedures/global/create_bs_button.proc +1 -1
  3. data/assets/data/menu.html +10 -39
  4. data/assets/themes/j1/adapter/js/fam.js +59 -27
  5. data/assets/themes/j1/adapter/js/mmenu.js +9 -4
  6. data/assets/themes/j1/adapter/js/navigator.js +12 -5
  7. data/assets/themes/j1/adapter/js/themer.js +51 -1
  8. data/assets/themes/j1/adapter/js/toccer.js +97 -18
  9. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.css +88 -95
  10. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css +1 -1
  11. data/assets/themes/j1/modules/justifiedGallery/LICENSE +1 -1
  12. data/assets/themes/j1/modules/justifiedGallery/README.md +5 -3
  13. data/assets/themes/j1/modules/justifiedGallery/_versions/v3.8.0/js/{jquery.justifiedGallery.js → justifiedGallery.js} +145 -145
  14. data/assets/themes/j1/modules/justifiedGallery/_versions/v3.8.0/js/{jquery.justifiedGallery.min.js → justifiedGallery.min.js} +1 -2
  15. data/assets/themes/j1/modules/justifiedGallery/js/justifiedGallery.js +69 -53
  16. data/assets/themes/j1/modules/justifiedGallery/js/justifiedGallery.min.js +2 -2
  17. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +9 -4
  18. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +1 -1
  19. data/lib/j1/commands/generate.rb +2 -2
  20. data/lib/j1/version.rb +1 -1
  21. data/lib/starter_web/Gemfile +1 -1
  22. data/lib/starter_web/_config.yml +2 -2
  23. data/lib/starter_web/_data/apps/justified_gallery.yml +41 -13
  24. data/lib/starter_web/_data/blocks/banner.yml +20 -8
  25. data/lib/starter_web/_data/blocks/defaults/banner.yml +5 -5
  26. data/lib/starter_web/_data/blocks/panel.yml +1 -1
  27. data/lib/starter_web/_data/modules/defaults/themer.yml +1 -0
  28. data/lib/starter_web/_data/modules/defaults/toccer.yml +2 -2
  29. data/lib/starter_web/_data/modules/fam.yml +8 -0
  30. data/lib/starter_web/_data/modules/navigator_menu.yml +31 -31
  31. data/lib/starter_web/_includes/attributes.asciidoc +21 -5
  32. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  33. data/lib/starter_web/assets/images/collections/blog/featured/markus-spiske-2.jpg +0 -0
  34. data/lib/starter_web/assets/images/collections/blog/featured/staticgen.jpg +0 -0
  35. data/lib/starter_web/assets/images/modules/attics/florian-olivo-1920x1280.jpg +0 -0
  36. data/lib/starter_web/assets/images/modules/attics/joel-filipe-1920x1280.jpg +0 -0
  37. data/lib/starter_web/assets/images/modules/attics/markus-spiske3-1920x1280.jpg +0 -0
  38. data/lib/starter_web/assets/images/modules/attics/markus-spiske4-1920x1280.jpg +0 -0
  39. data/lib/starter_web/assets/images/modules/attics/{runner-1920x1200-bw.jpg → runner-1920x1200.jpg} +0 -0
  40. data/lib/starter_web/assets/images/modules/attics/{the-place-1920x1280-bw.jpg → the-place-1920x1280.jpg} +0 -0
  41. data/lib/starter_web/assets/images/modules/gallery/old_times/colored/image_01.jpg +0 -0
  42. data/lib/starter_web/assets/images/modules/gallery/old_times/image_01.jpg +0 -0
  43. data/lib/starter_web/assets/images/modules/gallery/old_times/image_02.jpg +0 -0
  44. data/lib/starter_web/assets/images/modules/gallery/old_times/image_03.jpg +0 -0
  45. data/lib/starter_web/assets/images/modules/gallery/old_times/image_04.jpg +0 -0
  46. data/lib/starter_web/assets/images/modules/icons/d1/scalable/d1.svg +1 -1
  47. data/lib/starter_web/assets/images/pages/panels/florian-olivo-1920x800.jpg +0 -0
  48. data/lib/starter_web/assets/images/pages/panels/responsive-text-1920x800.jpg +0 -0
  49. data/lib/starter_web/collections/posts/public/featured/_posts/{0000-00-00-welcome-to-j1-template.adoc.erb → 0000-00-00-welcome-to-j1.adoc.erb} +29 -13
  50. data/lib/starter_web/collections/posts/public/featured/_posts/{2020-05-01-top-open-source-static-site-generators.adoc → 2020-05-01-top-site-generators.adoc} +9 -14
  51. data/lib/starter_web/collections/posts/public/featured/_posts/2020-06-01-about-cookies.adoc +57 -53
  52. data/lib/starter_web/dot.gitignore +2 -3
  53. data/lib/starter_web/index.html +8 -8
  54. data/lib/starter_web/package.json +1 -1
  55. data/lib/starter_web/pages/public/about/about_site.adoc +6 -7
  56. data/lib/starter_web/pages/public/asciidoc_skeletons/book/000_intro.adoc +1 -1
  57. data/lib/starter_web/pages/public/asciidoc_skeletons/book/100_chapter.adoc +1 -1
  58. data/lib/starter_web/pages/public/asciidoc_skeletons/book/200_chapter.adoc +1 -1
  59. data/lib/starter_web/pages/public/asciidoc_skeletons/book/900_references.adoc +1 -1
  60. data/lib/starter_web/pages/public/asciidoc_skeletons/book/book.adoc +1 -1
  61. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/100_chapter.asciidoc +1 -1
  62. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/200_chapter.asciidoc +1 -1
  63. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +1 -1
  64. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +4 -5
  65. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +79 -46
  66. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +0 -7
  67. data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +20 -48
  68. data/lib/starter_web/pages/public/learn/where_to_go.adoc +24 -49
  69. data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +67 -36
  70. data/lib/starter_web/pages/public/previewer/bootstrap_theme.adoc +89 -503
  71. data/lib/starter_web/pages/public/previewer/iframer.adoc +2 -1
  72. data/lib/starter_web/pages/public/previewer/justified_gallery.html +2 -2
  73. data/lib/starter_web/pages/public/previewer/md_color_palette.adoc +2450 -0
  74. data/lib/starter_web/pages/public/previewer/mdi_icons_preview.adoc +4 -4
  75. data/lib/starter_web/pages/public/previewer/rouge.adoc +25 -53
  76. data/lib/starter_web/pages/public/previewer/twitter_emoji_preview.adoc +3 -3
  77. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  78. data/lib/starter_web/utilsrv/package.json +1 -1
  79. metadata +21 -24
  80. data/assets/themes/j1/modules/justifiedGallery/_versions/v3.8.0/justifiedGallery.min.zip +0 -0
  81. data/assets/themes/j1/modules/justifiedGallery/_versions/v3.8.0/justifiedGallery.zip +0 -0
  82. data/assets/themes/j1/modules/justifiedGallery/_versions/v4.0.0/css/justifiedGallery.css +0 -110
  83. data/assets/themes/j1/modules/justifiedGallery/_versions/v4.0.0/css/justifiedGallery.min.css +0 -110
  84. data/assets/themes/j1/modules/justifiedGallery/_versions/v4.0.0/css/theme/uno.css +0 -23
  85. data/assets/themes/j1/modules/justifiedGallery/_versions/v4.0.0/js/jquery.justifiedGallery.js +0 -1229
  86. data/assets/themes/j1/modules/justifiedGallery/_versions/v4.0.0/js/jquery.justifiedGallery.min.js +0 -8
  87. data/lib/j1/templates/posts/0000-00-00-welcome-to-j1-template.adoc.erb +0 -72
  88. data/lib/starter_web/collections/posts/public/featured/_posts/2020-04-01-confusion-about-base-url.adoc +0 -118
  89. data/lib/starter_web/pages/public/legal/de/100_impress.adoc +0 -98
  90. data/lib/starter_web/pages/public/legal/de/200_terms_of_use.adoc +0 -55
  91. data/lib/starter_web/pages/public/legal/de/300_privacy.adoc +0 -295
  92. data/lib/starter_web/pages/public/legal/de/400_license_agreement.adoc +0 -395
  93. data/lib/starter_web/pages/public/legal/de/500_support.adoc +0 -20
  94. data/lib/starter_web/pages/public/legal/en/400_license_agreement.adoc +0 -441
  95. data/lib/starter_web/pages/public/legal/en/500_support.adoc +0 -27
@@ -4,5 +4,4 @@
4
4
  * Copyright (c) 2020 Miro Mannino
5
5
  * Licensed under the MIT license.
6
6
  */
7
-
8
- !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,i){return void 0===i&&(i="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(i),i}:e(jQuery)}(function(l){var r=function(t,i){this.settings=i,this.checkSettings(),this.imgAnalyzerTimeout=null,this.entries=null,this.buildingRow={entriesBuff:[],width:0,height:0,aspectRatio:0},this.lastFetchedEntry=null,this.lastAnalyzedIndex=-1,this.yield={every:2,flushed:0},this.border=0<=i.border?i.border:i.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges(),this.offY=this.border,this.rows=0,this.spinner={phase:0,timeSlot:150,$el:l('<div class="jg-spinner"><span></span><span></span><span></span></div>'),intervalId:null},this.scrollBarOn=!1,this.checkWidthIntervalId=null,this.galleryWidth=t.width(),this.$gallery=t};r.prototype.getSuffix=function(t,i){var e,s;for(e=i<t?t:i,s=0;s<this.suffixRanges.length;s++)if(e<=this.suffixRanges[s])return this.settings.sizeRangeSuffixes[this.suffixRanges[s]];return this.settings.sizeRangeSuffixes[this.suffixRanges[s-1]]},r.prototype.removeSuffix=function(t,i){return t.substring(0,t.length-i.length)},r.prototype.endsWith=function(t,i){return-1!==t.indexOf(i,t.length-i.length)},r.prototype.getUsedSuffix=function(t){for(var i in this.settings.sizeRangeSuffixes)if(this.settings.sizeRangeSuffixes.hasOwnProperty(i)){if(0===this.settings.sizeRangeSuffixes[i].length)continue;if(this.endsWith(t,this.settings.sizeRangeSuffixes[i]))return this.settings.sizeRangeSuffixes[i]}return""},r.prototype.newSrc=function(t,i,e,s){var n;if(this.settings.thumbnailPath)n=this.settings.thumbnailPath(t,i,e,s);else{var r=t.match(this.settings.extension),o=null!==r?r[0]:"";n=t.replace(this.settings.extension,""),n=this.removeSuffix(n,this.getUsedSuffix(n)),n+=this.getSuffix(i,e)+o}return n},r.prototype.showImg=function(t,i){this.settings.cssAnimation?(t.addClass("jg-entry-visible"),i&&i()):(t.stop().fadeTo(this.settings.imagesAnimationDuration,1,i),t.find(this.settings.imgSelector).stop().fadeTo(this.settings.imagesAnimationDuration,1,i))},r.prototype.extractImgSrcFromImage=function(t){var i=t.data("safe-src"),e="data-safe-src";return void 0===i&&(i=t.attr("src"),e="src"),t.data("jg.originalSrc",i),t.data("jg.src",i),t.data("jg.originalSrcLoc",e),i},r.prototype.imgFromEntry=function(t){var i=t.find(this.settings.imgSelector);return 0===i.length?null:i},r.prototype.captionFromEntry=function(t){var i=t.find("> .jg-caption");return 0===i.length?null:i},r.prototype.displayEntry=function(t,i,e,s,n,r){t.width(s),t.height(r),t.css("top",e),t.css("left",i);var o=this.imgFromEntry(t);if(null!==o){o.css("width",s),o.css("height",n),o.css("margin-left",-Math.round(s/2)),o.css("margin-top",-Math.round(n/2));var a=o.data("jg.src");if(a){a=this.newSrc(a,s,n,o[0]),o.one("error",function(){this.resetImgSrc(o)});var h=function(){o.attr("src",a)};"skipped"===t.data("jg.loaded")&&a?this.onImageEvent(a,function(){this.showImg(t,h),t.data("jg.loaded",!0)}.bind(this)):this.showImg(t,h)}}else this.showImg(t);this.displayEntryCaption(t)},r.prototype.displayEntryCaption=function(t){var i=this.imgFromEntry(t);if(null!==i&&this.settings.captions){var e=this.captionFromEntry(t);if(null===e){var s=i.attr("alt");this.isValidCaption(s)||(s=t.attr("title")),this.isValidCaption(s)&&(e=l('<div class="jg-caption">'+s+"</div>"),t.append(e),t.data("jg.createdCaption",!0))}null!==e&&(this.settings.cssAnimation||e.stop().fadeTo(0,this.settings.captionSettings.nonVisibleOpacity),this.addCaptionEventsHandlers(t))}else this.removeCaptionEventsHandlers(t)},r.prototype.isValidCaption=function(t){return void 0!==t&&0<t.length},r.prototype.onEntryMouseEnterForCaption=function(t){var i=this.captionFromEntry(l(t.currentTarget));this.settings.cssAnimation?i.addClass("jg-caption-visible").removeClass("jg-caption-hidden"):i.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.visibleOpacity)},r.prototype.onEntryMouseLeaveForCaption=function(t){var i=this.captionFromEntry(l(t.currentTarget));this.settings.cssAnimation?i.removeClass("jg-caption-visible").removeClass("jg-caption-hidden"):i.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.nonVisibleOpacity)},r.prototype.addCaptionEventsHandlers=function(t){var i=t.data("jg.captionMouseEvents");void 0===i&&(i={mouseenter:l.proxy(this.onEntryMouseEnterForCaption,this),mouseleave:l.proxy(this.onEntryMouseLeaveForCaption,this)},t.on("mouseenter",void 0,void 0,i.mouseenter),t.on("mouseleave",void 0,void 0,i.mouseleave),t.data("jg.captionMouseEvents",i))},r.prototype.removeCaptionEventsHandlers=function(t){var i=t.data("jg.captionMouseEvents");void 0!==i&&(t.off("mouseenter",void 0,i.mouseenter),t.off("mouseleave",void 0,i.mouseleave),t.removeData("jg.captionMouseEvents"))},r.prototype.clearBuildingRow=function(){this.buildingRow.entriesBuff=[],this.buildingRow.aspectRatio=0,this.buildingRow.width=0},r.prototype.prepareBuildingRow=function(t,i){var e,s,n,r,o,a=!0,h=0,g=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,l=g/this.buildingRow.aspectRatio,u=this.settings.rowHeight,d=this.buildingRow.width/g>this.settings.justifyThreshold;if(i||t&&"hide"===this.settings.lastRow&&!d){for(e=0;e<this.buildingRow.entriesBuff.length;e++)s=this.buildingRow.entriesBuff[e],this.settings.cssAnimation?s.removeClass("jg-entry-visible"):(s.stop().fadeTo(0,.1),s.find("> img, > a > img").fadeTo(0,0));return-1}for(t&&!d&&"justify"!==this.settings.lastRow&&"hide"!==this.settings.lastRow&&(a=!1,0<this.rows&&(a=(u=(this.offY-this.border-this.settings.margins*this.rows)/this.rows)*this.buildingRow.aspectRatio/g>this.settings.justifyThreshold)),e=0;e<this.buildingRow.entriesBuff.length;e++)n=(s=this.buildingRow.entriesBuff[e]).data("jg.width")/s.data("jg.height"),o=a?(r=e===this.buildingRow.entriesBuff.length-1?g:l*n,l):(r=u*n,u),g-=Math.round(r),s.data("jg.jwidth",Math.round(r)),s.data("jg.jheight",Math.ceil(o)),(0===e||o<h)&&(h=o);return this.buildingRow.height=h,a},r.prototype.flushRow=function(t,i){var e,s,n,r=this.settings,o=this.border;if(s=this.prepareBuildingRow(t,i),i||t&&"hide"===r.lastRow&&-1===s)this.clearBuildingRow();else{if(this.maxRowHeight&&this.maxRowHeight<this.buildingRow.height&&(this.buildingRow.height=this.maxRowHeight),t&&("center"===r.lastRow||"right"===r.lastRow)){var a=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*r.margins;for(n=0;n<this.buildingRow.entriesBuff.length;n++)a-=(e=this.buildingRow.entriesBuff[n]).data("jg.jwidth");"center"===r.lastRow?o+=Math.round(a/2):"right"===r.lastRow&&(o+=a)}var h=this.buildingRow.entriesBuff.length-1;for(n=0;n<=h;n++)e=this.buildingRow.entriesBuff[this.settings.rtl?h-n:n],this.displayEntry(e,o,this.offY,e.data("jg.jwidth"),e.data("jg.jheight"),this.buildingRow.height),o+=e.data("jg.jwidth")+r.margins;this.galleryHeightToSet=this.offY+this.buildingRow.height+this.border,this.setGalleryTempHeight(this.galleryHeightToSet+this.getSpinnerHeight()),(!t||this.buildingRow.height<=r.rowHeight&&s)&&(this.offY+=this.buildingRow.height+r.margins,this.rows+=1,this.clearBuildingRow(),this.settings.triggerEvent.call(this,"jg.rowflush"))}};var i=0;r.prototype.rememberGalleryHeight=function(){i=this.$gallery.height(),this.$gallery.height(i)},r.prototype.setGalleryTempHeight=function(t){i=Math.max(t,i),this.$gallery.height(i)},r.prototype.setGalleryFinalHeight=function(t){i=t,this.$gallery.height(t)},r.prototype.checkWidth=function(){this.checkWidthIntervalId=setInterval(l.proxy(function(){if(this.$gallery.is(":visible")){var t=parseFloat(this.$gallery.width());Math.abs(t-this.galleryWidth)>this.settings.refreshSensitivity&&(this.galleryWidth=t,this.rewind(),this.rememberGalleryHeight(),this.startImgAnalyzer(!0))}},this),this.settings.refreshTime)},r.prototype.isSpinnerActive=function(){return null!==this.spinner.intervalId},r.prototype.getSpinnerHeight=function(){return this.spinner.$el.innerHeight()},r.prototype.stopLoadingSpinnerAnimation=function(){clearInterval(this.spinner.intervalId),this.spinner.intervalId=null,this.setGalleryTempHeight(this.$gallery.height()-this.getSpinnerHeight()),this.spinner.$el.detach()},r.prototype.startLoadingSpinnerAnimation=function(){var t=this.spinner,i=t.$el.find("span");clearInterval(t.intervalId),this.$gallery.append(t.$el),this.setGalleryTempHeight(this.offY+this.buildingRow.height+this.getSpinnerHeight()),t.intervalId=setInterval(function(){t.phase<i.length?i.eq(t.phase).fadeTo(t.timeSlot,1):i.eq(t.phase-i.length).fadeTo(t.timeSlot,0),t.phase=(t.phase+1)%(2*i.length)},t.timeSlot)},r.prototype.rewind=function(){this.lastFetchedEntry=null,this.lastAnalyzedIndex=-1,this.offY=this.border,this.rows=0,this.clearBuildingRow()},r.prototype.getSelectorWithoutSpinner=function(){return this.settings.selector+", div:not(.jg-spinner)"},r.prototype.getAllEntries=function(){var t=this.getSelectorWithoutSpinner();return this.$gallery.children(t).toArray()},r.prototype.updateEntries=function(t){var i;if(t&&null!=this.lastFetchedEntry){var e=this.getSelectorWithoutSpinner();i=l(this.lastFetchedEntry).nextAll(e).toArray()}else this.entries=[],i=this.getAllEntries();return 0<i.length&&(l.isFunction(this.settings.sort)?i=this.sortArray(i):this.settings.randomize&&(i=this.shuffleArray(i)),this.lastFetchedEntry=i[i.length-1],this.settings.filter?i=this.filterArray(i):this.resetFilters(i)),this.entries=this.entries.concat(i),!0},r.prototype.insertToGallery=function(t){var i=this;l.each(t,function(){l(this).appendTo(i.$gallery)})},r.prototype.shuffleArray=function(t){var i,e,s;for(i=t.length-1;0<i;i--)e=Math.floor(Math.random()*(i+1)),s=t[i],t[i]=t[e],t[e]=s;return this.insertToGallery(t),t},r.prototype.sortArray=function(t){return t.sort(this.settings.sort),this.insertToGallery(t),t},r.prototype.resetFilters=function(t){for(var i=0;i<t.length;i++)l(t[i]).removeClass("jg-filtered")},r.prototype.filterArray=function(t){var e=this.settings;if("string"===l.type(e.filter))return t.filter(function(t){var i=l(t);return i.is(e.filter)?(i.removeClass("jg-filtered"),!0):(i.addClass("jg-filtered").removeClass("jg-visible"),!1)});if(l.isFunction(e.filter)){for(var i=t.filter(e.filter),s=0;s<t.length;s++)-1===i.indexOf(t[s])?l(t[s]).addClass("jg-filtered").removeClass("jg-visible"):l(t[s]).removeClass("jg-filtered");return i}},r.prototype.resetImgSrc=function(t){"src"===t.data("jg.originalSrcLoc")?t.attr("src",t.data("jg.originalSrc")):t.attr("src","")},r.prototype.destroy=function(){clearInterval(this.checkWidthIntervalId),this.stopImgAnalyzerStarter(),l.each(this.getAllEntries(),l.proxy(function(t,i){var e=l(i);e.css("width",""),e.css("height",""),e.css("top",""),e.css("left",""),e.data("jg.loaded",void 0),e.removeClass("jg-entry jg-filtered jg-entry-visible");var s=this.imgFromEntry(e);s&&(s.css("width",""),s.css("height",""),s.css("margin-left",""),s.css("margin-top",""),this.resetImgSrc(s),s.data("jg.originalSrc",void 0),s.data("jg.originalSrcLoc",void 0),s.data("jg.src",void 0)),this.removeCaptionEventsHandlers(e);var n=this.captionFromEntry(e);e.data("jg.createdCaption")?(e.data("jg.createdCaption",void 0),null!==n&&n.remove()):null!==n&&n.fadeTo(0,1)},this)),this.$gallery.css("height",""),this.$gallery.removeClass("justified-gallery"),this.$gallery.data("jg.controller",void 0),this.settings.triggerEvent.call(this,"jg.destroy")},r.prototype.analyzeImages=function(t){for(var i=this.lastAnalyzedIndex+1;i<this.entries.length;i++){var e=l(this.entries[i]);if(!0===e.data("jg.loaded")||"skipped"===e.data("jg.loaded")){var s=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,n=e.data("jg.width")/e.data("jg.height");if(this.buildingRow.entriesBuff.push(e),this.buildingRow.aspectRatio+=n,this.buildingRow.width+=n*this.settings.rowHeight,this.lastAnalyzedIndex=i,s/(this.buildingRow.aspectRatio+n)<this.settings.rowHeight&&(this.flushRow(!1,0<this.settings.maxRowsCount&&this.rows===this.settings.maxRowsCount),++this.yield.flushed>=this.yield.every))return void this.startImgAnalyzer(t)}else if("error"!==e.data("jg.loaded"))return}0<this.buildingRow.entriesBuff.length&&this.flushRow(!0,0<this.settings.maxRowsCount&&this.rows===this.settings.maxRowsCount),this.isSpinnerActive()&&this.stopLoadingSpinnerAnimation(),this.stopImgAnalyzerStarter(),this.setGalleryFinalHeight(this.galleryHeightToSet),this.settings.triggerEvent.call(this,t?"jg.resize":"jg.complete")},r.prototype.stopImgAnalyzerStarter=function(){this.yield.flushed=0,null!==this.imgAnalyzerTimeout&&(clearTimeout(this.imgAnalyzerTimeout),this.imgAnalyzerTimeout=null)},r.prototype.startImgAnalyzer=function(t){var i=this;this.stopImgAnalyzerStarter(),this.imgAnalyzerTimeout=setTimeout(function(){i.analyzeImages(t)},.001)},r.prototype.onImageEvent=function(t,i,e){if(i||e){var s=new Image,n=l(s);i&&n.one("load",function(){n.off("load error"),i(s)}),e&&n.one("error",function(){n.off("load error"),e(s)}),s.src=t}},r.prototype.init=function(){var a=!1,h=!1,g=this;l.each(this.entries,function(t,i){var e=l(i),s=g.imgFromEntry(e);if(e.addClass("jg-entry"),!0!==e.data("jg.loaded")&&"skipped"!==e.data("jg.loaded"))if(null!==g.settings.rel&&e.attr("rel",g.settings.rel),null!==g.settings.target&&e.attr("target",g.settings.target),null!==s){var n=g.extractImgSrcFromImage(s);if(!1===g.settings.waitThumbnailsLoad||!n){var r=parseFloat(s.attr("width")),o=parseFloat(s.attr("height"));if("svg"===s.prop("tagName")&&(r=parseFloat(s[0].getBBox().width),o=parseFloat(s[0].getBBox().height)),!isNaN(r)&&!isNaN(o))return e.data("jg.width",r),e.data("jg.height",o),e.data("jg.loaded","skipped"),h=!0,g.startImgAnalyzer(!1),!0}e.data("jg.loaded",!1),a=!0,g.isSpinnerActive()||g.startLoadingSpinnerAnimation(),g.onImageEvent(n,function(t){e.data("jg.width",t.width),e.data("jg.height",t.height),e.data("jg.loaded",!0),g.startImgAnalyzer(!1)},function(){e.data("jg.loaded","error"),g.startImgAnalyzer(!1)})}else e.data("jg.loaded",!0),e.data("jg.width",e.width()|parseFloat(e.css("width"))|1),e.data("jg.height",e.height()|parseFloat(e.css("height"))|1)}),a||h||this.startImgAnalyzer(!1),this.checkWidth()},r.prototype.checkOrConvertNumber=function(t,i){if("string"===l.type(t[i])&&(t[i]=parseFloat(t[i])),"number"!==l.type(t[i]))throw i+" must be a number";if(isNaN(t[i]))throw"invalid number for "+i},r.prototype.checkSizeRangesSuffixes=function(){if("object"!==l.type(this.settings.sizeRangeSuffixes))throw"sizeRangeSuffixes must be defined and must be an object";var t=[];for(var i in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(i)&&t.push(i);for(var e={0:""},s=0;s<t.length;s++)if("string"===l.type(t[s]))try{e[parseInt(t[s].replace(/^[a-z]+/,""),10)]=this.settings.sizeRangeSuffixes[t[s]]}catch(t){throw"sizeRangeSuffixes keys must contains correct numbers ("+t+")"}else e[t[s]]=this.settings.sizeRangeSuffixes[t[s]];this.settings.sizeRangeSuffixes=e},r.prototype.retrieveMaxRowHeight=function(){var t=null,i=this.settings.rowHeight;if("string"===l.type(this.settings.maxRowHeight))t=this.settings.maxRowHeight.match(/^[0-9]+%$/)?i*parseFloat(this.settings.maxRowHeight.match(/^([0-9]+)%$/)[1])/100:parseFloat(this.settings.maxRowHeight);else{if("number"!==l.type(this.settings.maxRowHeight)){if(!1===this.settings.maxRowHeight||null==this.settings.maxRowHeight)return null;throw"maxRowHeight must be a number or a percentage"}t=this.settings.maxRowHeight}if(isNaN(t))throw"invalid number for maxRowHeight";return t<i&&(t=i),t},r.prototype.checkSettings=function(){this.checkSizeRangesSuffixes(),this.checkOrConvertNumber(this.settings,"rowHeight"),this.checkOrConvertNumber(this.settings,"margins"),this.checkOrConvertNumber(this.settings,"border"),this.checkOrConvertNumber(this.settings,"maxRowsCount");var t=["justify","nojustify","left","center","right","hide"];if(-1===t.indexOf(this.settings.lastRow))throw"lastRow must be one of: "+t.join(", ");if(this.checkOrConvertNumber(this.settings,"justifyThreshold"),this.settings.justifyThreshold<0||1<this.settings.justifyThreshold)throw"justifyThreshold must be in the interval [0,1]";if("boolean"!==l.type(this.settings.cssAnimation))throw"cssAnimation must be a boolean";if("boolean"!==l.type(this.settings.captions))throw"captions must be a boolean";if(this.checkOrConvertNumber(this.settings.captionSettings,"animationDuration"),this.checkOrConvertNumber(this.settings.captionSettings,"visibleOpacity"),this.settings.captionSettings.visibleOpacity<0||1<this.settings.captionSettings.visibleOpacity)throw"captionSettings.visibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings.captionSettings,"nonVisibleOpacity"),this.settings.captionSettings.nonVisibleOpacity<0||1<this.settings.captionSettings.nonVisibleOpacity)throw"captionSettings.nonVisibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings,"imagesAnimationDuration"),this.checkOrConvertNumber(this.settings,"refreshTime"),this.checkOrConvertNumber(this.settings,"refreshSensitivity"),"boolean"!==l.type(this.settings.randomize))throw"randomize must be a boolean";if("string"!==l.type(this.settings.selector))throw"selector must be a string";if(!1!==this.settings.sort&&!l.isFunction(this.settings.sort))throw"sort must be false or a comparison function";if(!1!==this.settings.filter&&!l.isFunction(this.settings.filter)&&"string"!==l.type(this.settings.filter))throw"filter must be false, a string or a filter function"},r.prototype.retrieveSuffixRanges=function(){var t=[];for(var i in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(i)&&t.push(parseInt(i,10));return t.sort(function(t,i){return i<t?1:t<i?-1:0}),t},r.prototype.updateSettings=function(t){this.settings=l.extend({},this.settings,t),this.checkSettings(),this.border=0<=this.settings.border?this.settings.border:this.settings.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges()},r.prototype.defaults={sizeRangeSuffixes:{},thumbnailPath:void 0,rowHeight:120,maxRowHeight:!1,maxRowsCount:0,margins:1,border:-1,lastRow:"nojustify",justifyThreshold:.9,waitThumbnailsLoad:!0,captions:!0,cssAnimation:!0,imagesAnimationDuration:500,captionSettings:{animationDuration:500,visibleOpacity:.7,nonVisibleOpacity:0},rel:null,target:null,extension:/\.[^.\\/]+$/,refreshTime:200,refreshSensitivity:0,randomize:!1,rtl:!1,sort:!1,filter:!1,selector:"a",imgSelector:"> img, > a > img, > svg, > a > svg",triggerEvent:function(t){this.$gallery.trigger(t)}},l.fn.justifiedGallery=function(n){return this.each(function(t,i){var e=l(i);e.addClass("justified-gallery");var s=e.data("jg.controller");if(void 0===s){if(null!=n&&"object"!==l.type(n)){if("destroy"===n)return;throw"The argument must be an object"}s=new r(e,l.extend({},r.prototype.defaults,n)),e.data("jg.controller",s)}else if("norewind"===n);else{if("destroy"===n)return void s.destroy();s.updateSettings(n),s.rewind()}s.updateEntries("norewind"===n)&&s.init()})}});
7
+ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,i){return void 0===i&&(i="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(i),i}:e(jQuery)}(function(l){var r=function(t,i){this.settings=i,this.checkSettings(),this.imgAnalyzerTimeout=null,this.entries=null,this.buildingRow={entriesBuff:[],width:0,height:0,aspectRatio:0},this.lastFetchedEntry=null,this.lastAnalyzedIndex=-1,this.yield={every:2,flushed:0},this.border=0<=i.border?i.border:i.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges(),this.offY=this.border,this.rows=0,this.spinner={phase:0,timeSlot:150,$el:l('<div class="jg-spinner"><span></span><span></span><span></span></div>'),intervalId:null},this.scrollBarOn=!1,this.checkWidthIntervalId=null,this.galleryWidth=t.width(),this.$gallery=t};r.prototype.getSuffix=function(t,i){var e,s;for(e=i<t?t:i,s=0;s<this.suffixRanges.length;s++)if(e<=this.suffixRanges[s])return this.settings.sizeRangeSuffixes[this.suffixRanges[s]];return this.settings.sizeRangeSuffixes[this.suffixRanges[s-1]]},r.prototype.removeSuffix=function(t,i){return t.substring(0,t.length-i.length)},r.prototype.endsWith=function(t,i){return-1!==t.indexOf(i,t.length-i.length)},r.prototype.getUsedSuffix=function(t){for(var i in this.settings.sizeRangeSuffixes)if(this.settings.sizeRangeSuffixes.hasOwnProperty(i)){if(0===this.settings.sizeRangeSuffixes[i].length)continue;if(this.endsWith(t,this.settings.sizeRangeSuffixes[i]))return this.settings.sizeRangeSuffixes[i]}return""},r.prototype.newSrc=function(t,i,e,s){var n;if(this.settings.thumbnailPath)n=this.settings.thumbnailPath(t,i,e,s);else{var r=t.match(this.settings.extension),o=null!==r?r[0]:"";n=t.replace(this.settings.extension,""),n=this.removeSuffix(n,this.getUsedSuffix(n)),n+=this.getSuffix(i,e)+o}return n},r.prototype.showImg=function(t,i){this.settings.cssAnimation?(t.addClass("jg-entry-visible"),i&&i()):(t.stop().fadeTo(this.settings.imagesAnimationDuration,1,i),t.find(this.settings.imgSelector).stop().fadeTo(this.settings.imagesAnimationDuration,1,i))},r.prototype.extractImgSrcFromImage=function(t){var i=t.data("safe-src"),e="data-safe-src";return void 0===i&&(i=t.attr("src"),e="src"),t.data("jg.originalSrc",i),t.data("jg.src",i),t.data("jg.originalSrcLoc",e),i},r.prototype.imgFromEntry=function(t){var i=t.find(this.settings.imgSelector);return 0===i.length?null:i},r.prototype.captionFromEntry=function(t){var i=t.find("> .jg-caption");return 0===i.length?null:i},r.prototype.displayEntry=function(t,i,e,s,n,r){t.width(s),t.height(r),t.css("top",e),t.css("left",i);var o=this.imgFromEntry(t);if(null!==o){o.css("width",s),o.css("height",n),o.css("margin-left",-Math.round(s/2)),o.css("margin-top",-Math.round(n/2));var a=o.data("jg.src");if(a){a=this.newSrc(a,s,n,o[0]),o.one("error",function(){this.resetImgSrc(o)});var h=function(){o.attr("src",a)};"skipped"===t.data("jg.loaded")&&a?this.onImageEvent(a,function(){this.showImg(t,h),t.data("jg.loaded",!0)}.bind(this)):this.showImg(t,h)}}else this.showImg(t);this.displayEntryCaption(t)},r.prototype.displayEntryCaption=function(t){var i=this.imgFromEntry(t);if(null!==i&&this.settings.captions){var e=this.captionFromEntry(t);if(null===e){var s=i.attr("alt");this.isValidCaption(s)||(s=t.attr("title")),this.isValidCaption(s)&&(e=l('<div class="jg-caption">'+s+"</div>"),t.append(e),t.data("jg.createdCaption",!0))}null!==e&&(this.settings.cssAnimation||e.stop().fadeTo(0,this.settings.captionSettings.nonVisibleOpacity),this.addCaptionEventsHandlers(t))}else this.removeCaptionEventsHandlers(t)},r.prototype.isValidCaption=function(t){return void 0!==t&&0<t.length},r.prototype.onEntryMouseEnterForCaption=function(t){var i=this.captionFromEntry(l(t.currentTarget));this.settings.cssAnimation?i.addClass("jg-caption-visible").removeClass("jg-caption-hidden"):i.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.visibleOpacity)},r.prototype.onEntryMouseLeaveForCaption=function(t){var i=this.captionFromEntry(l(t.currentTarget));this.settings.cssAnimation?i.removeClass("jg-caption-visible").removeClass("jg-caption-hidden"):i.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.nonVisibleOpacity)},r.prototype.addCaptionEventsHandlers=function(t){var i=t.data("jg.captionMouseEvents");void 0===i&&(i={mouseenter:l.proxy(this.onEntryMouseEnterForCaption,this),mouseleave:l.proxy(this.onEntryMouseLeaveForCaption,this)},t.on("mouseenter",void 0,void 0,i.mouseenter),t.on("mouseleave",void 0,void 0,i.mouseleave),t.data("jg.captionMouseEvents",i))},r.prototype.removeCaptionEventsHandlers=function(t){var i=t.data("jg.captionMouseEvents");void 0!==i&&(t.off("mouseenter",void 0,i.mouseenter),t.off("mouseleave",void 0,i.mouseleave),t.removeData("jg.captionMouseEvents"))},r.prototype.clearBuildingRow=function(){this.buildingRow.entriesBuff=[],this.buildingRow.aspectRatio=0,this.buildingRow.width=0},r.prototype.prepareBuildingRow=function(t,i){var e,s,n,r,o,a=!0,h=0,g=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,l=g/this.buildingRow.aspectRatio,u=this.settings.rowHeight,d=this.buildingRow.width/g>this.settings.justifyThreshold;if(i||t&&"hide"===this.settings.lastRow&&!d){for(e=0;e<this.buildingRow.entriesBuff.length;e++)s=this.buildingRow.entriesBuff[e],this.settings.cssAnimation?s.removeClass("jg-entry-visible"):(s.stop().fadeTo(0,.1),s.find("> img, > a > img").fadeTo(0,0));return-1}for(t&&!d&&"justify"!==this.settings.lastRow&&"hide"!==this.settings.lastRow&&(a=!1,0<this.rows&&(a=(u=(this.offY-this.border-this.settings.margins*this.rows)/this.rows)*this.buildingRow.aspectRatio/g>this.settings.justifyThreshold)),e=0;e<this.buildingRow.entriesBuff.length;e++)n=(s=this.buildingRow.entriesBuff[e]).data("jg.width")/s.data("jg.height"),o=a?(r=e===this.buildingRow.entriesBuff.length-1?g:l*n,l):(r=u*n,u),g-=Math.round(r),s.data("jg.jwidth",Math.round(r)),s.data("jg.jheight",Math.ceil(o)),(0===e||o<h)&&(h=o);return this.buildingRow.height=h,a},r.prototype.flushRow=function(t,i){var e,s,n,r=this.settings,o=this.border;if(s=this.prepareBuildingRow(t,i),i||t&&"hide"===r.lastRow&&-1===s)this.clearBuildingRow();else{if(this.maxRowHeight&&this.maxRowHeight<this.buildingRow.height&&(this.buildingRow.height=this.maxRowHeight),t&&("center"===r.lastRow||"right"===r.lastRow)){var a=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*r.margins;for(n=0;n<this.buildingRow.entriesBuff.length;n++)a-=(e=this.buildingRow.entriesBuff[n]).data("jg.jwidth");"center"===r.lastRow?o+=Math.round(a/2):"right"===r.lastRow&&(o+=a)}var h=this.buildingRow.entriesBuff.length-1;for(n=0;n<=h;n++)e=this.buildingRow.entriesBuff[this.settings.rtl?h-n:n],this.displayEntry(e,o,this.offY,e.data("jg.jwidth"),e.data("jg.jheight"),this.buildingRow.height),o+=e.data("jg.jwidth")+r.margins;this.galleryHeightToSet=this.offY+this.buildingRow.height+this.border,this.setGalleryTempHeight(this.galleryHeightToSet+this.getSpinnerHeight()),(!t||this.buildingRow.height<=r.rowHeight&&s)&&(this.offY+=this.buildingRow.height+r.margins,this.rows+=1,this.clearBuildingRow(),this.settings.triggerEvent.call(this,"jg.rowflush"))}};var i=0;r.prototype.rememberGalleryHeight=function(){i=this.$gallery.height(),this.$gallery.height(i)},r.prototype.setGalleryTempHeight=function(t){i=Math.max(t,i),this.$gallery.height(i)},r.prototype.setGalleryFinalHeight=function(t){i=t,this.$gallery.height(t)},r.prototype.checkWidth=function(){this.checkWidthIntervalId=setInterval(l.proxy(function(){if(this.$gallery.is(":visible")){var t=parseFloat(this.$gallery.width());Math.abs(t-this.galleryWidth)>this.settings.refreshSensitivity&&(this.galleryWidth=t,this.rewind(),this.rememberGalleryHeight(),this.startImgAnalyzer(!0))}},this),this.settings.refreshTime)},r.prototype.isSpinnerActive=function(){return null!==this.spinner.intervalId},r.prototype.getSpinnerHeight=function(){return this.spinner.$el.innerHeight()},r.prototype.stopLoadingSpinnerAnimation=function(){clearInterval(this.spinner.intervalId),this.spinner.intervalId=null,this.setGalleryTempHeight(this.$gallery.height()-this.getSpinnerHeight()),this.spinner.$el.detach()},r.prototype.startLoadingSpinnerAnimation=function(){var t=this.spinner,i=t.$el.find("span");clearInterval(t.intervalId),this.$gallery.append(t.$el),this.setGalleryTempHeight(this.offY+this.buildingRow.height+this.getSpinnerHeight()),t.intervalId=setInterval(function(){t.phase<i.length?i.eq(t.phase).fadeTo(t.timeSlot,1):i.eq(t.phase-i.length).fadeTo(t.timeSlot,0),t.phase=(t.phase+1)%(2*i.length)},t.timeSlot)},r.prototype.rewind=function(){this.lastFetchedEntry=null,this.lastAnalyzedIndex=-1,this.offY=this.border,this.rows=0,this.clearBuildingRow()},r.prototype.getSelectorWithoutSpinner=function(){return this.settings.selector+", div:not(.jg-spinner)"},r.prototype.getAllEntries=function(){var t=this.getSelectorWithoutSpinner();return this.$gallery.children(t).toArray()},r.prototype.updateEntries=function(t){var i;if(t&&null!=this.lastFetchedEntry){var e=this.getSelectorWithoutSpinner();i=l(this.lastFetchedEntry).nextAll(e).toArray()}else this.entries=[],i=this.getAllEntries();return 0<i.length&&(l.isFunction(this.settings.sort)?i=this.sortArray(i):this.settings.randomize&&(i=this.shuffleArray(i)),this.lastFetchedEntry=i[i.length-1],this.settings.filter?i=this.filterArray(i):this.resetFilters(i)),this.entries=this.entries.concat(i),!0},r.prototype.insertToGallery=function(t){var i=this;l.each(t,function(){l(this).appendTo(i.$gallery)})},r.prototype.shuffleArray=function(t){var i,e,s;for(i=t.length-1;0<i;i--)e=Math.floor(Math.random()*(i+1)),s=t[i],t[i]=t[e],t[e]=s;return this.insertToGallery(t),t},r.prototype.sortArray=function(t){return t.sort(this.settings.sort),this.insertToGallery(t),t},r.prototype.resetFilters=function(t){for(var i=0;i<t.length;i++)l(t[i]).removeClass("jg-filtered")},r.prototype.filterArray=function(t){var e=this.settings;if("string"===l.type(e.filter))return t.filter(function(t){var i=l(t);return i.is(e.filter)?(i.removeClass("jg-filtered"),!0):(i.addClass("jg-filtered").removeClass("jg-visible"),!1)});if(l.isFunction(e.filter)){for(var i=t.filter(e.filter),s=0;s<t.length;s++)-1===i.indexOf(t[s])?l(t[s]).addClass("jg-filtered").removeClass("jg-visible"):l(t[s]).removeClass("jg-filtered");return i}},r.prototype.resetImgSrc=function(t){"src"===t.data("jg.originalSrcLoc")?t.attr("src",t.data("jg.originalSrc")):t.attr("src","")},r.prototype.destroy=function(){clearInterval(this.checkWidthIntervalId),this.stopImgAnalyzerStarter(),l.each(this.getAllEntries(),l.proxy(function(t,i){var e=l(i);e.css("width",""),e.css("height",""),e.css("top",""),e.css("left",""),e.data("jg.loaded",void 0),e.removeClass("jg-entry jg-filtered jg-entry-visible");var s=this.imgFromEntry(e);s&&(s.css("width",""),s.css("height",""),s.css("margin-left",""),s.css("margin-top",""),this.resetImgSrc(s),s.data("jg.originalSrc",void 0),s.data("jg.originalSrcLoc",void 0),s.data("jg.src",void 0)),this.removeCaptionEventsHandlers(e);var n=this.captionFromEntry(e);e.data("jg.createdCaption")?(e.data("jg.createdCaption",void 0),null!==n&&n.remove()):null!==n&&n.fadeTo(0,1)},this)),this.$gallery.css("height",""),this.$gallery.removeClass("justified-gallery"),this.$gallery.data("jg.controller",void 0),this.settings.triggerEvent.call(this,"jg.destroy")},r.prototype.analyzeImages=function(t){for(var i=this.lastAnalyzedIndex+1;i<this.entries.length;i++){var e=l(this.entries[i]);if(!0===e.data("jg.loaded")||"skipped"===e.data("jg.loaded")){var s=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,n=e.data("jg.width")/e.data("jg.height");if(this.buildingRow.entriesBuff.push(e),this.buildingRow.aspectRatio+=n,this.buildingRow.width+=n*this.settings.rowHeight,this.lastAnalyzedIndex=i,s/(this.buildingRow.aspectRatio+n)<this.settings.rowHeight&&(this.flushRow(!1,0<this.settings.maxRowsCount&&this.rows===this.settings.maxRowsCount),++this.yield.flushed>=this.yield.every))return void this.startImgAnalyzer(t)}else if("error"!==e.data("jg.loaded"))return}0<this.buildingRow.entriesBuff.length&&this.flushRow(!0,0<this.settings.maxRowsCount&&this.rows===this.settings.maxRowsCount),this.isSpinnerActive()&&this.stopLoadingSpinnerAnimation(),this.stopImgAnalyzerStarter(),this.setGalleryFinalHeight(this.galleryHeightToSet),this.settings.triggerEvent.call(this,t?"jg.resize":"jg.complete")},r.prototype.stopImgAnalyzerStarter=function(){this.yield.flushed=0,null!==this.imgAnalyzerTimeout&&(clearTimeout(this.imgAnalyzerTimeout),this.imgAnalyzerTimeout=null)},r.prototype.startImgAnalyzer=function(t){var i=this;this.stopImgAnalyzerStarter(),this.imgAnalyzerTimeout=setTimeout(function(){i.analyzeImages(t)},.001)},r.prototype.onImageEvent=function(t,i,e){if(i||e){var s=new Image,n=l(s);i&&n.one("load",function(){n.off("load error"),i(s)}),e&&n.one("error",function(){n.off("load error"),e(s)}),s.src=t}},r.prototype.init=function(){var a=!1,h=!1,g=this;l.each(this.entries,function(t,i){var e=l(i),s=g.imgFromEntry(e);if(e.addClass("jg-entry"),!0!==e.data("jg.loaded")&&"skipped"!==e.data("jg.loaded"))if(null!==g.settings.rel&&e.attr("rel",g.settings.rel),null!==g.settings.target&&e.attr("target",g.settings.target),null!==s){var n=g.extractImgSrcFromImage(s);if(!1===g.settings.waitThumbnailsLoad||!n){var r=parseFloat(s.attr("width")),o=parseFloat(s.attr("height"));if("svg"===s.prop("tagName")&&(r=parseFloat(s[0].getBBox().width),o=parseFloat(s[0].getBBox().height)),!isNaN(r)&&!isNaN(o))return e.data("jg.width",r),e.data("jg.height",o),e.data("jg.loaded","skipped"),h=!0,g.startImgAnalyzer(!1),!0}e.data("jg.loaded",!1),a=!0,g.isSpinnerActive()||g.startLoadingSpinnerAnimation(),g.onImageEvent(n,function(t){e.data("jg.width",t.width),e.data("jg.height",t.height),e.data("jg.loaded",!0),g.startImgAnalyzer(!1)},function(){e.data("jg.loaded","error"),g.startImgAnalyzer(!1)})}else e.data("jg.loaded",!0),e.data("jg.width",e.width()|parseFloat(e.css("width"))|1),e.data("jg.height",e.height()|parseFloat(e.css("height"))|1)}),a||h||this.startImgAnalyzer(!1),this.checkWidth()},r.prototype.checkOrConvertNumber=function(t,i){if("string"===l.type(t[i])&&(t[i]=parseFloat(t[i])),"number"!==l.type(t[i]))throw i+" must be a number";if(isNaN(t[i]))throw"invalid number for "+i},r.prototype.checkSizeRangesSuffixes=function(){if("object"!==l.type(this.settings.sizeRangeSuffixes))throw"sizeRangeSuffixes must be defined and must be an object";var t=[];for(var i in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(i)&&t.push(i);for(var e={0:""},s=0;s<t.length;s++)if("string"===l.type(t[s]))try{e[parseInt(t[s].replace(/^[a-z]+/,""),10)]=this.settings.sizeRangeSuffixes[t[s]]}catch(t){throw"sizeRangeSuffixes keys must contains correct numbers ("+t+")"}else e[t[s]]=this.settings.sizeRangeSuffixes[t[s]];this.settings.sizeRangeSuffixes=e},r.prototype.retrieveMaxRowHeight=function(){var t=null,i=this.settings.rowHeight;if("string"===l.type(this.settings.maxRowHeight))t=this.settings.maxRowHeight.match(/^[0-9]+%$/)?i*parseFloat(this.settings.maxRowHeight.match(/^([0-9]+)%$/)[1])/100:parseFloat(this.settings.maxRowHeight);else{if("number"!==l.type(this.settings.maxRowHeight)){if(!1===this.settings.maxRowHeight||null==this.settings.maxRowHeight)return null;throw"maxRowHeight must be a number or a percentage"}t=this.settings.maxRowHeight}if(isNaN(t))throw"invalid number for maxRowHeight";return t<i&&(t=i),t},r.prototype.checkSettings=function(){this.checkSizeRangesSuffixes(),this.checkOrConvertNumber(this.settings,"rowHeight"),this.checkOrConvertNumber(this.settings,"margins"),this.checkOrConvertNumber(this.settings,"border"),this.checkOrConvertNumber(this.settings,"maxRowsCount");var t=["justify","nojustify","left","center","right","hide"];if(-1===t.indexOf(this.settings.lastRow))throw"lastRow must be one of: "+t.join(", ");if(this.checkOrConvertNumber(this.settings,"justifyThreshold"),this.settings.justifyThreshold<0||1<this.settings.justifyThreshold)throw"justifyThreshold must be in the interval [0,1]";if("boolean"!==l.type(this.settings.cssAnimation))throw"cssAnimation must be a boolean";if("boolean"!==l.type(this.settings.captions))throw"captions must be a boolean";if(this.checkOrConvertNumber(this.settings.captionSettings,"animationDuration"),this.checkOrConvertNumber(this.settings.captionSettings,"visibleOpacity"),this.settings.captionSettings.visibleOpacity<0||1<this.settings.captionSettings.visibleOpacity)throw"captionSettings.visibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings.captionSettings,"nonVisibleOpacity"),this.settings.captionSettings.nonVisibleOpacity<0||1<this.settings.captionSettings.nonVisibleOpacity)throw"captionSettings.nonVisibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings,"imagesAnimationDuration"),this.checkOrConvertNumber(this.settings,"refreshTime"),this.checkOrConvertNumber(this.settings,"refreshSensitivity"),"boolean"!==l.type(this.settings.randomize))throw"randomize must be a boolean";if("string"!==l.type(this.settings.selector))throw"selector must be a string";if(!1!==this.settings.sort&&!l.isFunction(this.settings.sort))throw"sort must be false or a comparison function";if(!1!==this.settings.filter&&!l.isFunction(this.settings.filter)&&"string"!==l.type(this.settings.filter))throw"filter must be false, a string or a filter function"},r.prototype.retrieveSuffixRanges=function(){var t=[];for(var i in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(i)&&t.push(parseInt(i,10));return t.sort(function(t,i){return i<t?1:t<i?-1:0}),t},r.prototype.updateSettings=function(t){this.settings=l.extend({},this.settings,t),this.checkSettings(),this.border=0<=this.settings.border?this.settings.border:this.settings.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges()},r.prototype.defaults={sizeRangeSuffixes:{},thumbnailPath:void 0,rowHeight:120,maxRowHeight:!1,maxRowsCount:0,margins:1,border:-1,lastRow:"nojustify",justifyThreshold:.9,waitThumbnailsLoad:!0,captions:!0,cssAnimation:!0,imagesAnimationDuration:500,captionSettings:{animationDuration:500,visibleOpacity:.7,nonVisibleOpacit
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * justifiedGallery - v3.8.1
2
+ * justifiedGallery - v3.8.0
3
3
  * http://miromannino.github.io/Justified-Gallery/
4
4
  * Copyright (c) 2020 Miro Mannino
5
5
  * Licensed under the MIT license.
@@ -11,13 +11,13 @@
11
11
  define(['jquery'], factory);
12
12
  } else if (typeof module === 'object' && module.exports) {
13
13
  // Node/CommonJS
14
- module.exports = function( root, jQuery ) {
15
- if ( jQuery === undefined ) {
14
+ module.exports = function (root, jQuery) {
15
+ if (jQuery === undefined) {
16
16
  // require('jQuery') returns a factory that requires window to
17
17
  // build a jQuery instance, we normalize how we use modules
18
18
  // that require this pattern but the window provided is a noop
19
19
  // if it's defined (how jquery works)
20
- if ( typeof window !== 'undefined' ) {
20
+ if (typeof window !== 'undefined') {
21
21
  jQuery = require('jquery');
22
22
  }
23
23
  else {
@@ -48,16 +48,16 @@
48
48
  this.imgAnalyzerTimeout = null;
49
49
  this.entries = null;
50
50
  this.buildingRow = {
51
- entriesBuff : [],
52
- width : 0,
53
- height : 0,
54
- aspectRatio : 0
51
+ entriesBuff: [],
52
+ width: 0,
53
+ height: 0,
54
+ aspectRatio: 0
55
55
  };
56
56
  this.lastFetchedEntry = null;
57
57
  this.lastAnalyzedIndex = -1;
58
58
  this.yield = {
59
- every : 2, // do a flush every n flushes (must be greater than 1)
60
- flushed : 0 // flushed rows without a yield
59
+ every: 2, // do a flush every n flushes (must be greater than 1)
60
+ flushed: 0 // flushed rows without a yield
61
61
  };
62
62
  this.border = settings.border >= 0 ? settings.border : settings.margins;
63
63
  this.maxRowHeight = this.retrieveMaxRowHeight();
@@ -65,10 +65,10 @@
65
65
  this.offY = this.border;
66
66
  this.rows = 0;
67
67
  this.spinner = {
68
- phase : 0,
69
- timeSlot : 150,
70
- $el : $('<div class="spinner"><span></span><span></span><span></span></div>'),
71
- intervalId : null
68
+ phase: 0,
69
+ timeSlot: 150,
70
+ $el: $('<div class="jg-spinner"><span></span><span></span><span></span></div>'),
71
+ intervalId: null
72
72
  };
73
73
  this.scrollBarOn = false;
74
74
  this.checkWidthIntervalId = null;
@@ -168,7 +168,7 @@
168
168
  */
169
169
  JustifiedGallery.prototype.extractImgSrcFromImage = function ($image) {
170
170
  var imageSrc = $image.data('safe-src');
171
- var imageSrcLoc = 'date-safe-src';
171
+ var imageSrcLoc = 'data-safe-src';
172
172
  if (typeof imageSrc === 'undefined') {
173
173
  imageSrc = $image.attr('src');
174
174
  imageSrcLoc = 'src';
@@ -187,7 +187,7 @@
187
187
 
188
188
  /** @returns {jQuery} the caption in the given entry */
189
189
  JustifiedGallery.prototype.captionFromEntry = function ($entry) {
190
- var $caption = $entry.find('> .caption');
190
+ var $caption = $entry.find('> .jg-caption');
191
191
  return $caption.length === 0 ? null : $caption;
192
192
  };
193
193
 
@@ -211,8 +211,8 @@
211
211
  if ($image !== null) {
212
212
  $image.css('width', imgWidth);
213
213
  $image.css('height', imgHeight);
214
- $image.css('margin-left', - imgWidth / 2);
215
- $image.css('margin-top', - imgHeight / 2);
214
+ $image.css('margin-left', - Math.round(imgWidth / 2));
215
+ $image.css('margin-top', - Math.round(imgHeight / 2));
216
216
 
217
217
  // Image reloading for an high quality of thumbnails
218
218
  var imageSrc = $image.data('jg.src');
@@ -229,7 +229,7 @@
229
229
  // }
230
230
  };
231
231
 
232
- if ($entry.data('jg.loaded') === 'skipped') {
232
+ if ($entry.data('jg.loaded') === 'skipped' && imageSrc) {
233
233
  this.onImageEvent(imageSrc, (function() {
234
234
  this.showImg($entry, loadNewImage); //load the new image after the fadeIn
235
235
  $entry.data('jg.loaded', true);
@@ -263,7 +263,7 @@
263
263
  var caption = $image.attr('alt');
264
264
  if (!this.isValidCaption(caption)) caption = $entry.attr('title');
265
265
  if (this.isValidCaption(caption)) { // Create only we found something
266
- $imgCaption = $('<div class="caption">' + caption + '</div>');
266
+ $imgCaption = $('<div class="jg-caption">' + caption + '</div>');
267
267
  $entry.append($imgCaption);
268
268
  $entry.data('jg.createdCaption', true);
269
269
  }
@@ -298,10 +298,10 @@
298
298
  JustifiedGallery.prototype.onEntryMouseEnterForCaption = function (eventObject) {
299
299
  var $caption = this.captionFromEntry($(eventObject.currentTarget));
300
300
  if (this.settings.cssAnimation) {
301
- $caption.addClass('caption-visible').removeClass('caption-hidden');
301
+ $caption.addClass('jg-caption-visible').removeClass('jg-caption-hidden');
302
302
  } else {
303
303
  $caption.stop().fadeTo(this.settings.captionSettings.animationDuration,
304
- this.settings.captionSettings.visibleOpacity);
304
+ this.settings.captionSettings.visibleOpacity);
305
305
  }
306
306
  };
307
307
 
@@ -314,10 +314,10 @@
314
314
  JustifiedGallery.prototype.onEntryMouseLeaveForCaption = function (eventObject) {
315
315
  var $caption = this.captionFromEntry($(eventObject.currentTarget));
316
316
  if (this.settings.cssAnimation) {
317
- $caption.removeClass('caption-visible').removeClass('caption-hidden');
317
+ $caption.removeClass('jg-caption-visible').removeClass('jg-caption-hidden');
318
318
  } else {
319
319
  $caption.stop().fadeTo(this.settings.captionSettings.animationDuration,
320
- this.settings.captionSettings.nonVisibleOpacity);
320
+ this.settings.captionSettings.nonVisibleOpacity);
321
321
  }
322
322
  };
323
323
 
@@ -366,19 +366,20 @@
366
366
  * Justify the building row, preparing it to
367
367
  *
368
368
  * @param isLastRow
369
+ * @param hiddenRow undefined or false for normal behavior. hiddenRow = true to hide the row.
369
370
  * @returns a boolean to know if the row has been justified or not
370
371
  */
371
- JustifiedGallery.prototype.prepareBuildingRow = function (isLastRow) {
372
+ JustifiedGallery.prototype.prepareBuildingRow = function (isLastRow, hiddenRow) {
372
373
  var i, $entry, imgAspectRatio, newImgW, newImgH, justify = true;
373
374
  var minHeight = 0;
374
375
  var availableWidth = this.galleryWidth - 2 * this.border - (
375
- (this.buildingRow.entriesBuff.length - 1) * this.settings.margins);
376
+ (this.buildingRow.entriesBuff.length - 1) * this.settings.margins);
376
377
  var rowHeight = availableWidth / this.buildingRow.aspectRatio;
377
378
  var defaultRowHeight = this.settings.rowHeight;
378
379
  var justifiable = this.buildingRow.width / availableWidth > this.settings.justifyThreshold;
379
380
 
380
381
  //Skip the last row if we can't justify it and the lastRow == 'hide'
381
- if (isLastRow && this.settings.lastRow === 'hide' && !justifiable) {
382
+ if (hiddenRow || (isLastRow && this.settings.lastRow === 'hide' && !justifiable)) {
382
383
  for (i = 0; i < this.buildingRow.entriesBuff.length; i++) {
383
384
  $entry = this.buildingRow.entriesBuff[i];
384
385
  if (this.settings.cssAnimation)
@@ -427,19 +428,20 @@
427
428
  * Flush a row: justify it, modify the gallery height accordingly to the row height
428
429
  *
429
430
  * @param isLastRow
431
+ * @param hiddenRow undefined or false for normal behavior. hiddenRow = true to hide the row.
430
432
  */
431
- JustifiedGallery.prototype.flushRow = function (isLastRow) {
433
+ JustifiedGallery.prototype.flushRow = function (isLastRow, hiddenRow) {
432
434
  var settings = this.settings;
433
435
  var $entry, buildingRowRes, offX = this.border, i;
434
436
 
435
- buildingRowRes = this.prepareBuildingRow(isLastRow);
436
- if (isLastRow && settings.lastRow === 'hide' && buildingRowRes === -1) {
437
+ buildingRowRes = this.prepareBuildingRow(isLastRow, hiddenRow);
438
+ if (hiddenRow || (isLastRow && settings.lastRow === 'hide' && buildingRowRes === -1)) {
437
439
  this.clearBuildingRow();
438
440
  return;
439
441
  }
440
442
 
441
- if(this.maxRowHeight) {
442
- if(this.maxRowHeight < this.buildingRow.height) this.buildingRow.height = this.maxRowHeight;
443
+ if (this.maxRowHeight) {
444
+ if (this.maxRowHeight < this.buildingRow.height) this.buildingRow.height = this.maxRowHeight;
443
445
  }
444
446
 
445
447
  //Align last (unjustified) row
@@ -452,14 +454,14 @@
452
454
  }
453
455
 
454
456
  if (settings.lastRow === 'center')
455
- offX += availableWidth / 2;
457
+ offX += Math.round(availableWidth / 2);
456
458
  else if (settings.lastRow === 'right')
457
459
  offX += availableWidth;
458
460
  }
459
461
 
460
462
  var lastEntryIdx = this.buildingRow.entriesBuff.length - 1;
461
463
  for (i = 0; i <= lastEntryIdx; i++) {
462
- $entry = this.buildingRow.entriesBuff[ this.settings.rtl ? lastEntryIdx - i : i ];
464
+ $entry = this.buildingRow.entriesBuff[this.settings.rtl ? lastEntryIdx - i : i];
463
465
  this.displayEntry($entry, offX, this.offY, $entry.data('jg.jwidth'), $entry.data('jg.jheight'), this.buildingRow.height);
464
466
  offX += $entry.data('jg.jwidth') + settings.margins;
465
467
  }
@@ -573,11 +575,19 @@
573
575
  this.clearBuildingRow();
574
576
  };
575
577
 
578
+ /**
579
+ * @returns {String} `settings.selector` rejecting spinner element
580
+ */
581
+ JustifiedGallery.prototype.getSelectorWithoutSpinner = function () {
582
+ return this.settings.selector + ', div:not(.jg-spinner)';
583
+ };
584
+
576
585
  /**
577
586
  * @returns {Array} all entries matched by `settings.selector`
578
587
  */
579
588
  JustifiedGallery.prototype.getAllEntries = function () {
580
- return this.$gallery.children(this.settings.selector).toArray();
589
+ var selector = this.getSelectorWithoutSpinner();
590
+ return this.$gallery.children(selector).toArray();
581
591
  };
582
592
 
583
593
  /**
@@ -590,7 +600,8 @@
590
600
  var newEntries;
591
601
 
592
602
  if (norewind && this.lastFetchedEntry != null) {
593
- newEntries = $(this.lastFetchedEntry).nextAll(this.settings.selector).toArray();
603
+ var selector = this.getSelectorWithoutSpinner();
604
+ newEntries = $(this.lastFetchedEntry).nextAll(selector).toArray();
594
605
  } else {
595
606
  this.entries = [];
596
607
  newEntries = this.getAllEntries();
@@ -708,12 +719,12 @@
708
719
  * Revert the image src to the default value.
709
720
  */
710
721
  JustifiedGallery.prototype.resetImgSrc = function ($img) {
711
- if ($img.data('jg.originalSrcLoc') == 'src') {
722
+ if ($img.data('jg.originalSrcLoc') === 'src') {
712
723
  $img.attr('src', $img.data('jg.originalSrc'));
713
724
  } else {
714
725
  $img.attr('src', '');
715
726
  }
716
- }
727
+ };
717
728
 
718
729
  /**
719
730
  * Destroy the Justified Gallery instance.
@@ -729,7 +740,7 @@
729
740
  this.stopImgAnalyzerStarter();
730
741
 
731
742
  // Get fresh entries list since filtered entries are absent in `this.entries`
732
- $.each(this.getAllEntries(), $.proxy(function(_, entry) {
743
+ $.each(this.getAllEntries(), $.proxy(function (_, entry) {
733
744
  var $entry = $(entry);
734
745
 
735
746
  // Reset entry style
@@ -782,7 +793,7 @@
782
793
  var $entry = $(this.entries[i]);
783
794
  if ($entry.data('jg.loaded') === true || $entry.data('jg.loaded') === 'skipped') {
784
795
  var availableWidth = this.galleryWidth - 2 * this.border - (
785
- (this.buildingRow.entriesBuff.length - 1) * this.settings.margins);
796
+ (this.buildingRow.entriesBuff.length - 1) * this.settings.margins);
786
797
  var imgAspectRatio = $entry.data('jg.width') / $entry.data('jg.height');
787
798
 
788
799
  this.buildingRow.entriesBuff.push($entry);
@@ -791,9 +802,9 @@
791
802
  this.lastAnalyzedIndex = i;
792
803
 
793
804
  if (availableWidth / (this.buildingRow.aspectRatio + imgAspectRatio) < this.settings.rowHeight) {
794
- this.flushRow(false);
805
+ this.flushRow(false, this.settings.maxRowsCount > 0 && this.rows === this.settings.maxRowsCount);
795
806
 
796
- if(++this.yield.flushed >= this.yield.every) {
807
+ if (++this.yield.flushed >= this.yield.every) {
797
808
  this.startImgAnalyzer(isForResize);
798
809
  return;
799
810
  }
@@ -804,7 +815,9 @@
804
815
  }
805
816
 
806
817
  // Last row flush (the row is not full)
807
- if (this.buildingRow.entriesBuff.length > 0) this.flushRow(true);
818
+ if (this.buildingRow.entriesBuff.length > 0) {
819
+ this.flushRow(true, this.settings.maxRowsCount > 0 && this.rows === this.settings.maxRowsCount);
820
+ }
808
821
 
809
822
  if (this.isSpinnerActive()) {
810
823
  this.stopLoadingSpinnerAnimation();
@@ -816,9 +829,10 @@
816
829
  */
817
830
  this.stopImgAnalyzerStarter();
818
831
 
832
+ this.setGalleryFinalHeight(this.galleryHeightToSet);
833
+
819
834
  //On complete callback
820
835
  this.settings.triggerEvent.call(this, isForResize ? 'jg.resize' : 'jg.complete');
821
- this.setGalleryFinalHeight(this.galleryHeightToSet);
822
836
  };
823
837
 
824
838
  /**
@@ -865,7 +879,7 @@
865
879
  });
866
880
  }
867
881
  if (onError) {
868
- $memImage.one('error', function() {
882
+ $memImage.one('error', function () {
869
883
  $memImage.off('load error');
870
884
  onError(memImage);
871
885
  });
@@ -979,7 +993,7 @@
979
993
  if (this.settings.sizeRangeSuffixes.hasOwnProperty(rangeIdx)) suffixRanges.push(rangeIdx);
980
994
  }
981
995
 
982
- var newSizeRngSuffixes = {0: ''};
996
+ var newSizeRngSuffixes = { 0: '' };
983
997
  for (var i = 0; i < suffixRanges.length; i++) {
984
998
  if ($.type(suffixRanges[i]) === 'string') {
985
999
  try {
@@ -1038,6 +1052,7 @@
1038
1052
  this.checkOrConvertNumber(this.settings, 'rowHeight');
1039
1053
  this.checkOrConvertNumber(this.settings, 'margins');
1040
1054
  this.checkOrConvertNumber(this.settings, 'border');
1055
+ this.checkOrConvertNumber(this.settings, 'maxRowsCount');
1041
1056
 
1042
1057
  var lastRowModes = [
1043
1058
  'justify',
@@ -1064,13 +1079,13 @@
1064
1079
 
1065
1080
  this.checkOrConvertNumber(this.settings.captionSettings, 'visibleOpacity');
1066
1081
  if (this.settings.captionSettings.visibleOpacity < 0 ||
1067
- this.settings.captionSettings.visibleOpacity > 1) {
1082
+ this.settings.captionSettings.visibleOpacity > 1) {
1068
1083
  throw 'captionSettings.visibleOpacity must be in the interval [0, 1]';
1069
1084
  }
1070
1085
 
1071
1086
  this.checkOrConvertNumber(this.settings.captionSettings, 'nonVisibleOpacity');
1072
1087
  if (this.settings.captionSettings.nonVisibleOpacity < 0 ||
1073
- this.settings.captionSettings.nonVisibleOpacity > 1) {
1088
+ this.settings.captionSettings.nonVisibleOpacity > 1) {
1074
1089
  throw 'captionSettings.nonVisibleOpacity must be in the interval [0, 1]';
1075
1090
  }
1076
1091
 
@@ -1085,7 +1100,7 @@
1085
1100
  }
1086
1101
 
1087
1102
  if (this.settings.filter !== false && !$.isFunction(this.settings.filter) &&
1088
- $.type(this.settings.filter) !== 'string') {
1103
+ $.type(this.settings.filter) !== 'string') {
1089
1104
  throw 'filter must be false, a string or a filter function';
1090
1105
  }
1091
1106
  };
@@ -1121,7 +1136,7 @@
1121
1136
  };
1122
1137
 
1123
1138
  JustifiedGallery.prototype.defaults = {
1124
- sizeRangeSuffixes: { }, /* e.g. Flickr configuration
1139
+ sizeRangeSuffixes: {}, /* e.g. Flickr configuration
1125
1140
  {
1126
1141
  100: '_t', // used when longest is less than 100px
1127
1142
  240: '_m', // used when longest is between 101px and 240px
@@ -1136,8 +1151,9 @@
1136
1151
  current path, width and height */
1137
1152
  rowHeight: 120, // required? required to be > 0?
1138
1153
  maxRowHeight: false, // false or negative value to deactivate. Positive number to express the value in pixels,
1139
- // A string '[0-9]+%' to express in percentage (e.g. 300% means that the row height
1140
- // can't exceed 3 * rowHeight)
1154
+ // A string '[0-9]+%' to express in percentage (e.g. 300% means that the row height
1155
+ // can't exceed 3 * rowHeight)
1156
+ maxRowsCount: 0, // maximum number of rows to be displayed (0 = disabled)
1141
1157
  margins: 1,
1142
1158
  border: -1, // negative value = same as margins, 0 = disabled, any other value to set the border
1143
1159
 
@@ -1172,7 +1188,7 @@
1172
1188
  - a function: invoked with arguments (entry, index, array). Return true to keep the entry, false otherwise.
1173
1189
  It follows the specifications of the Array.prototype.filter() function of JavaScript.
1174
1190
  */
1175
- selector: 'a, div:not(.spinner)', // The selector that is used to know what are the entries of the gallery
1191
+ selector: 'a', // The selector that is used to know what are the entries of the gallery
1176
1192
  imgSelector: '> img, > a > img, > svg, > a > svg', // The selector that is used to know what are the images of each entry
1177
1193
  triggerEvent: function (event) { // This is called to trigger events, the default behavior is to call $.trigger
1178
1194
  this.$gallery.trigger(event); // Consider that 'this' is this set to the JustifiedGallery object, so it can
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * justifiedGallery - v3.8.1
2
+ * justifiedGallery - v3.8.0
3
3
  * http://miromannino.github.io/Justified-Gallery/
4
4
  * Copyright (c) 2020 Miro Mannino
5
5
  * Licensed under the MIT license.
6
6
  */
7
7
 
8
- !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,i){return void 0===i&&(i="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(i),i}:e(jQuery)}(function(l){var r=function(t,i){this.settings=i,this.checkSettings(),this.imgAnalyzerTimeout=null,this.entries=null,this.buildingRow={entriesBuff:[],width:0,height:0,aspectRatio:0},this.lastFetchedEntry=null,this.lastAnalyzedIndex=-1,this.yield={every:2,flushed:0},this.border=0<=i.border?i.border:i.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges(),this.offY=this.border,this.rows=0,this.spinner={phase:0,timeSlot:150,$el:l('<div class="spinner"><span></span><span></span><span></span></div>'),intervalId:null},this.scrollBarOn=!1,this.checkWidthIntervalId=null,this.galleryWidth=t.width(),this.$gallery=t};r.prototype.getSuffix=function(t,i){var e,s;for(e=i<t?t:i,s=0;s<this.suffixRanges.length;s++)if(e<=this.suffixRanges[s])return this.settings.sizeRangeSuffixes[this.suffixRanges[s]];return this.settings.sizeRangeSuffixes[this.suffixRanges[s-1]]},r.prototype.removeSuffix=function(t,i){return t.substring(0,t.length-i.length)},r.prototype.endsWith=function(t,i){return-1!==t.indexOf(i,t.length-i.length)},r.prototype.getUsedSuffix=function(t){for(var i in this.settings.sizeRangeSuffixes)if(this.settings.sizeRangeSuffixes.hasOwnProperty(i)){if(0===this.settings.sizeRangeSuffixes[i].length)continue;if(this.endsWith(t,this.settings.sizeRangeSuffixes[i]))return this.settings.sizeRangeSuffixes[i]}return""},r.prototype.newSrc=function(t,i,e,s){var n;if(this.settings.thumbnailPath)n=this.settings.thumbnailPath(t,i,e,s);else{var r=t.match(this.settings.extension),o=null!==r?r[0]:"";n=t.replace(this.settings.extension,""),n=this.removeSuffix(n,this.getUsedSuffix(n)),n+=this.getSuffix(i,e)+o}return n},r.prototype.showImg=function(t,i){this.settings.cssAnimation?(t.addClass("jg-entry-visible"),i&&i()):(t.stop().fadeTo(this.settings.imagesAnimationDuration,1,i),t.find(this.settings.imgSelector).stop().fadeTo(this.settings.imagesAnimationDuration,1,i))},r.prototype.extractImgSrcFromImage=function(t){var i=t.data("safe-src"),e="date-safe-src";return void 0===i&&(i=t.attr("src"),e="src"),t.data("jg.originalSrc",i),t.data("jg.src",i),t.data("jg.originalSrcLoc",e),i},r.prototype.imgFromEntry=function(t){var i=t.find(this.settings.imgSelector);return 0===i.length?null:i},r.prototype.captionFromEntry=function(t){var i=t.find("> .caption");return 0===i.length?null:i},r.prototype.displayEntry=function(t,i,e,s,n,r){t.width(s),t.height(r),t.css("top",e),t.css("left",i);var o=this.imgFromEntry(t);if(null!==o){o.css("width",s),o.css("height",n),o.css("margin-left",-s/2),o.css("margin-top",-n/2);var a=o.data("jg.src");if(a){a=this.newSrc(a,s,n,o[0]),o.one("error",function(){this.resetImgSrc(o)});var h=function(){o.attr("src",a)};"skipped"===t.data("jg.loaded")?this.onImageEvent(a,function(){this.showImg(t,h),t.data("jg.loaded",!0)}.bind(this)):this.showImg(t,h)}}else this.showImg(t);this.displayEntryCaption(t)},r.prototype.displayEntryCaption=function(t){var i=this.imgFromEntry(t);if(null!==i&&this.settings.captions){var e=this.captionFromEntry(t);if(null===e){var s=i.attr("alt");this.isValidCaption(s)||(s=t.attr("title")),this.isValidCaption(s)&&(e=l('<div class="caption">'+s+"</div>"),t.append(e),t.data("jg.createdCaption",!0))}null!==e&&(this.settings.cssAnimation||e.stop().fadeTo(0,this.settings.captionSettings.nonVisibleOpacity),this.addCaptionEventsHandlers(t))}else this.removeCaptionEventsHandlers(t)},r.prototype.isValidCaption=function(t){return void 0!==t&&0<t.length},r.prototype.onEntryMouseEnterForCaption=function(t){var i=this.captionFromEntry(l(t.currentTarget));this.settings.cssAnimation?i.addClass("caption-visible").removeClass("caption-hidden"):i.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.visibleOpacity)},r.prototype.onEntryMouseLeaveForCaption=function(t){var i=this.captionFromEntry(l(t.currentTarget));this.settings.cssAnimation?i.removeClass("caption-visible").removeClass("caption-hidden"):i.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.nonVisibleOpacity)},r.prototype.addCaptionEventsHandlers=function(t){var i=t.data("jg.captionMouseEvents");void 0===i&&(i={mouseenter:l.proxy(this.onEntryMouseEnterForCaption,this),mouseleave:l.proxy(this.onEntryMouseLeaveForCaption,this)},t.on("mouseenter",void 0,void 0,i.mouseenter),t.on("mouseleave",void 0,void 0,i.mouseleave),t.data("jg.captionMouseEvents",i))},r.prototype.removeCaptionEventsHandlers=function(t){var i=t.data("jg.captionMouseEvents");void 0!==i&&(t.off("mouseenter",void 0,i.mouseenter),t.off("mouseleave",void 0,i.mouseleave),t.removeData("jg.captionMouseEvents"))},r.prototype.clearBuildingRow=function(){this.buildingRow.entriesBuff=[],this.buildingRow.aspectRatio=0,this.buildingRow.width=0},r.prototype.prepareBuildingRow=function(t){var i,e,s,n,r,o=!0,a=0,h=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,g=h/this.buildingRow.aspectRatio,l=this.settings.rowHeight,d=this.buildingRow.width/h>this.settings.justifyThreshold;if(t&&"hide"===this.settings.lastRow&&!d){for(i=0;i<this.buildingRow.entriesBuff.length;i++)e=this.buildingRow.entriesBuff[i],this.settings.cssAnimation?e.removeClass("jg-entry-visible"):(e.stop().fadeTo(0,.1),e.find("> img, > a > img").fadeTo(0,0));return-1}for(t&&!d&&"justify"!==this.settings.lastRow&&"hide"!==this.settings.lastRow&&(o=!1,0<this.rows&&(o=(l=(this.offY-this.border-this.settings.margins*this.rows)/this.rows)*this.buildingRow.aspectRatio/h>this.settings.justifyThreshold)),i=0;i<this.buildingRow.entriesBuff.length;i++)s=(e=this.buildingRow.entriesBuff[i]).data("jg.width")/e.data("jg.height"),o?(n=i===this.buildingRow.entriesBuff.length-1?h:g*s,r=g):(n=l*s,r=l),h-=Math.round(n),e.data("jg.jwidth",Math.round(n)),e.data("jg.jheight",Math.ceil(r)),(0===i||r<a)&&(a=r);return this.buildingRow.height=a,o},r.prototype.flushRow=function(t){var i,e,s,n=this.settings,r=this.border;if(e=this.prepareBuildingRow(t),t&&"hide"===n.lastRow&&-1===e)this.clearBuildingRow();else{if(this.maxRowHeight&&this.maxRowHeight<this.buildingRow.height&&(this.buildingRow.height=this.maxRowHeight),t&&("center"===n.lastRow||"right"===n.lastRow)){var o=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*n.margins;for(s=0;s<this.buildingRow.entriesBuff.length;s++)o-=(i=this.buildingRow.entriesBuff[s]).data("jg.jwidth");"center"===n.lastRow?r+=o/2:"right"===n.lastRow&&(r+=o)}var a=this.buildingRow.entriesBuff.length-1;for(s=0;s<=a;s++)i=this.buildingRow.entriesBuff[this.settings.rtl?a-s:s],this.displayEntry(i,r,this.offY,i.data("jg.jwidth"),i.data("jg.jheight"),this.buildingRow.height),r+=i.data("jg.jwidth")+n.margins;this.galleryHeightToSet=this.offY+this.buildingRow.height+this.border,this.setGalleryTempHeight(this.galleryHeightToSet+this.getSpinnerHeight()),(!t||this.buildingRow.height<=n.rowHeight&&e)&&(this.offY+=this.buildingRow.height+n.margins,this.rows+=1,this.clearBuildingRow(),this.settings.triggerEvent.call(this,"jg.rowflush"))}};var i=0;r.prototype.rememberGalleryHeight=function(){i=this.$gallery.height(),this.$gallery.height(i)},r.prototype.setGalleryTempHeight=function(t){i=Math.max(t,i),this.$gallery.height(i)},r.prototype.setGalleryFinalHeight=function(t){i=t,this.$gallery.height(t)},r.prototype.checkWidth=function(){this.checkWidthIntervalId=setInterval(l.proxy(function(){if(this.$gallery.is(":visible")){var t=parseFloat(this.$gallery.width());Math.abs(t-this.galleryWidth)>this.settings.refreshSensitivity&&(this.galleryWidth=t,this.rewind(),this.rememberGalleryHeight(),this.startImgAnalyzer(!0))}},this),this.settings.refreshTime)},r.prototype.isSpinnerActive=function(){return null!==this.spinner.intervalId},r.prototype.getSpinnerHeight=function(){return this.spinner.$el.innerHeight()},r.prototype.stopLoadingSpinnerAnimation=function(){clearInterval(this.spinner.intervalId),this.spinner.intervalId=null,this.setGalleryTempHeight(this.$gallery.height()-this.getSpinnerHeight()),this.spinner.$el.detach()},r.prototype.startLoadingSpinnerAnimation=function(){var t=this.spinner,i=t.$el.find("span");clearInterval(t.intervalId),this.$gallery.append(t.$el),this.setGalleryTempHeight(this.offY+this.buildingRow.height+this.getSpinnerHeight()),t.intervalId=setInterval(function(){t.phase<i.length?i.eq(t.phase).fadeTo(t.timeSlot,1):i.eq(t.phase-i.length).fadeTo(t.timeSlot,0),t.phase=(t.phase+1)%(2*i.length)},t.timeSlot)},r.prototype.rewind=function(){this.lastFetchedEntry=null,this.lastAnalyzedIndex=-1,this.offY=this.border,this.rows=0,this.clearBuildingRow()},r.prototype.getAllEntries=function(){return this.$gallery.children(this.settings.selector).toArray()},r.prototype.updateEntries=function(t){var i;return t&&null!=this.lastFetchedEntry?i=l(this.lastFetchedEntry).nextAll(this.settings.selector).toArray():(this.entries=[],i=this.getAllEntries()),0<i.length&&(l.isFunction(this.settings.sort)?i=this.sortArray(i):this.settings.randomize&&(i=this.shuffleArray(i)),this.lastFetchedEntry=i[i.length-1],this.settings.filter?i=this.filterArray(i):this.resetFilters(i)),this.entries=this.entries.concat(i),!0},r.prototype.insertToGallery=function(t){var i=this;l.each(t,function(){l(this).appendTo(i.$gallery)})},r.prototype.shuffleArray=function(t){var i,e,s;for(i=t.length-1;0<i;i--)e=Math.floor(Math.random()*(i+1)),s=t[i],t[i]=t[e],t[e]=s;return this.insertToGallery(t),t},r.prototype.sortArray=function(t){return t.sort(this.settings.sort),this.insertToGallery(t),t},r.prototype.resetFilters=function(t){for(var i=0;i<t.length;i++)l(t[i]).removeClass("jg-filtered")},r.prototype.filterArray=function(t){var e=this.settings;if("string"===l.type(e.filter))return t.filter(function(t){var i=l(t);return i.is(e.filter)?(i.removeClass("jg-filtered"),!0):(i.addClass("jg-filtered").removeClass("jg-visible"),!1)});if(l.isFunction(e.filter)){for(var i=t.filter(e.filter),s=0;s<t.length;s++)-1===i.indexOf(t[s])?l(t[s]).addClass("jg-filtered").removeClass("jg-visible"):l(t[s]).removeClass("jg-filtered");return i}},r.prototype.resetImgSrc=function(t){"src"==t.data("jg.originalSrcLoc")?t.attr("src",t.data("jg.originalSrc")):t.attr("src","")},r.prototype.destroy=function(){clearInterval(this.checkWidthIntervalId),this.stopImgAnalyzerStarter(),l.each(this.getAllEntries(),l.proxy(function(t,i){var e=l(i);e.css("width",""),e.css("height",""),e.css("top",""),e.css("left",""),e.data("jg.loaded",void 0),e.removeClass("jg-entry jg-filtered jg-entry-visible");var s=this.imgFromEntry(e);s&&(s.css("width",""),s.css("height",""),s.css("margin-left",""),s.css("margin-top",""),this.resetImgSrc(s),s.data("jg.originalSrc",void 0),s.data("jg.originalSrcLoc",void 0),s.data("jg.src",void 0)),this.removeCaptionEventsHandlers(e);var n=this.captionFromEntry(e);e.data("jg.createdCaption")?(e.data("jg.createdCaption",void 0),null!==n&&n.remove()):null!==n&&n.fadeTo(0,1)},this)),this.$gallery.css("height",""),this.$gallery.removeClass("justified-gallery"),this.$gallery.data("jg.controller",void 0),this.settings.triggerEvent.call(this,"jg.destroy")},r.prototype.analyzeImages=function(t){for(var i=this.lastAnalyzedIndex+1;i<this.entries.length;i++){var e=l(this.entries[i]);if(!0===e.data("jg.loaded")||"skipped"===e.data("jg.loaded")){var s=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,n=e.data("jg.width")/e.data("jg.height");if(this.buildingRow.entriesBuff.push(e),this.buildingRow.aspectRatio+=n,this.buildingRow.width+=n*this.settings.rowHeight,this.lastAnalyzedIndex=i,s/(this.buildingRow.aspectRatio+n)<this.settings.rowHeight&&(this.flushRow(!1),++this.yield.flushed>=this.yield.every))return void this.startImgAnalyzer(t)}else if("error"!==e.data("jg.loaded"))return}0<this.buildingRow.entriesBuff.length&&this.flushRow(!0),this.isSpinnerActive()&&this.stopLoadingSpinnerAnimation(),this.stopImgAnalyzerStarter(),this.settings.triggerEvent.call(this,t?"jg.resize":"jg.complete"),this.setGalleryFinalHeight(this.galleryHeightToSet)},r.prototype.stopImgAnalyzerStarter=function(){this.yield.flushed=0,null!==this.imgAnalyzerTimeout&&(clearTimeout(this.imgAnalyzerTimeout),this.imgAnalyzerTimeout=null)},r.prototype.startImgAnalyzer=function(t){var i=this;this.stopImgAnalyzerStarter(),this.imgAnalyzerTimeout=setTimeout(function(){i.analyzeImages(t)},.001)},r.prototype.onImageEvent=function(t,i,e){if(i||e){var s=new Image,n=l(s);i&&n.one("load",function(){n.off("load error"),i(s)}),e&&n.one("error",function(){n.off("load error"),e(s)}),s.src=t}},r.prototype.init=function(){var a=!1,h=!1,g=this;l.each(this.entries,function(t,i){var e=l(i),s=g.imgFromEntry(e);if(e.addClass("jg-entry"),!0!==e.data("jg.loaded")&&"skipped"!==e.data("jg.loaded"))if(null!==g.settings.rel&&e.attr("rel",g.settings.rel),null!==g.settings.target&&e.attr("target",g.settings.target),null!==s){var n=g.extractImgSrcFromImage(s);if(!1===g.settings.waitThumbnailsLoad||!n){var r=parseFloat(s.attr("width")),o=parseFloat(s.attr("height"));if("svg"===s.prop("tagName")&&(r=parseFloat(s[0].getBBox().width),o=parseFloat(s[0].getBBox().height)),!isNaN(r)&&!isNaN(o))return e.data("jg.width",r),e.data("jg.height",o),e.data("jg.loaded","skipped"),h=!0,g.startImgAnalyzer(!1),!0}e.data("jg.loaded",!1),a=!0,g.isSpinnerActive()||g.startLoadingSpinnerAnimation(),g.onImageEvent(n,function(t){e.data("jg.width",t.width),e.data("jg.height",t.height),e.data("jg.loaded",!0),g.startImgAnalyzer(!1)},function(){e.data("jg.loaded","error"),g.startImgAnalyzer(!1)})}else e.data("jg.loaded",!0),e.data("jg.width",e.width()|parseFloat(e.css("width"))|1),e.data("jg.height",e.height()|parseFloat(e.css("height"))|1)}),a||h||this.startImgAnalyzer(!1),this.checkWidth()},r.prototype.checkOrConvertNumber=function(t,i){if("string"===l.type(t[i])&&(t[i]=parseFloat(t[i])),"number"!==l.type(t[i]))throw i+" must be a number";if(isNaN(t[i]))throw"invalid number for "+i},r.prototype.checkSizeRangesSuffixes=function(){if("object"!==l.type(this.settings.sizeRangeSuffixes))throw"sizeRangeSuffixes must be defined and must be an object";var t=[];for(var i in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(i)&&t.push(i);for(var e={0:""},s=0;s<t.length;s++)if("string"===l.type(t[s]))try{e[parseInt(t[s].replace(/^[a-z]+/,""),10)]=this.settings.sizeRangeSuffixes[t[s]]}catch(t){throw"sizeRangeSuffixes keys must contains correct numbers ("+t+")"}else e[t[s]]=this.settings.sizeRangeSuffixes[t[s]];this.settings.sizeRangeSuffixes=e},r.prototype.retrieveMaxRowHeight=function(){var t=null,i=this.settings.rowHeight;if("string"===l.type(this.settings.maxRowHeight))t=this.settings.maxRowHeight.match(/^[0-9]+%$/)?i*parseFloat(this.settings.maxRowHeight.match(/^([0-9]+)%$/)[1])/100:parseFloat(this.settings.maxRowHeight);else{if("number"!==l.type(this.settings.maxRowHeight)){if(!1===this.settings.maxRowHeight||null==this.settings.maxRowHeight)return null;throw"maxRowHeight must be a number or a percentage"}t=this.settings.maxRowHeight}if(isNaN(t))throw"invalid number for maxRowHeight";return t<i&&(t=i),t},r.prototype.checkSettings=function(){this.checkSizeRangesSuffixes(),this.checkOrConvertNumber(this.settings,"rowHeight"),this.checkOrConvertNumber(this.settings,"margins"),this.checkOrConvertNumber(this.settings,"border");var t=["justify","nojustify","left","center","right","hide"];if(-1===t.indexOf(this.settings.lastRow))throw"lastRow must be one of: "+t.join(", ");if(this.checkOrConvertNumber(this.settings,"justifyThreshold"),this.settings.justifyThreshold<0||1<this.settings.justifyThreshold)throw"justifyThreshold must be in the interval [0,1]";if("boolean"!==l.type(this.settings.cssAnimation))throw"cssAnimation must be a boolean";if("boolean"!==l.type(this.settings.captions))throw"captions must be a boolean";if(this.checkOrConvertNumber(this.settings.captionSettings,"animationDuration"),this.checkOrConvertNumber(this.settings.captionSettings,"visibleOpacity"),this.settings.captionSettings.visibleOpacity<0||1<this.settings.captionSettings.visibleOpacity)throw"captionSettings.visibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings.captionSettings,"nonVisibleOpacity"),this.settings.captionSettings.nonVisibleOpacity<0||1<this.settings.captionSettings.nonVisibleOpacity)throw"captionSettings.nonVisibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings,"imagesAnimationDuration"),this.checkOrConvertNumber(this.settings,"refreshTime"),this.checkOrConvertNumber(this.settings,"refreshSensitivity"),"boolean"!==l.type(this.settings.randomize))throw"randomize must be a boolean";if("string"!==l.type(this.settings.selector))throw"selector must be a string";if(!1!==this.settings.sort&&!l.isFunction(this.settings.sort))throw"sort must be false or a comparison function";if(!1!==this.settings.filter&&!l.isFunction(this.settings.filter)&&"string"!==l.type(this.settings.filter))throw"filter must be false, a string or a filter function"},r.prototype.retrieveSuffixRanges=function(){var t=[];for(var i in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(i)&&t.push(parseInt(i,10));return t.sort(function(t,i){return i<t?1:t<i?-1:0}),t},r.prototype.updateSettings=function(t){this.settings=l.extend({},this.settings,t),this.checkSettings(),this.border=0<=this.settings.border?this.settings.border:this.settings.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges()},r.prototype.defaults={sizeRangeSuffixes:{},thumbnailPath:void 0,rowHeight:120,maxRowHeight:!1,margins:1,border:-1,lastRow:"nojustify",justifyThreshold:.9,waitThumbnailsLoad:!0,captions:!0,cssAnimation:!0,imagesAnimationDuration:500,captionSettings:{animationDuration:500,visibleOpacity:.7,nonVisibleOpacity:0},rel:null,target:null,extension:/\.[^.\\/]+$/,refreshTime:200,refreshSensitivity:0,randomize:!1,rtl:!1,sort:!1,filter:!1,selector:"a, div:not(.spinner)",imgSelector:"> img, > a > img, > svg, > a > svg",triggerEvent:function(t){this.$gallery.trigger(t)}},l.fn.justifiedGallery=function(n){return this.each(function(t,i){var e=l(i);e.addClass("justified-gallery");var s=e.data("jg.controller");if(void 0===s){if(null!=n&&"object"!==l.type(n)){if("destroy"===n)return;throw"The argument must be an object"}s=new r(e,l.extend({},r.prototype.defaults,n)),e.data("jg.controller",s)}else if("norewind"===n);else{if("destroy"===n)return void s.destroy();s.updateSettings(n),s.rewind()}s.updateEntries("norewind"===n)&&s.init()})}});
8
+ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,i){return void 0===i&&(i="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(i),i}:e(jQuery)}(function(l){var r=function(t,i){this.settings=i,this.checkSettings(),this.imgAnalyzerTimeout=null,this.entries=null,this.buildingRow={entriesBuff:[],width:0,height:0,aspectRatio:0},this.lastFetchedEntry=null,this.lastAnalyzedIndex=-1,this.yield={every:2,flushed:0},this.border=0<=i.border?i.border:i.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges(),this.offY=this.border,this.rows=0,this.spinner={phase:0,timeSlot:150,$el:l('<div class="jg-spinner"><span></span><span></span><span></span></div>'),intervalId:null},this.scrollBarOn=!1,this.checkWidthIntervalId=null,this.galleryWidth=t.width(),this.$gallery=t};r.prototype.getSuffix=function(t,i){var e,s;for(e=i<t?t:i,s=0;s<this.suffixRanges.length;s++)if(e<=this.suffixRanges[s])return this.settings.sizeRangeSuffixes[this.suffixRanges[s]];return this.settings.sizeRangeSuffixes[this.suffixRanges[s-1]]},r.prototype.removeSuffix=function(t,i){return t.substring(0,t.length-i.length)},r.prototype.endsWith=function(t,i){return-1!==t.indexOf(i,t.length-i.length)},r.prototype.getUsedSuffix=function(t){for(var i in this.settings.sizeRangeSuffixes)if(this.settings.sizeRangeSuffixes.hasOwnProperty(i)){if(0===this.settings.sizeRangeSuffixes[i].length)continue;if(this.endsWith(t,this.settings.sizeRangeSuffixes[i]))return this.settings.sizeRangeSuffixes[i]}return""},r.prototype.newSrc=function(t,i,e,s){var n;if(this.settings.thumbnailPath)n=this.settings.thumbnailPath(t,i,e,s);else{var r=t.match(this.settings.extension),o=null!==r?r[0]:"";n=t.replace(this.settings.extension,""),n=this.removeSuffix(n,this.getUsedSuffix(n)),n+=this.getSuffix(i,e)+o}return n},r.prototype.showImg=function(t,i){this.settings.cssAnimation?(t.addClass("jg-entry-visible"),i&&i()):(t.stop().fadeTo(this.settings.imagesAnimationDuration,1,i),t.find(this.settings.imgSelector).stop().fadeTo(this.settings.imagesAnimationDuration,1,i))},r.prototype.extractImgSrcFromImage=function(t){var i=t.data("safe-src"),e="data-safe-src";return void 0===i&&(i=t.attr("src"),e="src"),t.data("jg.originalSrc",i),t.data("jg.src",i),t.data("jg.originalSrcLoc",e),i},r.prototype.imgFromEntry=function(t){var i=t.find(this.settings.imgSelector);return 0===i.length?null:i},r.prototype.captionFromEntry=function(t){var i=t.find("> .jg-caption");return 0===i.length?null:i},r.prototype.displayEntry=function(t,i,e,s,n,r){t.width(s),t.height(r),t.css("top",e),t.css("left",i);var o=this.imgFromEntry(t);if(null!==o){o.css("width",s),o.css("height",n),o.css("margin-left",-Math.round(s/2)),o.css("margin-top",-Math.round(n/2));var a=o.data("jg.src");if(a){a=this.newSrc(a,s,n,o[0]),o.one("error",function(){this.resetImgSrc(o)});var h=function(){o.attr("src",a)};"skipped"===t.data("jg.loaded")&&a?this.onImageEvent(a,function(){this.showImg(t,h),t.data("jg.loaded",!0)}.bind(this)):this.showImg(t,h)}}else this.showImg(t);this.displayEntryCaption(t)},r.prototype.displayEntryCaption=function(t){var i=this.imgFromEntry(t);if(null!==i&&this.settings.captions){var e=this.captionFromEntry(t);if(null===e){var s=i.attr("alt");this.isValidCaption(s)||(s=t.attr("title")),this.isValidCaption(s)&&(e=l('<div class="jg-caption">'+s+"</div>"),t.append(e),t.data("jg.createdCaption",!0))}null!==e&&(this.settings.cssAnimation||e.stop().fadeTo(0,this.settings.captionSettings.nonVisibleOpacity),this.addCaptionEventsHandlers(t))}else this.removeCaptionEventsHandlers(t)},r.prototype.isValidCaption=function(t){return void 0!==t&&0<t.length},r.prototype.onEntryMouseEnterForCaption=function(t){var i=this.captionFromEntry(l(t.currentTarget));this.settings.cssAnimation?i.addClass("jg-caption-visible").removeClass("jg-caption-hidden"):i.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.visibleOpacity)},r.prototype.onEntryMouseLeaveForCaption=function(t){var i=this.captionFromEntry(l(t.currentTarget));this.settings.cssAnimation?i.removeClass("jg-caption-visible").removeClass("jg-caption-hidden"):i.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.nonVisibleOpacity)},r.prototype.addCaptionEventsHandlers=function(t){var i=t.data("jg.captionMouseEvents");void 0===i&&(i={mouseenter:l.proxy(this.onEntryMouseEnterForCaption,this),mouseleave:l.proxy(this.onEntryMouseLeaveForCaption,this)},t.on("mouseenter",void 0,void 0,i.mouseenter),t.on("mouseleave",void 0,void 0,i.mouseleave),t.data("jg.captionMouseEvents",i))},r.prototype.removeCaptionEventsHandlers=function(t){var i=t.data("jg.captionMouseEvents");void 0!==i&&(t.off("mouseenter",void 0,i.mouseenter),t.off("mouseleave",void 0,i.mouseleave),t.removeData("jg.captionMouseEvents"))},r.prototype.clearBuildingRow=function(){this.buildingRow.entriesBuff=[],this.buildingRow.aspectRatio=0,this.buildingRow.width=0},r.prototype.prepareBuildingRow=function(t,i){var e,s,n,r,o,a=!0,h=0,g=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,l=g/this.buildingRow.aspectRatio,u=this.settings.rowHeight,d=this.buildingRow.width/g>this.settings.justifyThreshold;if(i||t&&"hide"===this.settings.lastRow&&!d){for(e=0;e<this.buildingRow.entriesBuff.length;e++)s=this.buildingRow.entriesBuff[e],this.settings.cssAnimation?s.removeClass("jg-entry-visible"):(s.stop().fadeTo(0,.1),s.find("> img, > a > img").fadeTo(0,0));return-1}for(t&&!d&&"justify"!==this.settings.lastRow&&"hide"!==this.settings.lastRow&&(a=!1,0<this.rows&&(a=(u=(this.offY-this.border-this.settings.margins*this.rows)/this.rows)*this.buildingRow.aspectRatio/g>this.settings.justifyThreshold)),e=0;e<this.buildingRow.entriesBuff.length;e++)n=(s=this.buildingRow.entriesBuff[e]).data("jg.width")/s.data("jg.height"),o=a?(r=e===this.buildingRow.entriesBuff.length-1?g:l*n,l):(r=u*n,u),g-=Math.round(r),s.data("jg.jwidth",Math.round(r)),s.data("jg.jheight",Math.ceil(o)),(0===e||o<h)&&(h=o);return this.buildingRow.height=h,a},r.prototype.flushRow=function(t,i){var e,s,n,r=this.settings,o=this.border;if(s=this.prepareBuildingRow(t,i),i||t&&"hide"===r.lastRow&&-1===s)this.clearBuildingRow();else{if(this.maxRowHeight&&this.maxRowHeight<this.buildingRow.height&&(this.buildingRow.height=this.maxRowHeight),t&&("center"===r.lastRow||"right"===r.lastRow)){var a=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*r.margins;for(n=0;n<this.buildingRow.entriesBuff.length;n++)a-=(e=this.buildingRow.entriesBuff[n]).data("jg.jwidth");"center"===r.lastRow?o+=Math.round(a/2):"right"===r.lastRow&&(o+=a)}var h=this.buildingRow.entriesBuff.length-1;for(n=0;n<=h;n++)e=this.buildingRow.entriesBuff[this.settings.rtl?h-n:n],this.displayEntry(e,o,this.offY,e.data("jg.jwidth"),e.data("jg.jheight"),this.buildingRow.height),o+=e.data("jg.jwidth")+r.margins;this.galleryHeightToSet=this.offY+this.buildingRow.height+this.border,this.setGalleryTempHeight(this.galleryHeightToSet+this.getSpinnerHeight()),(!t||this.buildingRow.height<=r.rowHeight&&s)&&(this.offY+=this.buildingRow.height+r.margins,this.rows+=1,this.clearBuildingRow(),this.settings.triggerEvent.call(this,"jg.rowflush"))}};var i=0;r.prototype.rememberGalleryHeight=function(){i=this.$gallery.height(),this.$gallery.height(i)},r.prototype.setGalleryTempHeight=function(t){i=Math.max(t,i),this.$gallery.height(i)},r.prototype.setGalleryFinalHeight=function(t){i=t,this.$gallery.height(t)},r.prototype.checkWidth=function(){this.checkWidthIntervalId=setInterval(l.proxy(function(){if(this.$gallery.is(":visible")){var t=parseFloat(this.$gallery.width());Math.abs(t-this.galleryWidth)>this.settings.refreshSensitivity&&(this.galleryWidth=t,this.rewind(),this.rememberGalleryHeight(),this.startImgAnalyzer(!0))}},this),this.settings.refreshTime)},r.prototype.isSpinnerActive=function(){return null!==this.spinner.intervalId},r.prototype.getSpinnerHeight=function(){return this.spinner.$el.innerHeight()},r.prototype.stopLoadingSpinnerAnimation=function(){clearInterval(this.spinner.intervalId),this.spinner.intervalId=null,this.setGalleryTempHeight(this.$gallery.height()-this.getSpinnerHeight()),this.spinner.$el.detach()},r.prototype.startLoadingSpinnerAnimation=function(){var t=this.spinner,i=t.$el.find("span");clearInterval(t.intervalId),this.$gallery.append(t.$el),this.setGalleryTempHeight(this.offY+this.buildingRow.height+this.getSpinnerHeight()),t.intervalId=setInterval(function(){t.phase<i.length?i.eq(t.phase).fadeTo(t.timeSlot,1):i.eq(t.phase-i.length).fadeTo(t.timeSlot,0),t.phase=(t.phase+1)%(2*i.length)},t.timeSlot)},r.prototype.rewind=function(){this.lastFetchedEntry=null,this.lastAnalyzedIndex=-1,this.offY=this.border,this.rows=0,this.clearBuildingRow()},r.prototype.getSelectorWithoutSpinner=function(){return this.settings.selector+", div:not(.jg-spinner)"},r.prototype.getAllEntries=function(){var t=this.getSelectorWithoutSpinner();return this.$gallery.children(t).toArray()},r.prototype.updateEntries=function(t){var i;if(t&&null!=this.lastFetchedEntry){var e=this.getSelectorWithoutSpinner();i=l(this.lastFetchedEntry).nextAll(e).toArray()}else this.entries=[],i=this.getAllEntries();return 0<i.length&&(l.isFunction(this.settings.sort)?i=this.sortArray(i):this.settings.randomize&&(i=this.shuffleArray(i)),this.lastFetchedEntry=i[i.length-1],this.settings.filter?i=this.filterArray(i):this.resetFilters(i)),this.entries=this.entries.concat(i),!0},r.prototype.insertToGallery=function(t){var i=this;l.each(t,function(){l(this).appendTo(i.$gallery)})},r.prototype.shuffleArray=function(t){var i,e,s;for(i=t.length-1;0<i;i--)e=Math.floor(Math.random()*(i+1)),s=t[i],t[i]=t[e],t[e]=s;return this.insertToGallery(t),t},r.prototype.sortArray=function(t){return t.sort(this.settings.sort),this.insertToGallery(t),t},r.prototype.resetFilters=function(t){for(var i=0;i<t.length;i++)l(t[i]).removeClass("jg-filtered")},r.prototype.filterArray=function(t){var e=this.settings;if("string"===l.type(e.filter))return t.filter(function(t){var i=l(t);return i.is(e.filter)?(i.removeClass("jg-filtered"),!0):(i.addClass("jg-filtered").removeClass("jg-visible"),!1)});if(l.isFunction(e.filter)){for(var i=t.filter(e.filter),s=0;s<t.length;s++)-1===i.indexOf(t[s])?l(t[s]).addClass("jg-filtered").removeClass("jg-visible"):l(t[s]).removeClass("jg-filtered");return i}},r.prototype.resetImgSrc=function(t){"src"===t.data("jg.originalSrcLoc")?t.attr("src",t.data("jg.originalSrc")):t.attr("src","")},r.prototype.destroy=function(){clearInterval(this.checkWidthIntervalId),this.stopImgAnalyzerStarter(),l.each(this.getAllEntries(),l.proxy(function(t,i){var e=l(i);e.css("width",""),e.css("height",""),e.css("top",""),e.css("left",""),e.data("jg.loaded",void 0),e.removeClass("jg-entry jg-filtered jg-entry-visible");var s=this.imgFromEntry(e);s&&(s.css("width",""),s.css("height",""),s.css("margin-left",""),s.css("margin-top",""),this.resetImgSrc(s),s.data("jg.originalSrc",void 0),s.data("jg.originalSrcLoc",void 0),s.data("jg.src",void 0)),this.removeCaptionEventsHandlers(e);var n=this.captionFromEntry(e);e.data("jg.createdCaption")?(e.data("jg.createdCaption",void 0),null!==n&&n.remove()):null!==n&&n.fadeTo(0,1)},this)),this.$gallery.css("height",""),this.$gallery.removeClass("justified-gallery"),this.$gallery.data("jg.controller",void 0),this.settings.triggerEvent.call(this,"jg.destroy")},r.prototype.analyzeImages=function(t){for(var i=this.lastAnalyzedIndex+1;i<this.entries.length;i++){var e=l(this.entries[i]);if(!0===e.data("jg.loaded")||"skipped"===e.data("jg.loaded")){var s=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,n=e.data("jg.width")/e.data("jg.height");if(this.buildingRow.entriesBuff.push(e),this.buildingRow.aspectRatio+=n,this.buildingRow.width+=n*this.settings.rowHeight,this.lastAnalyzedIndex=i,s/(this.buildingRow.aspectRatio+n)<this.settings.rowHeight&&(this.flushRow(!1,0<this.settings.maxRowsCount&&this.rows===this.settings.maxRowsCount),++this.yield.flushed>=this.yield.every))return void this.startImgAnalyzer(t)}else if("error"!==e.data("jg.loaded"))return}0<this.buildingRow.entriesBuff.length&&this.flushRow(!0,0<this.settings.maxRowsCount&&this.rows===this.settings.maxRowsCount),this.isSpinnerActive()&&this.stopLoadingSpinnerAnimation(),this.stopImgAnalyzerStarter(),this.setGalleryFinalHeight(this.galleryHeightToSet),this.settings.triggerEvent.call(this,t?"jg.resize":"jg.complete")},r.prototype.stopImgAnalyzerStarter=function(){this.yield.flushed=0,null!==this.imgAnalyzerTimeout&&(clearTimeout(this.imgAnalyzerTimeout),this.imgAnalyzerTimeout=null)},r.prototype.startImgAnalyzer=function(t){var i=this;this.stopImgAnalyzerStarter(),this.imgAnalyzerTimeout=setTimeout(function(){i.analyzeImages(t)},.001)},r.prototype.onImageEvent=function(t,i,e){if(i||e){var s=new Image,n=l(s);i&&n.one("load",function(){n.off("load error"),i(s)}),e&&n.one("error",function(){n.off("load error"),e(s)}),s.src=t}},r.prototype.init=function(){var a=!1,h=!1,g=this;l.each(this.entries,function(t,i){var e=l(i),s=g.imgFromEntry(e);if(e.addClass("jg-entry"),!0!==e.data("jg.loaded")&&"skipped"!==e.data("jg.loaded"))if(null!==g.settings.rel&&e.attr("rel",g.settings.rel),null!==g.settings.target&&e.attr("target",g.settings.target),null!==s){var n=g.extractImgSrcFromImage(s);if(!1===g.settings.waitThumbnailsLoad||!n){var r=parseFloat(s.attr("width")),o=parseFloat(s.attr("height"));if("svg"===s.prop("tagName")&&(r=parseFloat(s[0].getBBox().width),o=parseFloat(s[0].getBBox().height)),!isNaN(r)&&!isNaN(o))return e.data("jg.width",r),e.data("jg.height",o),e.data("jg.loaded","skipped"),h=!0,g.startImgAnalyzer(!1),!0}e.data("jg.loaded",!1),a=!0,g.isSpinnerActive()||g.startLoadingSpinnerAnimation(),g.onImageEvent(n,function(t){e.data("jg.width",t.width),e.data("jg.height",t.height),e.data("jg.loaded",!0),g.startImgAnalyzer(!1)},function(){e.data("jg.loaded","error"),g.startImgAnalyzer(!1)})}else e.data("jg.loaded",!0),e.data("jg.width",e.width()|parseFloat(e.css("width"))|1),e.data("jg.height",e.height()|parseFloat(e.css("height"))|1)}),a||h||this.startImgAnalyzer(!1),this.checkWidth()},r.prototype.checkOrConvertNumber=function(t,i){if("string"===l.type(t[i])&&(t[i]=parseFloat(t[i])),"number"!==l.type(t[i]))throw i+" must be a number";if(isNaN(t[i]))throw"invalid number for "+i},r.prototype.checkSizeRangesSuffixes=function(){if("object"!==l.type(this.settings.sizeRangeSuffixes))throw"sizeRangeSuffixes must be defined and must be an object";var t=[];for(var i in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(i)&&t.push(i);for(var e={0:""},s=0;s<t.length;s++)if("string"===l.type(t[s]))try{e[parseInt(t[s].replace(/^[a-z]+/,""),10)]=this.settings.sizeRangeSuffixes[t[s]]}catch(t){throw"sizeRangeSuffixes keys must contains correct numbers ("+t+")"}else e[t[s]]=this.settings.sizeRangeSuffixes[t[s]];this.settings.sizeRangeSuffixes=e},r.prototype.retrieveMaxRowHeight=function(){var t=null,i=this.settings.rowHeight;if("string"===l.type(this.settings.maxRowHeight))t=this.settings.maxRowHeight.match(/^[0-9]+%$/)?i*parseFloat(this.settings.maxRowHeight.match(/^([0-9]+)%$/)[1])/100:parseFloat(this.settings.maxRowHeight);else{if("number"!==l.type(this.settings.maxRowHeight)){if(!1===this.settings.maxRowHeight||null==this.settings.maxRowHeight)return null;throw"maxRowHeight must be a number or a percentage"}t=this.settings.maxRowHeight}if(isNaN(t))throw"invalid number for maxRowHeight";return t<i&&(t=i),t},r.prototype.checkSettings=function(){this.checkSizeRangesSuffixes(),this.checkOrConvertNumber(this.settings,"rowHeight"),this.checkOrConvertNumber(this.settings,"margins"),this.checkOrConvertNumber(this.settings,"border"),this.checkOrConvertNumber(this.settings,"maxRowsCount");var t=["justify","nojustify","left","center","right","hide"];if(-1===t.indexOf(this.settings.lastRow))throw"lastRow must be one of: "+t.join(", ");if(this.checkOrConvertNumber(this.settings,"justifyThreshold"),this.settings.justifyThreshold<0||1<this.settings.justifyThreshold)throw"justifyThreshold must be in the interval [0,1]";if("boolean"!==l.type(this.settings.cssAnimation))throw"cssAnimation must be a boolean";if("boolean"!==l.type(this.settings.captions))throw"captions must be a boolean";if(this.checkOrConvertNumber(this.settings.captionSettings,"animationDuration"),this.checkOrConvertNumber(this.settings.captionSettings,"visibleOpacity"),this.settings.captionSettings.visibleOpacity<0||1<this.settings.captionSettings.visibleOpacity)throw"captionSettings.visibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings.captionSettings,"nonVisibleOpacity"),this.settings.captionSettings.nonVisibleOpacity<0||1<this.settings.captionSettings.nonVisibleOpacity)throw"captionSettings.nonVisibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings,"imagesAnimationDuration"),this.checkOrConvertNumber(this.settings,"refreshTime"),this.checkOrConvertNumber(this.settings,"refreshSensitivity"),"boolean"!==l.type(this.settings.randomize))throw"randomize must be a boolean";if("string"!==l.type(this.settings.selector))throw"selector must be a string";if(!1!==this.settings.sort&&!l.isFunction(this.settings.sort))throw"sort must be false or a comparison function";if(!1!==this.settings.filter&&!l.isFunction(this.settings.filter)&&"string"!==l.type(this.settings.filter))throw"filter must be false, a string or a filter function"},r.prototype.retrieveSuffixRanges=function(){var t=[];for(var i in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(i)&&t.push(parseInt(i,10));return t.sort(function(t,i){return i<t?1:t<i?-1:0}),t},r.prototype.updateSettings=function(t){this.settings=l.extend({},this.settings,t),this.checkSettings(),this.border=0<=this.settings.border?this.settings.border:this.settings.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges()},r.prototype.defaults={sizeRangeSuffixes:{},thumbnailPath:void 0,rowHeight:120,maxRowHeight:!1,maxRowsCount:0,margins:1,border:-1,lastRow:"nojustify",justifyThreshold:.9,waitThumbnailsLoad:!0,captions:!0,cssAnimation:!0,imagesAnimationDuration:500,captionSettings:{animationDuration:500,visibleOpacity:.7,nonVisibleOpacity:0},rel:null,target:null,extension:/\.[^.\\/]+$/,refreshTime:200,refreshSensitivity:0,randomize:!1,rtl:!1,sort:!1,filter:!1,selector:"a",imgSelector:"> img, > a > img, > svg, > a > svg",triggerEvent:function(t){this.$gallery.trigger(t)}},l.fn.justifiedGallery=function(n){return this.each(function(t,i){var e=l(i);e.addClass("justified-gallery");var s=e.data("jg.controller");if(void 0===s){if(null!=n&&"object"!==l.type(n)){if("destroy"===n)return;throw"The argument must be an object"}s=new r(e,l.extend({},r.prototype.defaults,n)),e.data("jg.controller",s)}else if("norewind"===n);else{if("destroy"===n)return void s.destroy();s.updateSettings(n),s.rewind()}s.updateEntries("norewind"===n)&&s.init()})}});
@@ -15,6 +15,9 @@
15
15
  # Bootstrap Theme Switcher is licensed under the MIT License.
16
16
  # See: https://github.com/jguadagno/bootstrapThemeSwitcher
17
17
  # -----------------------------------------------------------------------------
18
+ # NOTE: This modules is MODIFIED to be used with MobileMenu (mmenuLight).
19
+ # The original version cannot be used with J1 for theme menu creation!
20
+ # -----------------------------------------------------------------------------
18
21
  */
19
22
  'use strict';
20
23
 
@@ -281,14 +284,16 @@
281
284
  var iconColor = '#9E9E9E';
282
285
  $.each(this.themesList, function (i, value) {
283
286
  // Use DIFFERENT class for MobileMenu
284
- if (base.$element[0].id.includes('MMenu')) {
287
+ //if (base.$element[0].id.includes('MMenu')) {
288
+ if (base.$element[0].id.includes('mmenu')) {
285
289
  cssClass = 'mmenu-item';
286
290
  } else {
287
291
  cssClass = 'dropdown-item';
288
292
  }
289
293
  // Add class "active" to the current theme selected
290
294
  if ( value.name === themeName ) {
291
- if (base.$element[0].id.includes('MMenu')) {
295
+ // if (base.$element[0].id.includes('MMenu')) {
296
+ if (base.$element[0].id.includes('mmenu')) {
292
297
  cssClass = 'mmenu-item active';
293
298
  } else {
294
299
  cssClass = 'dropdown-item active';
@@ -423,11 +428,11 @@
423
428
  cssThemeLink: 'bootstrapTheme',
424
429
  cookieThemeName: 'bootstrapTheme.name',
425
430
  cookieThemeCss: 'boostrapTheme.css',
426
- cookieExpiration: 7,
431
+ cookieExpiration: 365,
427
432
  cookiePath: '/',
428
433
  defaultCssFile: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css',
429
434
  bootswatchApiUrl: 'https://bootswatch.com/api/',
430
- bootswatchApiVersion: '3',
435
+ bootswatchApiVersion: '4',
431
436
  loadFromBootswatch: true,
432
437
  localFeed: '',
433
438
  excludeBootswatch: ''
@@ -23,4 +23,4 @@
23
23
  * Copyright 2014, Joseph Guadagno
24
24
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
25
25
  */
26
- (function(h,i,j,e){var d=h.fn.bootstrapThemeSwitcher;var f=j1.getCookieNames();const n=f.user_state;var m=log4javascript.getLogger("j1.core.switcher");var a;var g;var b={};var k;var c;var l=function(p,o){this.$element=h(p);this.settings=h.extend({},h.fn.bootstrapThemeSwitcher.defaults,o);this.themesList=[];this.getThemes();return this};l.prototype={clear:function(){m.debug("bootstrapThemeSwitcher.clear");return this.$element.each(function(){this.$element.empty()})},update:function(){m.debug("bootstrapThemeSwitcher.update");this.getThemes()},checkStyleSheetByName:function(o){var r=false;var s="/"+o+"/";var q=new RegExp(s,"i");for(var p=0;p<j.styleSheets.length;p++){if(q.test(j.styleSheets[p].href)){r=true;break}}return r},switchTheme:function(p,u){var v=h(this);var r=h.extend({},h.fn.bootstrapThemeSwitcher.defaults,v.data("bootstrapThemeSwitcher"));var t;var x;var w;var q=r.cssThemeLink;var o=r.debug;var s=this.settings.includeBootswatch;g=j1.existsCookie("j1.user.state");if(g){m.debug("user state cookie found");b=j1.readCookie(n)}else{m.error("user state NOT cookie found")}t=b.theme_name;x=b.theme_css;w=b.theme_extension_css;if(u===e){u=this.settings.defaultCssFile}if(p===e){p=u}if(p===this.settings.skipIncludeBootswatch){s=""}if(r.saveToCookie){if(Cookies===e){if(o==="true"){m.error("saveToCookie is set to true but Cookies library is not present")}return false}b.theme_name=p;b.theme_css=u;if(!(b.theme_name.includes("Uno")||b.theme_name=="Bootstrap")){b.theme_author="Bootswatch";b.theme_author_url="https://bootswatch.com/"}else{b.theme_author="J1 Team";b.theme_author_url="https://jekyll.one/"}j1.writeCookie({name:n,data:b});location.reload(true)}else{m.warn("write to cookie : disabled");m.warn("selected theme not activated: "+p)}},loadThemeFromCookie:function(o){if(Cookies===e){m.error("loadThemeFromCookie was called but Cookies library is not present");return false}var p=h.extend({},h.fn.bootstrapThemeSwitcher.defaults,o);g=j1.existsCookie("j1.user.state");if(g){m.info("User state cookie found");b=j1.readCookie(n)}else{m.error("User state NOT cookie found")}var r=b.theme_name;var q=b.theme_css;this.switchTheme(r,q)},addTheme:function(p,o,r,q){if(r===e){r=0}if(q===e){q=0}this.themesList.splice(r,q,{name:p,css:o});this.addThemesToControl()},addThemesToControl:function(){if(this.$element===e){m.error("bootstrapThemeSelector|addThemesToControl: Element is undefined");return false}if(this.themesList===e){m.error("bootstrapThemeSelector|addThemesToControl: Themes is undefined");return false}if(this.settings.excludeBootswatch){var v;if(this.settings.excludeBootswatch.indexOf(",")!==-1){v=this.settings.excludeBootswatch.replace(/ /g,"").split(",")}else{v=[];v.push(this.settings.excludeBootswatch)}var r=this.themesList;h.each(r,function(z,A){if(A&&A.name){if(h.inArray(A.name,v)!==-1){r.splice(z,1)}}});this.themesList=r}var q=this;if(this.$element.is("ul")){var w=h(this);var s=h.extend({},h.fn.bootstrapThemeSwitcher.defaults,w.data("bootstrapThemeSwitcher"));var p=s.cssThemeLink;var t;var o=s.debug;g=j1.existsCookie("j1.user.state");if(g){m.debug("User state cookie found");b=j1.readCookie(n)}else{m.error("User state NOT cookie found")}t=b.theme_name;if(o==="true"){m.debug("bootstrapThemeSelector: UL element selected")}this.$element.empty();var y;var x="#9E9E9E";h.each(this.themesList,function(A,B){if(q.$element[0].id.includes("MMenu")){y="mmenu-item"}else{y="dropdown-item"}if(B.name===t){if(q.$element[0].id.includes("MMenu")){y="mmenu-item active"}else{y="dropdown-item active"}}var z=h("<li />").attr("class",y).append('<a href="#"><i class="mdi mdi-view-quilt mdi-18px mr-2" style="color: '+x+'"></i>'+B.name+"</a>").on("click",function(){if(s.loadFromBootswatch){q.switchTheme(B.name,B.css)}else{q.switchTheme(B.name,B.cssCdn)}h(this).parent().find("li").removeClass("active");h(this).addClass("active")});q.$element.append(z)})}else{if(this.$element.is("select")){m.debug("bootstrapThemeSelector: SELECT element selected");this.$element.empty();var u;h.each(this.themesList,function(z,A){u=null;if(A.name===t){u="selected"}if(s.loadFromBootswatch){q.$element.append("<option "+u+" value='"+A.css+"'>"+A.name+"</option>")}else{q.$element.append("<option "+u+" value='"+A.cssCdn+"'>"+A.name+"</option>")}});this.$element.on("change",function(){var z=h("option:selected",this);q.switchTheme(z.text(),z.val())})}else{m.info("bootstrapThemeSelector: no UL or SELECT element found");m.error("bootstrapThemeSelector: failed")}}},getThemes:function(){var o=this;if(this.settings.localFeed!==null&&this.settings.localFeed!==""){h.ajax({url:this.settings.localFeed,dataType:"json",success:function(p){o.themesList=p.themes;o.addThemesToControl()},error:function(p,r,q){m.error("Failed to retrieve the local feed from: '"+o.settings.localFeed+"'")}})}else{h.ajax({url:this.settings.bootswatchApiUrl+"/"+this.settings.bootswatchApiVersion+".json",dataType:"json",success:function(p){if(p.themes===e){return null}o.themesList=p.themes;o.themesList.splice(0,0,{name:"default",css:o.settings.defaultCssFile});o.addThemesToControl()}})}},themes:function(o){if(o===e){return this.themesList}else{this.themesList=o}}};h.fn.bootstrapThemeSwitcher=function(q){var s;var p=Array.prototype.slice.call(arguments,1);var t=h(this);var r=t.data("bootstrapThemeSwitcher");var o=typeof q==="object"&&q;if(!r){t.data("bootstrapThemeSwitcher",(r=new l(this,o)))}if(typeof q==="string"){s=r[q].apply(r,p)}return(s===e)?t:s};h.fn.bootstrapThemeSwitcher.defaults={debug:false,saveToCookie:true,cssThemeLink:"bootstrapTheme",cookieThemeName:"bootstrapTheme.name",cookieThemeCss:"boostrapTheme.css",cookieExpiration:7,cookiePath:"/",defaultCssFile:"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css",bootswatchApiUrl:"https://bootswatch.com/api/",bootswatchApiVersion:"3",loadFromBootswatch:true,localFeed:"",excludeBootswatch:""};h.fn.bootstrapThemeSwitcher.Constructor=l;h.fn.bootstrapThemeSwitcher.noConflict=function(){h.fn.BootstrapThemeSwitcher=d;return this}})(jQuery,window,document);
26
+ "use strict";(function(h,i,j,e){var d=h.fn.bootstrapThemeSwitcher;var f=j1.getCookieNames();const n=f.user_state;var m=log4javascript.getLogger("j1.core.switcher");var a;var g;var b={};var k;var c;var l=function(p,o){this.$element=h(p);this.settings=h.extend({},h.fn.bootstrapThemeSwitcher.defaults,o);this.themesList=[];this.getThemes();return this};l.prototype={clear:function(){m.debug("bootstrapThemeSwitcher.clear");return this.$element.each(function(){this.$element.empty()})},update:function(){m.debug("bootstrapThemeSwitcher.update");this.getThemes()},checkStyleSheetByName:function(o){var r=false;var s="/"+o+"/";var q=new RegExp(s,"i");for(var p=0;p<j.styleSheets.length;p++){if(q.test(j.styleSheets[p].href)){r=true;break}}return r},switchTheme:function(p,u){var v=h(this);var r=h.extend({},h.fn.bootstrapThemeSwitcher.defaults,v.data("bootstrapThemeSwitcher"));var t;var x;var w;var q=r.cssThemeLink;var o=r.debug;var s=this.settings.includeBootswatch;g=j1.existsCookie("j1.user.state");if(g){m.debug("user state cookie found");b=j1.readCookie(n)}else{m.error("user state NOT cookie found")}t=b.theme_name;x=b.theme_css;w=b.theme_extension_css;if(u===e){u=this.settings.defaultCssFile}if(p===e){p=u}if(p===this.settings.skipIncludeBootswatch){s=""}if(r.saveToCookie){if(Cookies===e){if(o==="true"){m.error("saveToCookie is set to true but Cookies library is not present")}return false}b.theme_name=p;b.theme_css=u;if(!(b.theme_name.includes("Uno")||b.theme_name=="Bootstrap")){b.theme_author="Bootswatch";b.theme_author_url="https://bootswatch.com/"}else{b.theme_author="J1 Team";b.theme_author_url="https://jekyll.one/"}j1.writeCookie({name:n,data:b});location.reload(true)}else{m.warn("write to cookie : disabled");m.warn("selected theme not activated: "+p)}},loadThemeFromCookie:function(o){if(Cookies===e){m.error("loadThemeFromCookie was called but Cookies library is not present");return false}var p=h.extend({},h.fn.bootstrapThemeSwitcher.defaults,o);g=j1.existsCookie("j1.user.state");if(g){m.info("User state cookie found");b=j1.readCookie(n)}else{m.error("User state NOT cookie found")}var r=b.theme_name;var q=b.theme_css;this.switchTheme(r,q)},addTheme:function(p,o,r,q){if(r===e){r=0}if(q===e){q=0}this.themesList.splice(r,q,{name:p,css:o});this.addThemesToControl()},addThemesToControl:function(){if(this.$element===e){m.error("bootstrapThemeSelector|addThemesToControl: Element is undefined");return false}if(this.themesList===e){m.error("bootstrapThemeSelector|addThemesToControl: Themes is undefined");return false}if(this.settings.excludeBootswatch){var v;if(this.settings.excludeBootswatch.indexOf(",")!==-1){v=this.settings.excludeBootswatch.replace(/ /g,"").split(",")}else{v=[];v.push(this.settings.excludeBootswatch)}var r=this.themesList;h.each(r,function(z,A){if(A&&A.name){if(h.inArray(A.name,v)!==-1){r.splice(z,1)}}});this.themesList=r}var q=this;if(this.$element.is("ul")){var w=h(this);var s=h.extend({},h.fn.bootstrapThemeSwitcher.defaults,w.data("bootstrapThemeSwitcher"));var p=s.cssThemeLink;var t;var o=s.debug;g=j1.existsCookie("j1.user.state");if(g){m.debug("User state cookie found");b=j1.readCookie(n)}else{m.error("User state NOT cookie found")}t=b.theme_name;if(o==="true"){m.debug("bootstrapThemeSelector: UL element selected")}this.$element.empty();var y;var x="#9E9E9E";h.each(this.themesList,function(A,B){if(q.$element[0].id.includes("mmenu")){y="mmenu-item"}else{y="dropdown-item"}if(B.name===t){if(q.$element[0].id.includes("mmenu")){y="mmenu-item active"}else{y="dropdown-item active"}}var z=h("<li />").attr("class",y).append('<a href="#"><i class="mdi mdi-view-quilt mdi-18px mr-2" style="color: '+x+'"></i>'+B.name+"</a>").on("click",function(){if(s.loadFromBootswatch){q.switchTheme(B.name,B.css)}else{q.switchTheme(B.name,B.cssCdn)}h(this).parent().find("li").removeClass("active");h(this).addClass("active")});q.$element.append(z)})}else{if(this.$element.is("select")){m.debug("bootstrapThemeSelector: SELECT element selected");this.$element.empty();var u;h.each(this.themesList,function(z,A){u=null;if(A.name===t){u="selected"}if(s.loadFromBootswatch){q.$element.append("<option "+u+" value='"+A.css+"'>"+A.name+"</option>")}else{q.$element.append("<option "+u+" value='"+A.cssCdn+"'>"+A.name+"</option>")}});this.$element.on("change",function(){var z=h("option:selected",this);q.switchTheme(z.text(),z.val())})}else{m.info("bootstrapThemeSelector: no UL or SELECT element found");m.error("bootstrapThemeSelector: failed")}}},getThemes:function(){var o=this;if(this.settings.localFeed!==null&&this.settings.localFeed!==""){h.ajax({url:this.settings.localFeed,dataType:"json",success:function(p){o.themesList=p.themes;o.addThemesToControl()},error:function(p,r,q){m.error("Failed to retrieve the local feed from: '"+o.settings.localFeed+"'")}})}else{h.ajax({url:this.settings.bootswatchApiUrl+"/"+this.settings.bootswatchApiVersion+".json",dataType:"json",success:function(p){if(p.themes===e){return null}o.themesList=p.themes;o.themesList.splice(0,0,{name:"default",css:o.settings.defaultCssFile});o.addThemesToControl()}})}},themes:function(o){if(o===e){return this.themesList}else{this.themesList=o}}};h.fn.bootstrapThemeSwitcher=function(q){var s;var p=Array.prototype.slice.call(arguments,1);var t=h(this);var r=t.data("bootstrapThemeSwitcher");var o=typeof q==="object"&&q;if(!r){t.data("bootstrapThemeSwitcher",(r=new l(this,o)))}if(typeof q==="string"){s=r[q].apply(r,p)}return(s===e)?t:s};h.fn.bootstrapThemeSwitcher.defaults={debug:false,saveToCookie:true,cssThemeLink:"bootstrapTheme",cookieThemeName:"bootstrapTheme.name",cookieThemeCss:"boostrapTheme.css",cookieExpiration:365,cookiePath:"/",defaultCssFile:"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css",bootswatchApiUrl:"https://bootswatch.com/api/",bootswatchApiVersion:"4",loadFromBootswatch:true,localFeed:"",excludeBootswatch:""};h.fn.bootstrapThemeSwitcher.Constructor=l;h.fn.bootstrapThemeSwitcher.noConflict=function(){h.fn.BootstrapThemeSwitcher=d;return this}})(jQuery,window,document);
@@ -57,7 +57,7 @@ module J1
57
57
  # Internal: Gets the filename of the sample post to be created
58
58
  # Returns the filename of the sample post, as a String
59
59
  def initialized_post_name
60
- "collections/posts/public/featured/_posts/#{Time.now.strftime("%Y-%m-%d")}-welcome-to-j1-template.adoc"
60
+ "collections/posts/public/featured/_posts/#{Time.now.strftime("%Y-%m-%d")}-welcome-to-j1.adoc"
61
61
  end
62
62
 
63
63
  private
@@ -84,7 +84,7 @@ module J1
84
84
  end
85
85
 
86
86
  def scaffold_path
87
- 'collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1-template.adoc.erb'
87
+ 'collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb'
88
88
  end
89
89
 
90
90
  # After a generate blog has been created, print a success notification and