Gallery – Photo Gallery – Image Gallery - Version 2.1.5

Version Description

Download this release

Release Info

Developer machothemes
Plugin Icon wp plugin Gallery – Photo Gallery – Image Gallery
Version 2.1.5
Comparing to
See all releases

Code changes from version 2.1.4 to 2.1.5

Modula.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://wp-modula.com/
5
  * Description: Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks.
6
  * Author: MachoThemes
7
- * Version: 2.1.4
8
  * Author URI: https://www.machothemes.com/
9
  * License: GPLv3 or later
10
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -43,7 +43,7 @@
43
  *
44
  * @since 2.0.2
45
  */
46
- define( 'MODULA_LITE_VERSION', '2.1.4' );
47
  define( 'MODULA_PATH', plugin_dir_path( __FILE__ ) );
48
  define( 'MODULA_URL', plugin_dir_url( __FILE__ ) );
49
  defined( 'MODULA_PRO_STORE_URL' ) || define( 'MODULA_PRO_STORE_URL', 'https://wp-modula.com' );
4
  * Plugin URI: https://wp-modula.com/
5
  * Description: Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks.
6
  * Author: MachoThemes
7
+ * Version: 2.1.5
8
  * Author URI: https://www.machothemes.com/
9
  * License: GPLv3 or later
10
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
43
  *
44
  * @since 2.0.2
45
  */
46
+ define( 'MODULA_LITE_VERSION', '2.1.5' );
47
  define( 'MODULA_PATH', plugin_dir_path( __FILE__ ) );
48
  define( 'MODULA_URL', plugin_dir_url( __FILE__ ) );
49
  defined( 'MODULA_PRO_STORE_URL' ) || define( 'MODULA_PRO_STORE_URL', 'https://wp-modula.com' );
README.txt CHANGED
@@ -4,7 +4,7 @@ Tags: best gallery plugin, image gallery, photo gallery, responsive gallery, wor
4
  Requires at least: 4.6
5
  Tested up to: 5.2
6
  Requires PHP: 5.6
7
- Stable tag: 2.1.4
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
4
  Requires at least: 4.6
5
  Tested up to: 5.2
6
  Requires PHP: 5.6
7
+ Stable tag: 2.1.5
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
assets/js/jquery-modula.js CHANGED
@@ -708,7 +708,7 @@ jQuery(document).on( 'vc-full-width-row-single vc-full-width-row', function( eve
708
 
709
  if ( 'modula' == element.data( 'source' ) ) {
710
  element.data('size', { width: element.width(), height: element.height() });
711
- parent = element.parents( '.item' );
712
  parent.addClass( 'tg-loaded' );
713
  index = instance.$items.index( parent );
714
  instance.placeImage(index);
708
 
709
  if ( 'modula' == element.data( 'source' ) ) {
710
  element.data('size', { width: element.width(), height: element.height() });
711
+ parent = element.parents( '.modula-item' );
712
  parent.addClass( 'tg-loaded' );
713
  index = instance.$items.index( parent );
714
  instance.placeImage(index);
assets/js/jquery-modula.min.js CHANGED
@@ -1 +1 @@
1
- function tg_getURLParameter(t){return decodeURIComponent((new RegExp("[?|&]"+t+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||null}!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.ResizeSensor=e()}("undefined"!=typeof window?window:this,function(){if("undefined"==typeof window)return null;var v=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return window.setTimeout(t,20)};function n(t,e){var i=Object.prototype.toString.call(t),n="[object Array]"===i||"[object NodeList]"===i||"[object HTMLCollection]"===i||"[object Object]"===i||"undefined"!=typeof jQuery&&t instanceof jQuery||"undefined"!=typeof Elements&&t instanceof Elements,o=0,s=t.length;if(n)for(;o<s;o++)e(t[o]);else e(t)}function y(t){if(!t.getBoundingClientRect)return{width:t.offsetWidth,height:t.offsetHeight};var e=t.getBoundingClientRect();return{width:Math.round(e.width),height:Math.round(e.height)}}var o=function(e,i){function w(){var i,n,o=[];this.add=function(t){o.push(t)},this.call=function(){for(i=0,n=o.length;i<n;i++)o[i].call()},this.remove=function(t){var e=[];for(i=0,n=o.length;i<n;i++)o[i]!==t&&e.push(o[i]);o=e},this.length=function(){return o.length}}n(e,function(t){!function(n,t){if(n)if(n.resizedAttached)n.resizedAttached.add(t);else{n.resizedAttached=new w,n.resizedAttached.add(t),n.resizeSensor=document.createElement("div"),n.resizeSensor.dir="ltr",n.resizeSensor.className="resize-sensor";var e="position: absolute; left: -10px; top: -10px; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;",i="position: absolute; left: 0; top: 0; transition: 0s;";n.resizeSensor.style.cssText=e,n.resizeSensor.innerHTML='<div class="resize-sensor-expand" style="'+e+'"><div style="'+i+'"></div></div><div class="resize-sensor-shrink" style="'+e+'"><div style="'+i+' width: 200%; height: 200%"></div></div>',n.appendChild(n.resizeSensor);var o=window.getComputedStyle(n).getPropertyPriority("position");"absolute"!==o&&"relative"!==o&&"fixed"!==o&&(n.style.position="relative");var s,h,r=n.resizeSensor.childNodes[0],a=r.childNodes[0],d=n.resizeSensor.childNodes[1],l=y(n),c=l.width,u=l.height,p=function(){var t=0===n.offsetWidth&&0===n.offsetHeight;if(t){var e=n.style.display;n.style.display="block"}a.style.width="100000px",a.style.height="100000px",r.scrollLeft=1e5,r.scrollTop=1e5,d.scrollLeft=1e5,d.scrollTop=1e5,t&&(n.style.display=e)};n.resizeSensor.resetSensor=p;var f=function(){h=0,s&&(u=c=void 0,n.resizedAttached&&n.resizedAttached.call())},g=function(){var t=y(n),e=t.width,i=t.height;(s=e!=c||i!=u)&&!h&&(h=v(f)),p()},m=function(t,e,i){t.attachEvent?t.attachEvent("on"+e,i):t.addEventListener(e,i)};m(r,"scroll",g),m(d,"scroll",g),v(p)}}(t,i)}),this.detach=function(t){o.detach(e,t)},this.reset=function(){e.resizeSensor.resetSensor()}};return o.reset=function(t,e){n(t,function(t){t.resizeSensor.resetSensor()})},o.detach=function(t,e){n(t,function(t){t&&(t.resizedAttached&&"function"==typeof e&&(t.resizedAttached.remove(e),t.resizedAttached.length())||t.resizeSensor&&(t.contains(t.resizeSensor)&&t.removeChild(t.resizeSensor),delete t.resizeSensor,delete t.resizedAttached))})},o}),jQuery(document).on("vc-full-width-row-single vc-full-width-row",function(t,e){0<jQuery("body").find(".modula").length&&jQuery(window).trigger("modula-update")}),function(l,h,c,t){var o="modulaGallery",i={resizer:"/",margin:10,keepArea:!0,type:"creative-gallery",columns:12,gutter:10,enableTwitter:!1,enableFacebook:!1,enableGplus:!1,enablePinterest:!1,enableLinkedin:!1,lazyLoad:0};function s(t,e){this.element=t,this.$element=l(t),this.$itemsCnt=this.$element.find(".modula-items"),this.$items=this.$itemsCnt.find(".modula-item"),this.options=l.extend({},i,e),this._defaults=i,this._name=o,this.tiles=[],this.$tilesCnt=null,this.completed=!1,this.lastWidth=0,this.resizeTO=0,this.isPackeryActive=!1,this.init()}s.prototype.trunc=function(t){return Math.trunc?Math.trunc(t):(t=+t,isFinite(t)?t-t%1||(t<0?-0:0===t?t:0):t)},s.prototype.createCustomGallery=function(){var r,t=this.$element.width(),a=this,d=this.options.columns,e=c.documentElement.clientWidth;"1"==this.options.enableResponsive&&(e<=568?d=this.options.mobileColumns:e<=768&&(d=this.options.tabletColumns)),r=0<this.options.gutter?(t-this.options.gutter*(d-1))/d:Math.floor(t/d),this.$items.not(".jtg-hidden").each(function(t,e){var i,n,o,s,h={};i=l(e).data("width"),n=l(e).data("height"),12<i&&(i=12),"1"==a.options.enableResponsive&&(o=i,s=n,1==d?n=(i=1)*s/o:((i=Math.round(d*o/12))<1&&(i=1),(n=Math.round(i*s/o))<1&&(n=1))),h.width=r*i+a.options.gutter*(i-1),h.height=Math.round(r)*n+a.options.gutter*(n-1),l(e).data("size",h).addClass("tiled").addClass(h.width>h.height?"tile-h":"tile-v").data("position"),l(e).css(l(e).data("size")),l(e).find(".figc").css({width:l(e).data("size").width,height:l(e).data("size").height})}),this.isPackeryActive&&this.$itemsCnt.packery("destroy"),this.$itemsCnt.packery({itemSelector:".modula-item",gutter:parseInt(a.options.gutter),columnWidth:r,resize:!1}),this.isPackeryActive=!0},s.prototype.createGrid=function(){var n=this;this.options.width&&this.$itemsCnt.width(this.options.width),this.options.height&&this.$itemsCnt.height(this.options.height),this.$itemsCnt.data("area",this.$itemsCnt.width()*this.$itemsCnt.height()),this.lastWidth=this.$itemsCnt.width();for(var t=0;t<this.$items.not(".jtg-hidden").length;t++)this.tiles.push(n.getSlot());this.tiles.sort(function(t,e){return t.position-e.position}),this.$items.not(".jtg-hidden").each(function(t,e){var i=n.tiles[t];l(e).data("size",i).addClass("tiled").addClass(i.width>i.height?"tile-h":"tile-v").data("position")}),this.$items.each(function(t,e){l(e).css(l(e).data("size")),l(e).find(".figc").css({width:l(e).data("size").width,height:l(e).data("size").height})}),this.completed=!0},s.prototype.getSlot=function(){if(0==this.tiles.length)return i={top:0,left:0,width:this.$itemsCnt.width(),height:this.$itemsCnt.height(),area:this.$itemsCnt.width()*this.$itemsCnt.height(),position:0};for(var t=0,e=0;e<this.tiles.length;e++){(i=this.tiles[e]).area>this.tiles[t].area&&(t=e)}var i={},n=this.tiles[t];if(n.width>n.height){var o=n.width/2*this.options.randomFactor;n.prevWidth=n.width,n.width=Math.floor(n.width/2+o*(Math.random()-.5)),i={top:n.top,left:n.left+n.width+this.options.margin,width:n.prevWidth-n.width-this.options.margin,height:n.height}}else{o=n.height/2*this.options.randomFactor;n.prevHeight=n.height,n.height=Math.floor(n.height/2+o*(Math.random()-.5)),i={left:n.left,top:n.top+n.height+this.options.margin,width:n.width,height:n.prevHeight-n.height-this.options.margin}}return i.area=i.width*i.height,i.position=1e3*i.top+i.left,n.position=1e3*n.top+n.left,this.tiles[t]=n,this.tiles[t].area=n.width*n.height,i},s.prototype.reset=function(){var i=this;i.tiles=[],"custom-grid"===i.options.type?(i.createCustomGallery(),i.$itemsCnt.packery()):i.createGrid(),i.$itemsCnt.find(".pic").each(function(t,e){i.placeImage(t)}),i.lastWidth=i.$itemsCnt.width()},s.prototype.onResize=function(e){e.lastWidth!=e.$itemsCnt.width()&&(clearTimeout(e.resizeTO),e.resizeTO=setTimeout(function(){if(e.options.keepArea){var t=e.$itemsCnt.data("area");e.$itemsCnt.height(t/e.$itemsCnt.width())}e.reset()},100))},s.prototype.placeImage=function(t){var e=this.$items.eq(t),i=e.find(".pic"),n=e.data("size"),o=i.data("size");if(i.parent()!=e&&(n={width:i.parent().width(),height:i.parent().height()}),void 0!==n&&void 0!==o){var s=n.width/n.height,h=o.width/o.height,r=i.data("valign")?i.data("valign"):"middle",a=i.data("halign")?i.data("halign"):"center",d={top:"auto",bottom:"auto",left:"auto",right:"auto",width:"auto",height:"auto",margin:"0",maxWidth:"999em"};if(h<s)switch(d.width=n.width,d.left=0,r){case"top":d.top=0;break;case"middle":d.top=0-(n.width*(1/h)-n.height)/2;break;case"bottom":d.bottom=0}else switch(d.height=n.height,d.top=0,a){case"left":d.left=0;break;case"center":d.left=0-(n.height*h-n.width)/2;break;case"right":d.right=0}i.css(d)}},s.prototype.loadImage=function(t){var e=this,i=e.$items.eq(t).find(".pic"),n=new Image;n.onerror=function(){console.log("error loading image ["+t+"] : "+this.src),t+1<e.$items.length&&e.loadImage(t+1)},n.onload=function(){i.data("size",{width:this.width,height:this.height}),e.placeImage(t),e.$items.eq(t).addClass("tg-loaded"),t+1<e.$items.length&&e.loadImage(t+1)};var o=i.data("src");n.src=o,i.attr("src",o)},s.prototype.init=function(){var o=this;l(c).trigger("modula_api_before_init",[o]),this.$itemsCnt.css({position:"relative",zIndex:1,"min-height":"10px"}),this.$items.addClass("tile"),this.$items.find(".pic").removeAttr("src"),"custom-grid"===this.options.type?this.createCustomGallery():this.createGrid(),"1"!=o.options.lazyLoad&&this.loadImage(0),l(h).resize(function(){o.onResize(o)}),l(h).on("modula-update",function(){o.onResize(o)}),l(c).on("lazyloaded",function(t){var e,i,n=l(t.target);"modula"==n.data("source")&&(n.data("size",{width:n.width(),height:n.height()}),(e=n.parents(".item")).addClass("tg-loaded"),i=o.$items.index(e),o.placeImage(i))}),new ResizeSensor(o.$element,function(){o.onResize(o)}),this.setupSocial(),this.options.onComplete&&this.options.onComplete(),l(c).trigger("modula_api_after_init",[o])},s.prototype.setupSocial=function(){this.options.enableTwitter&&e(this.$items,this),this.options.enableFacebook&&n(this.$items,this),this.options.enablePinterest&&r(this.$items,this),this.options.enableLinkedin&&a(this.$items,this)},s.prototype.destroy=function(){this.isPackeryActive&&(this.$itemsCnt.packery("destroy"),this.isPackeryActive=!1)};var e=function(t,n){t.find(".modula-icon-twitter").click(function(t){t.preventDefault();var e=l(this).parents(".tile:first").find(".caption"),i=n.options.twitterText||c.title;return!n.options.twitterText&&1==e.length&&0<e.text().length&&(i=l.trim(e.text())),h.open("https://twitter.com/intent/tweet?url="+encodeURI(location.href.split("#")[0])+"&text="+encodeURI(i),"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},n=function(t,o){t.find(".modula-icon-facebook").click(function(t){t.preventDefault();var e=l(this).parents(".tile:first").find(".pic"),i=l(this).parents(".tile:first").find(".caption");o.options.facebookText||c.title;!o.options.facebookText&&1==i.length&&0<i.text().length&&l.trim(i.text());e.attr("src");var n="//www.facebook.com/sharer.php?u="+location.href;return h.open(n,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},r=function(t,s){t.find(".modula-icon-pinterest").click(function(t){t.preventDefault();var e=l(this).parents(".tile:first").find(".pic"),i=l(this).parents(".tile:first").find(".caption"),n=s.options.facebookText||c.title;!s.options.facebookText&&1==i.length&&0<i.text().length&&(n=l.trim(i.text()));var o="http://pinterest.com/pin/create/button/?url="+encodeURI(location.href)+"&description="+encodeURI(n);1==e.length&&(o+="&media="+function(t){var e=c.createElement("img");return e.src=t,t=e.src,e.src=null,t}(e.attr("src")));return h.open(o,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},a=function(t,e){t.find(".modula-icon-linkedin").click(function(t){t.preventDefault();var e="//linkedin.com/shareArticle?mini=true&url="+ +encodeURI(location.href);return h.open(e,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})};l.fn[o]=function(e){var i,n=arguments;return void 0===e||"object"==typeof e?this.each(function(){l.data(this,"plugin_"+o)||l.data(this,"plugin_"+o,new s(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=l.data(this,"plugin_"+o);t instanceof s&&"function"==typeof t[e]&&(i=t[e].apply(t,Array.prototype.slice.call(n,1))),"destroy"===e&&l.data(this,"plugin_"+o,null)}),void 0!==i?i:this):void 0}}(jQuery,window,document),jQuery(document).ready(function(i){var t=i(".modula-gallery");i.each(t,function(){var t=i(this).attr("id"),e=i(this).data("config");i("#"+t).modulaGallery(e)})});
1
+ function tg_getURLParameter(t){return decodeURIComponent((new RegExp("[?|&]"+t+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||null}!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.ResizeSensor=e()}("undefined"!=typeof window?window:this,function(){if("undefined"==typeof window)return null;var v=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return window.setTimeout(t,20)};function n(t,e){var i=Object.prototype.toString.call(t),n="[object Array]"===i||"[object NodeList]"===i||"[object HTMLCollection]"===i||"[object Object]"===i||"undefined"!=typeof jQuery&&t instanceof jQuery||"undefined"!=typeof Elements&&t instanceof Elements,o=0,s=t.length;if(n)for(;o<s;o++)e(t[o]);else e(t)}function y(t){if(!t.getBoundingClientRect)return{width:t.offsetWidth,height:t.offsetHeight};var e=t.getBoundingClientRect();return{width:Math.round(e.width),height:Math.round(e.height)}}var o=function(e,i){function w(){var i,n,o=[];this.add=function(t){o.push(t)},this.call=function(){for(i=0,n=o.length;i<n;i++)o[i].call()},this.remove=function(t){var e=[];for(i=0,n=o.length;i<n;i++)o[i]!==t&&e.push(o[i]);o=e},this.length=function(){return o.length}}n(e,function(t){!function(n,t){if(n)if(n.resizedAttached)n.resizedAttached.add(t);else{n.resizedAttached=new w,n.resizedAttached.add(t),n.resizeSensor=document.createElement("div"),n.resizeSensor.dir="ltr",n.resizeSensor.className="resize-sensor";var e="position: absolute; left: -10px; top: -10px; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;",i="position: absolute; left: 0; top: 0; transition: 0s;";n.resizeSensor.style.cssText=e,n.resizeSensor.innerHTML='<div class="resize-sensor-expand" style="'+e+'"><div style="'+i+'"></div></div><div class="resize-sensor-shrink" style="'+e+'"><div style="'+i+' width: 200%; height: 200%"></div></div>',n.appendChild(n.resizeSensor);var o=window.getComputedStyle(n).getPropertyPriority("position");"absolute"!==o&&"relative"!==o&&"fixed"!==o&&(n.style.position="relative");var s,h,r=n.resizeSensor.childNodes[0],a=r.childNodes[0],d=n.resizeSensor.childNodes[1],l=y(n),c=l.width,u=l.height,p=function(){var t=0===n.offsetWidth&&0===n.offsetHeight;if(t){var e=n.style.display;n.style.display="block"}a.style.width="100000px",a.style.height="100000px",r.scrollLeft=1e5,r.scrollTop=1e5,d.scrollLeft=1e5,d.scrollTop=1e5,t&&(n.style.display=e)};n.resizeSensor.resetSensor=p;var f=function(){h=0,s&&(u=c=void 0,n.resizedAttached&&n.resizedAttached.call())},g=function(){var t=y(n),e=t.width,i=t.height;(s=e!=c||i!=u)&&!h&&(h=v(f)),p()},m=function(t,e,i){t.attachEvent?t.attachEvent("on"+e,i):t.addEventListener(e,i)};m(r,"scroll",g),m(d,"scroll",g),v(p)}}(t,i)}),this.detach=function(t){o.detach(e,t)},this.reset=function(){e.resizeSensor.resetSensor()}};return o.reset=function(t,e){n(t,function(t){t.resizeSensor.resetSensor()})},o.detach=function(t,e){n(t,function(t){t&&(t.resizedAttached&&"function"==typeof e&&(t.resizedAttached.remove(e),t.resizedAttached.length())||t.resizeSensor&&(t.contains(t.resizeSensor)&&t.removeChild(t.resizeSensor),delete t.resizeSensor,delete t.resizedAttached))})},o}),jQuery(document).on("vc-full-width-row-single vc-full-width-row",function(t,e){0<jQuery("body").find(".modula").length&&jQuery(window).trigger("modula-update")}),function(l,h,c,t){var o="modulaGallery",i={resizer:"/",margin:10,keepArea:!0,type:"creative-gallery",columns:12,gutter:10,enableTwitter:!1,enableFacebook:!1,enableGplus:!1,enablePinterest:!1,enableLinkedin:!1,lazyLoad:0};function s(t,e){this.element=t,this.$element=l(t),this.$itemsCnt=this.$element.find(".modula-items"),this.$items=this.$itemsCnt.find(".modula-item"),this.options=l.extend({},i,e),this._defaults=i,this._name=o,this.tiles=[],this.$tilesCnt=null,this.completed=!1,this.lastWidth=0,this.resizeTO=0,this.isPackeryActive=!1,this.init()}s.prototype.trunc=function(t){return Math.trunc?Math.trunc(t):(t=+t,isFinite(t)?t-t%1||(t<0?-0:0===t?t:0):t)},s.prototype.createCustomGallery=function(){var r,t=this.$element.width(),a=this,d=this.options.columns,e=c.documentElement.clientWidth;"1"==this.options.enableResponsive&&(e<=568?d=this.options.mobileColumns:e<=768&&(d=this.options.tabletColumns)),r=0<this.options.gutter?(t-this.options.gutter*(d-1))/d:Math.floor(t/d),this.$items.not(".jtg-hidden").each(function(t,e){var i,n,o,s,h={};i=l(e).data("width"),n=l(e).data("height"),12<i&&(i=12),"1"==a.options.enableResponsive&&(o=i,s=n,1==d?n=(i=1)*s/o:((i=Math.round(d*o/12))<1&&(i=1),(n=Math.round(i*s/o))<1&&(n=1))),h.width=r*i+a.options.gutter*(i-1),h.height=Math.round(r)*n+a.options.gutter*(n-1),l(e).data("size",h).addClass("tiled").addClass(h.width>h.height?"tile-h":"tile-v").data("position"),l(e).css(l(e).data("size")),l(e).find(".figc").css({width:l(e).data("size").width,height:l(e).data("size").height})}),this.isPackeryActive&&this.$itemsCnt.packery("destroy"),this.$itemsCnt.packery({itemSelector:".modula-item",gutter:parseInt(a.options.gutter),columnWidth:r,resize:!1}),this.isPackeryActive=!0},s.prototype.createGrid=function(){var n=this;this.options.width&&this.$itemsCnt.width(this.options.width),this.options.height&&this.$itemsCnt.height(this.options.height),this.$itemsCnt.data("area",this.$itemsCnt.width()*this.$itemsCnt.height()),this.lastWidth=this.$itemsCnt.width();for(var t=0;t<this.$items.not(".jtg-hidden").length;t++)this.tiles.push(n.getSlot());this.tiles.sort(function(t,e){return t.position-e.position}),this.$items.not(".jtg-hidden").each(function(t,e){var i=n.tiles[t];l(e).data("size",i).addClass("tiled").addClass(i.width>i.height?"tile-h":"tile-v").data("position")}),this.$items.each(function(t,e){l(e).css(l(e).data("size")),l(e).find(".figc").css({width:l(e).data("size").width,height:l(e).data("size").height})}),this.completed=!0},s.prototype.getSlot=function(){if(0==this.tiles.length)return i={top:0,left:0,width:this.$itemsCnt.width(),height:this.$itemsCnt.height(),area:this.$itemsCnt.width()*this.$itemsCnt.height(),position:0};for(var t=0,e=0;e<this.tiles.length;e++){(i=this.tiles[e]).area>this.tiles[t].area&&(t=e)}var i={},n=this.tiles[t];if(n.width>n.height){var o=n.width/2*this.options.randomFactor;n.prevWidth=n.width,n.width=Math.floor(n.width/2+o*(Math.random()-.5)),i={top:n.top,left:n.left+n.width+this.options.margin,width:n.prevWidth-n.width-this.options.margin,height:n.height}}else{o=n.height/2*this.options.randomFactor;n.prevHeight=n.height,n.height=Math.floor(n.height/2+o*(Math.random()-.5)),i={left:n.left,top:n.top+n.height+this.options.margin,width:n.width,height:n.prevHeight-n.height-this.options.margin}}return i.area=i.width*i.height,i.position=1e3*i.top+i.left,n.position=1e3*n.top+n.left,this.tiles[t]=n,this.tiles[t].area=n.width*n.height,i},s.prototype.reset=function(){var i=this;i.tiles=[],"custom-grid"===i.options.type?(i.createCustomGallery(),i.$itemsCnt.packery()):i.createGrid(),i.$itemsCnt.find(".pic").each(function(t,e){i.placeImage(t)}),i.lastWidth=i.$itemsCnt.width()},s.prototype.onResize=function(e){e.lastWidth!=e.$itemsCnt.width()&&(clearTimeout(e.resizeTO),e.resizeTO=setTimeout(function(){if(e.options.keepArea){var t=e.$itemsCnt.data("area");e.$itemsCnt.height(t/e.$itemsCnt.width())}e.reset()},100))},s.prototype.placeImage=function(t){var e=this.$items.eq(t),i=e.find(".pic"),n=e.data("size"),o=i.data("size");if(i.parent()!=e&&(n={width:i.parent().width(),height:i.parent().height()}),void 0!==n&&void 0!==o){var s=n.width/n.height,h=o.width/o.height,r=i.data("valign")?i.data("valign"):"middle",a=i.data("halign")?i.data("halign"):"center",d={top:"auto",bottom:"auto",left:"auto",right:"auto",width:"auto",height:"auto",margin:"0",maxWidth:"999em"};if(h<s)switch(d.width=n.width,d.left=0,r){case"top":d.top=0;break;case"middle":d.top=0-(n.width*(1/h)-n.height)/2;break;case"bottom":d.bottom=0}else switch(d.height=n.height,d.top=0,a){case"left":d.left=0;break;case"center":d.left=0-(n.height*h-n.width)/2;break;case"right":d.right=0}i.css(d)}},s.prototype.loadImage=function(t){var e=this,i=e.$items.eq(t).find(".pic"),n=new Image;n.onerror=function(){console.log("error loading image ["+t+"] : "+this.src),t+1<e.$items.length&&e.loadImage(t+1)},n.onload=function(){i.data("size",{width:this.width,height:this.height}),e.placeImage(t),e.$items.eq(t).addClass("tg-loaded"),t+1<e.$items.length&&e.loadImage(t+1)};var o=i.data("src");n.src=o,i.attr("src",o)},s.prototype.init=function(){var o=this;l(c).trigger("modula_api_before_init",[o]),this.$itemsCnt.css({position:"relative",zIndex:1,"min-height":"10px"}),this.$items.addClass("tile"),this.$items.find(".pic").removeAttr("src"),"custom-grid"===this.options.type?this.createCustomGallery():this.createGrid(),"1"!=o.options.lazyLoad&&this.loadImage(0),l(h).resize(function(){o.onResize(o)}),l(h).on("modula-update",function(){o.onResize(o)}),l(c).on("lazyloaded",function(t){var e,i,n=l(t.target);"modula"==n.data("source")&&(n.data("size",{width:n.width(),height:n.height()}),(e=n.parents(".modula-item")).addClass("tg-loaded"),i=o.$items.index(e),o.placeImage(i))}),new ResizeSensor(o.$element,function(){o.onResize(o)}),this.setupSocial(),this.options.onComplete&&this.options.onComplete(),l(c).trigger("modula_api_after_init",[o])},s.prototype.setupSocial=function(){this.options.enableTwitter&&e(this.$items,this),this.options.enableFacebook&&n(this.$items,this),this.options.enablePinterest&&r(this.$items,this),this.options.enableLinkedin&&a(this.$items,this)},s.prototype.destroy=function(){this.isPackeryActive&&(this.$itemsCnt.packery("destroy"),this.isPackeryActive=!1)};var e=function(t,n){t.find(".modula-icon-twitter").click(function(t){t.preventDefault();var e=l(this).parents(".tile:first").find(".caption"),i=n.options.twitterText||c.title;return!n.options.twitterText&&1==e.length&&0<e.text().length&&(i=l.trim(e.text())),h.open("https://twitter.com/intent/tweet?url="+encodeURI(location.href.split("#")[0])+"&text="+encodeURI(i),"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},n=function(t,o){t.find(".modula-icon-facebook").click(function(t){t.preventDefault();var e=l(this).parents(".tile:first").find(".pic"),i=l(this).parents(".tile:first").find(".caption");o.options.facebookText||c.title;!o.options.facebookText&&1==i.length&&0<i.text().length&&l.trim(i.text());e.attr("src");var n="//www.facebook.com/sharer.php?u="+location.href;return h.open(n,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},r=function(t,s){t.find(".modula-icon-pinterest").click(function(t){t.preventDefault();var e=l(this).parents(".tile:first").find(".pic"),i=l(this).parents(".tile:first").find(".caption"),n=s.options.facebookText||c.title;!s.options.facebookText&&1==i.length&&0<i.text().length&&(n=l.trim(i.text()));var o="http://pinterest.com/pin/create/button/?url="+encodeURI(location.href)+"&description="+encodeURI(n);1==e.length&&(o+="&media="+function(t){var e=c.createElement("img");return e.src=t,t=e.src,e.src=null,t}(e.attr("src")));return h.open(o,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},a=function(t,e){t.find(".modula-icon-linkedin").click(function(t){t.preventDefault();var e="//linkedin.com/shareArticle?mini=true&url="+ +encodeURI(location.href);return h.open(e,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})};l.fn[o]=function(e){var i,n=arguments;return void 0===e||"object"==typeof e?this.each(function(){l.data(this,"plugin_"+o)||l.data(this,"plugin_"+o,new s(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=l.data(this,"plugin_"+o);t instanceof s&&"function"==typeof t[e]&&(i=t[e].apply(t,Array.prototype.slice.call(n,1))),"destroy"===e&&l.data(this,"plugin_"+o,null)}),void 0!==i?i:this):void 0}}(jQuery,window,document),jQuery(document).ready(function(i){var t=i(".modula-gallery");i.each(t,function(){var t=i(this).attr("id"),e=i(this).data("config");i("#"+t).modulaGallery(e)})});
changelog.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  = 2.1.4 - 24.07.2019 =
2
  * Change modula CSS classes
3
  * Fixed hover effects ( https://github.com/MachoThemes/modula-lite/issues/201 )
1
+ = 2.1.5 - 25.07.2019 =
2
+ * Fixed lazy load.
3
+
4
  = 2.1.4 - 24.07.2019 =
5
  * Change modula CSS classes
6
  * Fixed hover effects ( https://github.com/MachoThemes/modula-lite/issues/201 )