Gallery – Photo Gallery – Image Gallery - Version 2.0.7

Version Description

Download this release

Release Info

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

Code changes from version 2.0.6 to 2.0.7

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.0.6
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.0.6' );
47
  define( 'MODULA_PATH', plugin_dir_path( __FILE__ ) );
48
  define( 'MODULA_URL', plugin_dir_url( __FILE__ ) );
49
 
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.0.7
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.0.7' );
47
  define( 'MODULA_PATH', plugin_dir_path( __FILE__ ) );
48
  define( 'MODULA_URL', plugin_dir_url( __FILE__ ) );
49
 
README.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Modula Image Gallery ===
2
  Contributors: machothemes, silkalns
3
  Tags: best gallery plugin, image gallery, photo gallery, responsive gallery, wordpress gallery plugin, wordpress portfolio plugin, masonry gallery, fancy gallery, media gallery, mosaic gallery, polaroid gallery, portfolio gallery
4
  Requires at least: 4.6
5
  Tested up to: 5.1
6
  Requires PHP: 5.6
7
- Stable tag: 2.0.6
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -12,7 +12,7 @@ Photo Gallery by Modula - an advanced solution for Photo Gallery users. Create b
12
 
13
  == Description ==
14
 
15
- **Modula Image Gallery** is a standalone plugin built, maintained & operated by the friendly folks over at [MachoThemes](https://www.machothemes.com/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite).
16
 
17
  With Modula, it's easier than ever to build stunning [lightbox galleries](https://wp-modula.com/demo/lightbox-gallery?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite), masonry grids, custom grids and more in no more than a few clicks right from the WordPress dashboard.
18
 
1
+ === Modula Photo Gallery ===
2
  Contributors: machothemes, silkalns
3
  Tags: best gallery plugin, image gallery, photo gallery, responsive gallery, wordpress gallery plugin, wordpress portfolio plugin, masonry gallery, fancy gallery, media gallery, mosaic gallery, polaroid gallery, portfolio gallery
4
  Requires at least: 4.6
5
  Tested up to: 5.1
6
  Requires PHP: 5.6
7
+ Stable tag: 2.0.7
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ **Modula Photo Gallery** is a standalone plugin built, maintained & operated by the friendly folks over at [MachoThemes](https://www.machothemes.com/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite).
16
 
17
  With Modula, it's easier than ever to build stunning [lightbox galleries](https://wp-modula.com/demo/lightbox-gallery?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite), masonry grids, custom grids and more in no more than a few clicks right from the WordPress dashboard.
18
 
assets/css/effects.css DELETED
@@ -1,125 +0,0 @@
1
- @media screen and (min-width: 1px) {
2
-
3
- .modula .items .item h2 {
4
- margin:0;
5
- }
6
- .modula .items .item p {
7
- margin:0;
8
- padding: 0;
9
- }
10
- .modula .figc {
11
- color: black;
12
- text-align: center;
13
- position: absolute;
14
- left: 0;
15
- width: 100%;
16
- padding:2em;
17
- }
18
-
19
- .modula .item .jtg-social a {
20
- text-decoration: none;
21
- color: #fff;
22
- display: inline-block;
23
- margin:0 10px 0 0;
24
- width: 20px;
25
- padding: 6px 4px;
26
- border: 0;
27
- opacity: 0;
28
- transition: opacity .3s;
29
- }
30
- .modula .item:hover .jtg-social a {
31
- opacity: 1;
32
- }
33
-
34
- /*---------------*/
35
- /***** pufrobo *****/
36
- /*---------------*/
37
-
38
- .modula .items .jtg-social {
39
- opacity: 0;
40
- transition: opacity 0.1s;
41
- right:30px;
42
- position: absolute;
43
- bottom:20px;
44
- text-align: right;
45
- transition:all .3s;
46
- }
47
-
48
- .modula .items .jtg-social {
49
- opacity: 1;
50
- }
51
-
52
- .modula .items .jtg-social a:last-of-type {
53
- margin-right: 0;
54
- }
55
-
56
- .modula .item.effect-pufrobo p.description {
57
- margin-bottom: 2em;
58
- }
59
-
60
- .modula .item.effect-pufrobo .figc {
61
- text-align: right;
62
- }
63
-
64
- .modula .item.effect-pufrobo h2,
65
- .modula .item.effect-pufrobo p {
66
- position: absolute;
67
- right: 30px;
68
- left: 30px;
69
- padding: 10px 0;
70
- }
71
-
72
- .modula .item:hover img { opacity: .8 }
73
-
74
- .modula .item { background-color:#000; }
75
-
76
- .modula .item.effect-pufrobo p {
77
- bottom: 20%;
78
- line-height: 1.5;
79
- -webkit-transform: translate3d(0,100%,0);
80
- transform: translate3d(0,100%,0);
81
- letter-spacing: 1px;
82
- }
83
-
84
- .modula .item.effect-pufrobo h2 {
85
- /*top: 30px;*/
86
- top: 10%;
87
- -webkit-transition: -webkit-transform 0.35s;
88
- transition: transform 0.35s;
89
- -webkit-transform: translate3d(0,20px,0);
90
- transform: translate3d(0,20px,0);
91
- }
92
-
93
- .modula .item.effect-pufrobo:hover h2 {
94
- -webkit-transform: translate3d(0,0,0);
95
- transform: translate3d(0,0,0);
96
- }
97
-
98
- .modula .item.effect-pufrobo h2::after {
99
- position: absolute;
100
- top: 80%;
101
- left: 0;
102
- width: 100%;
103
- height: 4px;
104
- background: #fff;
105
- content: '';
106
- -webkit-transform: translate3d(0,40px,0);
107
- transform: translate3d(0,40px,0);
108
- }
109
-
110
- .modula .item.effect-pufrobo h2::after,
111
- .modula .item.effect-pufrobo p {
112
- opacity: 0;
113
- -webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
114
- transition: opacity 0.35s, transform 0.35s;
115
- }
116
-
117
- .modula .item.effect-pufrobo:hover h2::after,
118
- .modula .item.effect-pufrobo:hover p {
119
- margin-top: 10px;
120
- margin-bottom: 5px;
121
- opacity: 1;
122
- -webkit-transform: translate3d(0,0,0);
123
- transform: translate3d(0,0,0);
124
- }
125
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/modula.css CHANGED
@@ -36,6 +36,11 @@
36
  transition: width .3s, height .3s, transform .3s linear, opacity .2s linear;
37
  }
38
 
 
 
 
 
 
39
  .modula .items .item .description {
40
  font-size:14px;
41
  }
@@ -107,4 +112,145 @@
107
  .modula .jtg-social svg {
108
  width: 20px;
109
  height: 16px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  }
36
  transition: width .3s, height .3s, transform .3s linear, opacity .2s linear;
37
  }
38
 
39
+ .modula .items .item img.pic.lazyloaded,
40
+ .modula .items .item img.pic.lazyload {
41
+ display: block;
42
+ }
43
+
44
  .modula .items .item .description {
45
  font-size:14px;
46
  }
112
  .modula .jtg-social svg {
113
  width: 20px;
114
  height: 16px;
115
+ }
116
+
117
+ .modula .items .item h2 {
118
+ margin:0;
119
+ }
120
+ .modula .items .item p {
121
+ margin:0;
122
+ padding: 0;
123
+ }
124
+ .modula .figc {
125
+ color: black;
126
+ text-align: center;
127
+ position: absolute;
128
+ left: 0;
129
+ width: 100%;
130
+ padding:2em;
131
+ }
132
+
133
+ .modula .item .jtg-social a {
134
+ text-decoration: none;
135
+ color: #fff;
136
+ display: inline-block;
137
+ margin:0 10px 0 0;
138
+ width: 20px;
139
+ padding: 6px 4px;
140
+ border: 0;
141
+ opacity: 0;
142
+ transition: opacity .3s;
143
+ }
144
+ .modula .item:hover .jtg-social a {
145
+ opacity: 1;
146
+ }
147
+
148
+ /*---------------*/
149
+ /***** pufrobo *****/
150
+ /*---------------*/
151
+ .modula .items .jtg-social {
152
+ opacity: 0;
153
+ transition: opacity 0.1s;
154
+ right:30px;
155
+ position: absolute;
156
+ bottom:20px;
157
+ text-align: right;
158
+ transition:all .3s;
159
+ }
160
+
161
+ .modula .items .jtg-social {
162
+ opacity: 1;
163
+ }
164
+
165
+ .modula .items .jtg-social a:last-of-type {
166
+ margin-right: 0;
167
+ }
168
+
169
+ .modula .item.effect-pufrobo p.description {
170
+ margin-bottom: 2em;
171
+ }
172
+
173
+ .modula .item.effect-pufrobo .figc {
174
+ text-align: right;
175
+ }
176
+
177
+ .modula .item.effect-pufrobo h2,
178
+ .modula .item.effect-pufrobo p {
179
+ position: absolute;
180
+ right: 30px;
181
+ left: 30px;
182
+ padding: 10px 0;
183
+ }
184
+
185
+ .modula .item:hover img { opacity: .8 }
186
+
187
+ .modula .item { background-color:#000; }
188
+
189
+ .modula .item.effect-pufrobo p {
190
+ bottom: 20%;
191
+ line-height: 1.5;
192
+ -webkit-transform: translate3d(0,100%,0);
193
+ transform: translate3d(0,100%,0);
194
+ letter-spacing: 1px;
195
+ }
196
+
197
+ .modula .item.effect-pufrobo h2 {
198
+ /*top: 30px;*/
199
+ top: 10%;
200
+ -webkit-transition: -webkit-transform 0.35s;
201
+ transition: transform 0.35s;
202
+ -webkit-transform: translate3d(0,20px,0);
203
+ transform: translate3d(0,20px,0);
204
+ }
205
+
206
+ .modula .item.effect-pufrobo:hover h2 {
207
+ -webkit-transform: translate3d(0,0,0);
208
+ transform: translate3d(0,0,0);
209
+ }
210
+
211
+ .modula .item.effect-pufrobo h2::after {
212
+ position: absolute;
213
+ top: 80%;
214
+ left: 0;
215
+ width: 100%;
216
+ height: 4px;
217
+ background: #fff;
218
+ content: '';
219
+ -webkit-transform: translate3d(0,40px,0);
220
+ transform: translate3d(0,40px,0);
221
+ }
222
+
223
+ .modula .item.effect-pufrobo h2::after,
224
+ .modula .item.effect-pufrobo p {
225
+ opacity: 0;
226
+ -webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
227
+ transition: opacity 0.35s, transform 0.35s;
228
+ }
229
+
230
+ .modula .item.effect-pufrobo:hover h2::after,
231
+ .modula .item.effect-pufrobo:hover p {
232
+ margin-top: 10px;
233
+ margin-bottom: 5px;
234
+ opacity: 1;
235
+ -webkit-transform: translate3d(0,0,0);
236
+ transform: translate3d(0,0,0);
237
+ }
238
+
239
+ .modula .items .item.effect-pufrobo .figc.no-title.no-description h2.jtg-title:after {
240
+ display: none;
241
+ }
242
+
243
+ /* TwnetyNintheen fix */
244
+ .modula .items .item.effect-fluid-up .figc h2.jtg-title:before,
245
+ .modula .items .item.effect-hide .figc h2.jtg-title:before,
246
+ .modula .items .item.effect-quiet .figc h2.jtg-title:before,
247
+ .modula .items .item.effect-reflex .figc h2.jtg-title:before,
248
+ .modula .items .item.effect-curtain .figc h2.jtg-title:before,
249
+ .modula .items .item.effect-lens .figc h2.jtg-title:before,
250
+ .modula .items .item.effect-appear .figc h2.jtg-title:before,
251
+ .modula .items .item.effect-crafty .figc h2.jtg-title:before,
252
+ .modula .items .item.effect-seemo .figc h2.jtg-title:before,
253
+ .modula .items .item.effect-comodo .figc h2.jtg-title:before,
254
+ .modula .items .item.effect-pufrobo .figc h2.jtg-title:before {
255
+ display: none;
256
  }
assets/js/jquery-modula.js CHANGED
@@ -295,7 +295,8 @@ jQuery(document).on( 'vc-full-width-row-single vc-full-width-row', function( eve
295
  enableTwitter: false,
296
  enableFacebook: false,
297
  enableGplus: false,
298
- enablePinterest: false
 
299
  };
300
 
301
  // The actual plugin constructor
@@ -680,7 +681,9 @@ jQuery(document).on( 'vc-full-width-row-single vc-full-width-row', function( eve
680
  }
681
 
682
  // Load Images
683
- this.loadImage(0);
 
 
684
 
685
  $(window).resize(function () {
686
  instance.onResize(instance);
@@ -690,6 +693,20 @@ jQuery(document).on( 'vc-full-width-row-single vc-full-width-row', function( eve
690
  instance.onResize(instance);
691
  });
692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
693
  new ResizeSensor( instance.$element, function() {
694
  instance.onResize(instance);
695
  });
295
  enableTwitter: false,
296
  enableFacebook: false,
297
  enableGplus: false,
298
+ enablePinterest: false,
299
+ lazyLoad: 0,
300
  };
301
 
302
  // The actual plugin constructor
681
  }
682
 
683
  // Load Images
684
+ if ( '1' != instance.options.lazyLoad ) {
685
+ this.loadImage(0);
686
+ }
687
 
688
  $(window).resize(function () {
689
  instance.onResize(instance);
693
  instance.onResize(instance);
694
  });
695
 
696
+ $( document ).on('lazyloaded', function( evt ){
697
+ var element = $( evt.target ),
698
+ parent, index;
699
+
700
+ if ( 'modula' == element.data( 'source' ) ) {
701
+ element.data('size', { width: element.width(), height: element.height() });
702
+ parent = element.parents( '.item' );
703
+ parent.addClass( 'tg-loaded' );
704
+ index = instance.$items.index( parent );
705
+ instance.placeImage(index);
706
+ }
707
+
708
+ });
709
+
710
  new ResizeSensor( instance.$element, function() {
711
  instance.onResize(instance);
712
  });
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,s=0,o=t.length;if(n)for(;s<o;s++)e(t[s]);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 s=function(e,i){function w(){var i,n,s=[];this.add=function(t){s.push(t)},this.call=function(){for(i=0,n=s.length;i<n;i++)s[i].call()},this.remove=function(t){var e=[];for(i=0,n=s.length;i<n;i++)s[i]!==t&&e.push(s[i]);s=e},this.length=function(){return s.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 s=window.getComputedStyle(n).getPropertyPriority("position");"absolute"!==s&&"relative"!==s&&"fixed"!==s&&(n.style.position="relative");var o,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,o&&(u=c=void 0,n.resizedAttached&&n.resizedAttached.call())},g=function(){var t=y(n),e=t.width,i=t.height;(o=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){s.detach(e,t)},this.reset=function(){e.resizeSensor.resetSensor()}};return s.reset=function(t,e){n(t,function(t){t.resizeSensor.resetSensor()})},s.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))})},s}),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,d,c,t){var s="modulaGallery",i={resizer:"/",margin:10,keepArea:!0,type:"creative-gallery",columns:12,gutter:10,enableTwitter:!1,enableFacebook:!1,enableGplus:!1,enablePinterest:!1};function o(t,e){this.element=t,this.$element=l(t),this.$itemsCnt=this.$element.find(".items"),this.$items=this.$itemsCnt.find(".item"),this.options=l.extend({},i,e),this._defaults=i,this._name=s,this.tiles=[],this.$tilesCnt=null,this.completed=!1,this.lastWidth=0,this.resizeTO=0,this.isPackeryActive=!1,this.init()}o.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)},o.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?a.trunc((t-this.options.gutter*d)/d):a.trunc(t/d),this.$items.not(".jtg-hidden").each(function(t,e){var i,n,s,o,h={};i=l(e).data("width"),n=l(e).data("height"),12<i&&(i=12),"1"==a.options.enableResponsive&&(s=i,o=n,1==d?n=(i=1)*o/s:((i=Math.round(d*s/12))<1&&(i=1),(n=Math.round(i*o/s))<1&&(n=1))),h.width=r*i+a.options.gutter*(i-1),h.height=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:".item",gutter:parseInt(a.options.gutter),columnWidth:r,resize:!1}),this.isPackeryActive=!0},o.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},o.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 s=n.width/2*this.options.randomFactor;n.prevWidth=n.width,n.width=Math.floor(n.width/2+s*(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{s=n.height/2*this.options.randomFactor;n.prevHeight=n.height,n.height=Math.floor(n.height/2+s*(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},o.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()},o.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))},o.prototype.placeImage=function(t){var e=this.$items.eq(t),i=e.find(".pic"),n=e.data("size"),s=i.data("size"),o=n.width/n.height,h=s.width/s.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<o)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)},o.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 s=i.data("src");n.src=s,i.attr("src",s)},o.prototype.init=function(){var t=this;l(c).trigger("modula_api_before_init",[t]),this.$itemsCnt.css({position:"relative",zIndex:1}),this.$items.addClass("tile"),this.$items.find(".pic").removeAttr("src"),"custom-grid"===this.options.type?this.createCustomGallery():this.createGrid(),this.loadImage(0),l(d).resize(function(){t.onResize(t)}),l(d).on("modula-update",function(){t.onResize(t)}),new ResizeSensor(t.$element,function(){t.onResize(t)}),this.setupSocial(),this.options.onComplete&&this.options.onComplete(),l(c).trigger("modula_api_after_init",[t])},o.prototype.setupSocial=function(){this.options.enableTwitter&&e(this.$items,this),this.options.enableFacebook&&n(this.$items,this),this.options.enableGplus&&r(this.$items,this),this.options.enablePinterest&&h(this.$items,this)};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())),d.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,s){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");s.options.facebookText||c.title;!s.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 d.open(n,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},h=function(t,a){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=a.options.facebookText||c.title;!a.options.facebookText&&1==i.length&&0<i.text().length&&(n=l.trim(i.text()));var s,o,h="http://pinterest.com/pin/create/button/?url="+encodeURI(location.href)+"&description="+encodeURI(n);if(1==e.length){var r=e.attr("src");h+="&media="+(s=r,(o=c.createElement("img")).src=s,s=o.src,o.src=null,s)}return d.open(h,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},r=function(t,e){t.find(".modula-icon-google-plus").click(function(t){t.preventDefault();var e="https://plus.google.com/share?url="+encodeURI(location.href);return d.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[s]=function(e){var i,n=arguments;return void 0===e||"object"==typeof e?this.each(function(){l.data(this,"plugin_"+s)||l.data(this,"plugin_"+s,new o(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=l.data(this,"plugin_"+s);t instanceof o&&"function"==typeof t[e]&&(i=t[e].apply(t,Array.prototype.slice.call(n,1))),"destroy"===e&&l.data(this,"plugin_"+s,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,s=0,o=t.length;if(n)for(;s<o;s++)e(t[s]);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 s=function(e,i){function w(){var i,n,s=[];this.add=function(t){s.push(t)},this.call=function(){for(i=0,n=s.length;i<n;i++)s[i].call()},this.remove=function(t){var e=[];for(i=0,n=s.length;i<n;i++)s[i]!==t&&e.push(s[i]);s=e},this.length=function(){return s.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 s=window.getComputedStyle(n).getPropertyPriority("position");"absolute"!==s&&"relative"!==s&&"fixed"!==s&&(n.style.position="relative");var o,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,o&&(u=c=void 0,n.resizedAttached&&n.resizedAttached.call())},g=function(){var t=y(n),e=t.width,i=t.height;(o=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){s.detach(e,t)},this.reset=function(){e.resizeSensor.resetSensor()}};return s.reset=function(t,e){n(t,function(t){t.resizeSensor.resetSensor()})},s.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))})},s}),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 s="modulaGallery",i={resizer:"/",margin:10,keepArea:!0,type:"creative-gallery",columns:12,gutter:10,enableTwitter:!1,enableFacebook:!1,enableGplus:!1,enablePinterest:!1,lazyLoad:0};function o(t,e){this.element=t,this.$element=l(t),this.$itemsCnt=this.$element.find(".items"),this.$items=this.$itemsCnt.find(".item"),this.options=l.extend({},i,e),this._defaults=i,this._name=s,this.tiles=[],this.$tilesCnt=null,this.completed=!1,this.lastWidth=0,this.resizeTO=0,this.isPackeryActive=!1,this.init()}o.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)},o.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?a.trunc((t-this.options.gutter*d)/d):a.trunc(t/d),this.$items.not(".jtg-hidden").each(function(t,e){var i,n,s,o,h={};i=l(e).data("width"),n=l(e).data("height"),12<i&&(i=12),"1"==a.options.enableResponsive&&(s=i,o=n,1==d?n=(i=1)*o/s:((i=Math.round(d*s/12))<1&&(i=1),(n=Math.round(i*o/s))<1&&(n=1))),h.width=r*i+a.options.gutter*(i-1),h.height=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:".item",gutter:parseInt(a.options.gutter),columnWidth:r,resize:!1}),this.isPackeryActive=!0},o.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},o.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 s=n.width/2*this.options.randomFactor;n.prevWidth=n.width,n.width=Math.floor(n.width/2+s*(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{s=n.height/2*this.options.randomFactor;n.prevHeight=n.height,n.height=Math.floor(n.height/2+s*(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},o.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()},o.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))},o.prototype.placeImage=function(t){var e=this.$items.eq(t),i=e.find(".pic"),n=e.data("size"),s=i.data("size"),o=n.width/n.height,h=s.width/s.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<o)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)},o.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 s=i.data("src");n.src=s,i.attr("src",s)},o.prototype.init=function(){var s=this;l(c).trigger("modula_api_before_init",[s]),this.$itemsCnt.css({position:"relative",zIndex:1}),this.$items.addClass("tile"),this.$items.find(".pic").removeAttr("src"),"custom-grid"===this.options.type?this.createCustomGallery():this.createGrid(),"1"!=s.options.lazyLoad&&this.loadImage(0),l(h).resize(function(){s.onResize(s)}),l(h).on("modula-update",function(){s.onResize(s)}),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=s.$items.index(e),s.placeImage(i))}),new ResizeSensor(s.$element,function(){s.onResize(s)}),this.setupSocial(),this.options.onComplete&&this.options.onComplete(),l(c).trigger("modula_api_after_init",[s])},o.prototype.setupSocial=function(){this.options.enableTwitter&&e(this.$items,this),this.options.enableFacebook&&n(this.$items,this),this.options.enableGplus&&a(this.$items,this),this.options.enablePinterest&&r(this.$items,this)};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,s){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");s.options.facebookText||c.title;!s.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,o){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=o.options.facebookText||c.title;!o.options.facebookText&&1==i.length&&0<i.text().length&&(n=l.trim(i.text()));var s="http://pinterest.com/pin/create/button/?url="+encodeURI(location.href)+"&description="+encodeURI(n);1==e.length&&(s+="&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(s,"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-google-plus").click(function(t){t.preventDefault();var e="https://plus.google.com/share?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[s]=function(e){var i,n=arguments;return void 0===e||"object"==typeof e?this.each(function(){l.data(this,"plugin_"+s)||l.data(this,"plugin_"+s,new o(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=l.data(this,"plugin_"+s);t instanceof o&&"function"==typeof t[e]&&(i=t[e].apply(t,Array.prototype.slice.call(n,1))),"destroy"===e&&l.data(this,"plugin_"+s,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)})});
assets/js/lazysizes.js ADDED
@@ -0,0 +1,714 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(window, factory) {
2
+ var lazySizes = factory(window, window.document);
3
+ window.lazySizes = lazySizes;
4
+ if(typeof module == 'object' && module.exports){
5
+ module.exports = lazySizes;
6
+ }
7
+ }(window, function l(window, document) {
8
+ 'use strict';
9
+ /*jshint eqnull:true */
10
+ if(!document.getElementsByClassName){return;}
11
+
12
+ var lazysizes, lazySizesConfig;
13
+
14
+ var docElem = document.documentElement;
15
+
16
+ var Date = window.Date;
17
+
18
+ var supportPicture = window.HTMLPictureElement;
19
+
20
+ var _addEventListener = 'addEventListener';
21
+
22
+ var _getAttribute = 'getAttribute';
23
+
24
+ var addEventListener = window[_addEventListener];
25
+
26
+ var setTimeout = window.setTimeout;
27
+
28
+ var requestAnimationFrame = window.requestAnimationFrame || setTimeout;
29
+
30
+ var requestIdleCallback = window.requestIdleCallback;
31
+
32
+ var regPicture = /^picture$/i;
33
+
34
+ var loadEvents = ['load', 'error', 'lazyincluded', '_lazyloaded'];
35
+
36
+ var regClassCache = {};
37
+
38
+ var forEach = Array.prototype.forEach;
39
+
40
+ var hasClass = function(ele, cls) {
41
+ if(!regClassCache[cls]){
42
+ regClassCache[cls] = new RegExp('(\\s|^)'+cls+'(\\s|$)');
43
+ }
44
+ return regClassCache[cls].test(ele[_getAttribute]('class') || '') && regClassCache[cls];
45
+ };
46
+
47
+ var addClass = function(ele, cls) {
48
+ if (!hasClass(ele, cls)){
49
+ ele.setAttribute('class', (ele[_getAttribute]('class') || '').trim() + ' ' + cls);
50
+ }
51
+ };
52
+
53
+ var removeClass = function(ele, cls) {
54
+ var reg;
55
+ if ((reg = hasClass(ele,cls))) {
56
+ ele.setAttribute('class', (ele[_getAttribute]('class') || '').replace(reg, ' '));
57
+ }
58
+ };
59
+
60
+ var addRemoveLoadEvents = function(dom, fn, add){
61
+ var action = add ? _addEventListener : 'removeEventListener';
62
+ if(add){
63
+ addRemoveLoadEvents(dom, fn);
64
+ }
65
+ loadEvents.forEach(function(evt){
66
+ dom[action](evt, fn);
67
+ });
68
+ };
69
+
70
+ var triggerEvent = function(elem, name, detail, noBubbles, noCancelable){
71
+ var event = document.createEvent('Event');
72
+
73
+ if(!detail){
74
+ detail = {};
75
+ }
76
+
77
+ detail.instance = lazysizes;
78
+
79
+ event.initEvent(name, !noBubbles, !noCancelable);
80
+
81
+ event.detail = detail;
82
+
83
+ elem.dispatchEvent(event);
84
+ return event;
85
+ };
86
+
87
+ var updatePolyfill = function (el, full){
88
+ var polyfill;
89
+ if( !supportPicture && ( polyfill = (window.picturefill || lazySizesConfig.pf) ) ){
90
+ if(full && full.src && !el[_getAttribute]('srcset')){
91
+ el.setAttribute('srcset', full.src);
92
+ }
93
+ polyfill({reevaluate: true, elements: [el]});
94
+ } else if(full && full.src){
95
+ el.src = full.src;
96
+ }
97
+ };
98
+
99
+ var getCSS = function (elem, style){
100
+ return (getComputedStyle(elem, null) || {})[style];
101
+ };
102
+
103
+ var getWidth = function(elem, parent, width){
104
+ width = width || elem.offsetWidth;
105
+
106
+ while(width < lazySizesConfig.minSize && parent && !elem._lazysizesWidth){
107
+ width = parent.offsetWidth;
108
+ parent = parent.parentNode;
109
+ }
110
+
111
+ return width;
112
+ };
113
+
114
+ var rAF = (function(){
115
+ var running, waiting;
116
+ var firstFns = [];
117
+ var secondFns = [];
118
+ var fns = firstFns;
119
+
120
+ var run = function(){
121
+ var runFns = fns;
122
+
123
+ fns = firstFns.length ? secondFns : firstFns;
124
+
125
+ running = true;
126
+ waiting = false;
127
+
128
+ while(runFns.length){
129
+ runFns.shift()();
130
+ }
131
+
132
+ running = false;
133
+ };
134
+
135
+ var rafBatch = function(fn, queue){
136
+ if(running && !queue){
137
+ fn.apply(this, arguments);
138
+ } else {
139
+ fns.push(fn);
140
+
141
+ if(!waiting){
142
+ waiting = true;
143
+ (document.hidden ? setTimeout : requestAnimationFrame)(run);
144
+ }
145
+ }
146
+ };
147
+
148
+ rafBatch._lsFlush = run;
149
+
150
+ return rafBatch;
151
+ })();
152
+
153
+ var rAFIt = function(fn, simple){
154
+ return simple ?
155
+ function() {
156
+ rAF(fn);
157
+ } :
158
+ function(){
159
+ var that = this;
160
+ var args = arguments;
161
+ rAF(function(){
162
+ fn.apply(that, args);
163
+ });
164
+ }
165
+ ;
166
+ };
167
+
168
+ var throttle = function(fn){
169
+ var running;
170
+ var lastTime = 0;
171
+ var gDelay = lazySizesConfig.throttleDelay;
172
+ var rICTimeout = lazySizesConfig.ricTimeout;
173
+ var run = function(){
174
+ running = false;
175
+ lastTime = Date.now();
176
+ fn();
177
+ };
178
+ var idleCallback = requestIdleCallback && rICTimeout > 49 ?
179
+ function(){
180
+ requestIdleCallback(run, {timeout: rICTimeout});
181
+
182
+ if(rICTimeout !== lazySizesConfig.ricTimeout){
183
+ rICTimeout = lazySizesConfig.ricTimeout;
184
+ }
185
+ } :
186
+ rAFIt(function(){
187
+ setTimeout(run);
188
+ }, true)
189
+ ;
190
+
191
+ return function(isPriority){
192
+ var delay;
193
+
194
+ if((isPriority = isPriority === true)){
195
+ rICTimeout = 33;
196
+ }
197
+
198
+ if(running){
199
+ return;
200
+ }
201
+
202
+ running = true;
203
+
204
+ delay = gDelay - (Date.now() - lastTime);
205
+
206
+ if(delay < 0){
207
+ delay = 0;
208
+ }
209
+
210
+ if(isPriority || delay < 9){
211
+ idleCallback();
212
+ } else {
213
+ setTimeout(idleCallback, delay);
214
+ }
215
+ };
216
+ };
217
+
218
+ //based on http://modernjavascript.blogspot.de/2013/08/building-better-debounce.html
219
+ var debounce = function(func) {
220
+ var timeout, timestamp;
221
+ var wait = 99;
222
+ var run = function(){
223
+ timeout = null;
224
+ func();
225
+ };
226
+ var later = function() {
227
+ var last = Date.now() - timestamp;
228
+
229
+ if (last < wait) {
230
+ setTimeout(later, wait - last);
231
+ } else {
232
+ (requestIdleCallback || run)(run);
233
+ }
234
+ };
235
+
236
+ return function() {
237
+ timestamp = Date.now();
238
+
239
+ if (!timeout) {
240
+ timeout = setTimeout(later, wait);
241
+ }
242
+ };
243
+ };
244
+
245
+ (function(){
246
+ var prop;
247
+
248
+ var lazySizesDefaults = {
249
+ lazyClass: 'lazyload',
250
+ loadedClass: 'lazyloaded',
251
+ loadingClass: 'lazyloading',
252
+ preloadClass: 'lazypreload',
253
+ errorClass: 'lazyerror',
254
+ //strictClass: 'lazystrict',
255
+ autosizesClass: 'lazyautosizes',
256
+ srcAttr: 'data-src',
257
+ srcsetAttr: 'data-srcset',
258
+ sizesAttr: 'data-sizes',
259
+ //preloadAfterLoad: false,
260
+ minSize: 40,
261
+ customMedia: {},
262
+ init: true,
263
+ expFactor: 1.5,
264
+ hFac: 0.8,
265
+ loadMode: 2,
266
+ loadHidden: true,
267
+ ricTimeout: 0,
268
+ throttleDelay: 125,
269
+ };
270
+
271
+ lazySizesConfig = window.lazySizesConfig || window.lazysizesConfig || {};
272
+
273
+ for(prop in lazySizesDefaults){
274
+ if(!(prop in lazySizesConfig)){
275
+ lazySizesConfig[prop] = lazySizesDefaults[prop];
276
+ }
277
+ }
278
+
279
+ window.lazySizesConfig = lazySizesConfig;
280
+
281
+ setTimeout(function(){
282
+ if(lazySizesConfig.init){
283
+ init();
284
+ }
285
+ });
286
+ })();
287
+
288
+ var loader = (function(){
289
+ var preloadElems, isCompleted, resetPreloadingTimer, loadMode, started;
290
+
291
+ var eLvW, elvH, eLtop, eLleft, eLright, eLbottom, isBodyHidden;
292
+
293
+ var regImg = /^img$/i;
294
+ var regIframe = /^iframe$/i;
295
+
296
+ var supportScroll = ('onscroll' in window) && !(/(gle|ing)bot/.test(navigator.userAgent));
297
+
298
+ var shrinkExpand = 0;
299
+ var currentExpand = 0;
300
+
301
+ var isLoading = 0;
302
+ var lowRuns = -1;
303
+
304
+ var resetPreloading = function(e){
305
+ isLoading--;
306
+ if(!e || isLoading < 0 || !e.target){
307
+ isLoading = 0;
308
+ }
309
+ };
310
+
311
+ var isVisible = function (elem) {
312
+ if (isBodyHidden == null) {
313
+ isBodyHidden = getCSS(document.body, 'visibility') == 'hidden';
314
+ }
315
+
316
+ return isBodyHidden || (getCSS(elem.parentNode, 'visibility') != 'hidden' && getCSS(elem, 'visibility') != 'hidden');
317
+ };
318
+
319
+ var isNestedVisible = function(elem, elemExpand){
320
+ var outerRect;
321
+ var parent = elem;
322
+ var visible = isVisible(elem);
323
+
324
+ eLtop -= elemExpand;
325
+ eLbottom += elemExpand;
326
+ eLleft -= elemExpand;
327
+ eLright += elemExpand;
328
+
329
+ while(visible && (parent = parent.offsetParent) && parent != document.body && parent != docElem){
330
+ visible = ((getCSS(parent, 'opacity') || 1) > 0);
331
+
332
+ if(visible && getCSS(parent, 'overflow') != 'visible'){
333
+ outerRect = parent.getBoundingClientRect();
334
+ visible = eLright > outerRect.left &&
335
+ eLleft < outerRect.right &&
336
+ eLbottom > outerRect.top - 1 &&
337
+ eLtop < outerRect.bottom + 1
338
+ ;
339
+ }
340
+ }
341
+
342
+ return visible;
343
+ };
344
+
345
+ var checkElements = function() {
346
+ var eLlen, i, rect, autoLoadElem, loadedSomething, elemExpand, elemNegativeExpand, elemExpandVal,
347
+ beforeExpandVal, defaultExpand, preloadExpand, hFac;
348
+ var lazyloadElems = lazysizes.elements;
349
+
350
+ if((loadMode = lazySizesConfig.loadMode) && isLoading < 8 && (eLlen = lazyloadElems.length)){
351
+
352
+ i = 0;
353
+
354
+ lowRuns++;
355
+
356
+ defaultExpand = (!lazySizesConfig.expand || lazySizesConfig.expand < 1) ?
357
+ docElem.clientHeight > 500 && docElem.clientWidth > 500 ? 500 : 370 :
358
+ lazySizesConfig.expand;
359
+
360
+ lazysizes._defEx = defaultExpand;
361
+
362
+ preloadExpand = defaultExpand * lazySizesConfig.expFactor;
363
+ hFac = lazySizesConfig.hFac;
364
+ isBodyHidden = null;
365
+
366
+ if(currentExpand < preloadExpand && isLoading < 1 && lowRuns > 2 && loadMode > 2 && !document.hidden){
367
+ currentExpand = preloadExpand;
368
+ lowRuns = 0;
369
+ } else if(loadMode > 1 && lowRuns > 1 && isLoading < 6){
370
+ currentExpand = defaultExpand;
371
+ } else {
372
+ currentExpand = shrinkExpand;
373
+ }
374
+
375
+ for(; i < eLlen; i++){
376
+
377
+ if(!lazyloadElems[i] || lazyloadElems[i]._lazyRace){continue;}
378
+
379
+ if(!supportScroll){unveilElement(lazyloadElems[i]);continue;}
380
+
381
+ if(!(elemExpandVal = lazyloadElems[i][_getAttribute]('data-expand')) || !(elemExpand = elemExpandVal * 1)){
382
+ elemExpand = currentExpand;
383
+ }
384
+
385
+ if(beforeExpandVal !== elemExpand){
386
+ eLvW = innerWidth + (elemExpand * hFac);
387
+ elvH = innerHeight + elemExpand;
388
+ elemNegativeExpand = elemExpand * -1;
389
+ beforeExpandVal = elemExpand;
390
+ }
391
+
392
+ rect = lazyloadElems[i].getBoundingClientRect();
393
+
394
+ if ((eLbottom = rect.bottom) >= elemNegativeExpand &&
395
+ (eLtop = rect.top) <= elvH &&
396
+ (eLright = rect.right) >= elemNegativeExpand * hFac &&
397
+ (eLleft = rect.left) <= eLvW &&
398
+ (eLbottom || eLright || eLleft || eLtop) &&
399
+ (lazySizesConfig.loadHidden || isVisible(lazyloadElems[i])) &&
400
+ ((isCompleted && isLoading < 3 && !elemExpandVal && (loadMode < 3 || lowRuns < 4)) || isNestedVisible(lazyloadElems[i], elemExpand))){
401
+ unveilElement(lazyloadElems[i]);
402
+ loadedSomething = true;
403
+ if(isLoading > 9){break;}
404
+ } else if(!loadedSomething && isCompleted && !autoLoadElem &&
405
+ isLoading < 4 && lowRuns < 4 && loadMode > 2 &&
406
+ (preloadElems[0] || lazySizesConfig.preloadAfterLoad) &&
407
+ (preloadElems[0] || (!elemExpandVal && ((eLbottom || eLright || eLleft || eLtop) || lazyloadElems[i][_getAttribute](lazySizesConfig.sizesAttr) != 'auto')))){
408
+ autoLoadElem = preloadElems[0] || lazyloadElems[i];
409
+ }
410
+ }
411
+
412
+ if(autoLoadElem && !loadedSomething){
413
+ unveilElement(autoLoadElem);
414
+ }
415
+ }
416
+ };
417
+
418
+ var throttledCheckElements = throttle(checkElements);
419
+
420
+ var switchLoadingClass = function(e){
421
+ var elem = e.target;
422
+
423
+ if (elem._lazyCache) {
424
+ delete elem._lazyCache;
425
+ return;
426
+ }
427
+
428
+ resetPreloading(e);
429
+ addClass(elem, lazySizesConfig.loadedClass);
430
+ removeClass(elem, lazySizesConfig.loadingClass);
431
+ addRemoveLoadEvents(elem, rafSwitchLoadingClass);
432
+ triggerEvent(elem, 'lazyloaded');
433
+ };
434
+ var rafedSwitchLoadingClass = rAFIt(switchLoadingClass);
435
+ var rafSwitchLoadingClass = function(e){
436
+ rafedSwitchLoadingClass({target: e.target});
437
+ };
438
+
439
+ var changeIframeSrc = function(elem, src){
440
+ try {
441
+ elem.contentWindow.location.replace(src);
442
+ } catch(e){
443
+ elem.src = src;
444
+ }
445
+ };
446
+
447
+ var handleSources = function(source){
448
+ var customMedia;
449
+
450
+ var sourceSrcset = source[_getAttribute](lazySizesConfig.srcsetAttr);
451
+
452
+ if( (customMedia = lazySizesConfig.customMedia[source[_getAttribute]('data-media') || source[_getAttribute]('media')]) ){
453
+ source.setAttribute('media', customMedia);
454
+ }
455
+
456
+ if(sourceSrcset){
457
+ source.setAttribute('srcset', sourceSrcset);
458
+ }
459
+ };
460
+
461
+ var lazyUnveil = rAFIt(function (elem, detail, isAuto, sizes, isImg){
462
+ var src, srcset, parent, isPicture, event, firesLoad;
463
+
464
+ if(!(event = triggerEvent(elem, 'lazybeforeunveil', detail)).defaultPrevented){
465
+
466
+ if(sizes){
467
+ if(isAuto){
468
+ addClass(elem, lazySizesConfig.autosizesClass);
469
+ } else {
470
+ elem.setAttribute('sizes', sizes);
471
+ }
472
+ }
473
+
474
+ srcset = elem[_getAttribute](lazySizesConfig.srcsetAttr);
475
+ src = elem[_getAttribute](lazySizesConfig.srcAttr);
476
+
477
+ if(isImg) {
478
+ parent = elem.parentNode;
479
+ isPicture = parent && regPicture.test(parent.nodeName || '');
480
+ }
481
+
482
+ firesLoad = detail.firesLoad || (('src' in elem) && (srcset || src || isPicture));
483
+
484
+ event = {target: elem};
485
+
486
+ addClass(elem, lazySizesConfig.loadingClass);
487
+
488
+ if(firesLoad){
489
+ clearTimeout(resetPreloadingTimer);
490
+ resetPreloadingTimer = setTimeout(resetPreloading, 2500);
491
+ addRemoveLoadEvents(elem, rafSwitchLoadingClass, true);
492
+ }
493
+
494
+ if(isPicture){
495
+ forEach.call(parent.getElementsByTagName('source'), handleSources);
496
+ }
497
+
498
+ if(srcset){
499
+ elem.setAttribute('srcset', srcset);
500
+ } else if(src && !isPicture){
501
+ if(regIframe.test(elem.nodeName)){
502
+ changeIframeSrc(elem, src);
503
+ } else {
504
+ elem.src = src;
505
+ }
506
+ }
507
+
508
+ if(isImg && (srcset || isPicture)){
509
+ updatePolyfill(elem, {src: src});
510
+ }
511
+ }
512
+
513
+ if(elem._lazyRace){
514
+ delete elem._lazyRace;
515
+ }
516
+ removeClass(elem, lazySizesConfig.lazyClass);
517
+
518
+ rAF(function(){
519
+ // Part of this can be removed as soon as this fix is older: https://bugs.chromium.org/p/chromium/issues/detail?id=7731 (2015)
520
+ if( !firesLoad || (elem.complete && elem.naturalWidth > 1)){
521
+ switchLoadingClass(event);
522
+ elem._lazyCache = true;
523
+ setTimeout(function(){
524
+ if ('_lazyCache' in elem) {
525
+ delete elem._lazyCache;
526
+ }
527
+ }, 9);
528
+ }
529
+ }, true);
530
+ });
531
+
532
+ var unveilElement = function (elem){
533
+ var detail;
534
+
535
+ var isImg = regImg.test(elem.nodeName);
536
+
537
+ //allow using sizes="auto", but don't use. it's invalid. Use data-sizes="auto" or a valid value for sizes instead (i.e.: sizes="80vw")
538
+ var sizes = isImg && (elem[_getAttribute](lazySizesConfig.sizesAttr) || elem[_getAttribute]('sizes'));
539
+ var isAuto = sizes == 'auto';
540
+
541
+ if( (isAuto || !isCompleted) && isImg && (elem[_getAttribute]('src') || elem.srcset) && !elem.complete && !hasClass(elem, lazySizesConfig.errorClass) && hasClass(elem, lazySizesConfig.lazyClass)){return;}
542
+
543
+ detail = triggerEvent(elem, 'lazyunveilread').detail;
544
+
545
+ if(isAuto){
546
+ autoSizer.updateElem(elem, true, elem.offsetWidth);
547
+ }
548
+
549
+ elem._lazyRace = true;
550
+ isLoading++;
551
+
552
+ lazyUnveil(elem, detail, isAuto, sizes, isImg);
553
+ };
554
+
555
+ var onload = function(){
556
+ if(isCompleted){return;}
557
+ if(Date.now() - started < 999){
558
+ setTimeout(onload, 999);
559
+ return;
560
+ }
561
+ var afterScroll = debounce(function(){
562
+ lazySizesConfig.loadMode = 3;
563
+ throttledCheckElements();
564
+ });
565
+
566
+ isCompleted = true;
567
+
568
+ lazySizesConfig.loadMode = 3;
569
+
570
+ throttledCheckElements();
571
+
572
+ addEventListener('scroll', function(){
573
+ if(lazySizesConfig.loadMode == 3){
574
+ lazySizesConfig.loadMode = 2;
575
+ }
576
+ afterScroll();
577
+ }, true);
578
+ };
579
+
580
+ return {
581
+ _: function(){
582
+ started = Date.now();
583
+
584
+ lazysizes.elements = document.getElementsByClassName(lazySizesConfig.lazyClass);
585
+ preloadElems = document.getElementsByClassName(lazySizesConfig.lazyClass + ' ' + lazySizesConfig.preloadClass);
586
+
587
+ addEventListener('scroll', throttledCheckElements, true);
588
+
589
+ addEventListener('resize', throttledCheckElements, true);
590
+
591
+ if(window.MutationObserver){
592
+ new MutationObserver( throttledCheckElements ).observe( docElem, {childList: true, subtree: true, attributes: true} );
593
+ } else {
594
+ docElem[_addEventListener]('DOMNodeInserted', throttledCheckElements, true);
595
+ docElem[_addEventListener]('DOMAttrModified', throttledCheckElements, true);
596
+ setInterval(throttledCheckElements, 999);
597
+ }
598
+
599
+ addEventListener('hashchange', throttledCheckElements, true);
600
+
601
+ //, 'fullscreenchange'
602
+ ['focus', 'mouseover', 'click', 'load', 'transitionend', 'animationend', 'webkitAnimationEnd'].forEach(function(name){
603
+ document[_addEventListener](name, throttledCheckElements, true);
604
+ });
605
+
606
+ if((/d$|^c/.test(document.readyState))){
607
+ onload();
608
+ } else {
609
+ addEventListener('load', onload);
610
+ document[_addEventListener]('DOMContentLoaded', throttledCheckElements);
611
+ setTimeout(onload, 20000);
612
+ }
613
+
614
+ if(lazysizes.elements.length){
615
+ checkElements();
616
+ rAF._lsFlush();
617
+ } else {
618
+ throttledCheckElements();
619
+ }
620
+ },
621
+ checkElems: throttledCheckElements,
622
+ unveil: unveilElement
623
+ };
624
+ })();
625
+
626
+
627
+ var autoSizer = (function(){
628
+ var autosizesElems;
629
+
630
+ var sizeElement = rAFIt(function(elem, parent, event, width){
631
+ var sources, i, len;
632
+ elem._lazysizesWidth = width;
633
+ width += 'px';
634
+
635
+ elem.setAttribute('sizes', width);
636
+
637
+ if(regPicture.test(parent.nodeName || '')){
638
+ sources = parent.getElementsByTagName('source');
639
+ for(i = 0, len = sources.length; i < len; i++){
640
+ sources[i].setAttribute('sizes', width);
641
+ }
642
+ }
643
+
644
+ if(!event.detail.dataAttr){
645
+ updatePolyfill(elem, event.detail);
646
+ }
647
+ });
648
+ var getSizeElement = function (elem, dataAttr, width){
649
+ var event;
650
+ var parent = elem.parentNode;
651
+
652
+ if(parent){
653
+ width = getWidth(elem, parent, width);
654
+ event = triggerEvent(elem, 'lazybeforesizes', {width: width, dataAttr: !!dataAttr});
655
+
656
+ if(!event.defaultPrevented){
657
+ width = event.detail.width;
658
+
659
+ if(width && width !== elem._lazysizesWidth){
660
+ sizeElement(elem, parent, event, width);
661
+ }
662
+ }
663
+ }
664
+ };
665
+
666
+ var updateElementsSizes = function(){
667
+ var i;
668
+ var len = autosizesElems.length;
669
+ if(len){
670
+ i = 0;
671
+
672
+ for(; i < len; i++){
673
+ getSizeElement(autosizesElems[i]);
674
+ }
675
+ }
676
+ };
677
+
678
+ var debouncedUpdateElementsSizes = debounce(updateElementsSizes);
679
+
680
+ return {
681
+ _: function(){
682
+ autosizesElems = document.getElementsByClassName(lazySizesConfig.autosizesClass);
683
+ addEventListener('resize', debouncedUpdateElementsSizes);
684
+ },
685
+ checkElems: debouncedUpdateElementsSizes,
686
+ updateElem: getSizeElement
687
+ };
688
+ })();
689
+
690
+ var init = function(){
691
+ if(!init.i){
692
+ init.i = true;
693
+ autoSizer._();
694
+ loader._();
695
+ }
696
+ };
697
+
698
+ lazysizes = {
699
+ cfg: lazySizesConfig,
700
+ autoSizer: autoSizer,
701
+ loader: loader,
702
+ init: init,
703
+ uP: updatePolyfill,
704
+ aC: addClass,
705
+ rC: removeClass,
706
+ hC: hasClass,
707
+ fire: triggerEvent,
708
+ gW: getWidth,
709
+ rAF: rAF,
710
+ };
711
+
712
+ return lazysizes;
713
+ }
714
+ ));
assets/js/lazysizes.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e,t){var n=function(o,L){"use strict";if(!L.getElementsByClassName)return;var R,k,D=L.documentElement,l=o.Date,a=o.HTMLPictureElement,c="addEventListener",H="getAttribute",d=o[c],O=o.setTimeout,u=o.requestAnimationFrame||O,P=o.requestIdleCallback,$=/^picture$/i,i=["load","error","lazyincluded","_lazyloaded"],n={},I=Array.prototype.forEach,q=function(e,t){return n[t]||(n[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),n[t].test(e[H]("class")||"")&&n[t]},j=function(e,t){q(e,t)||e.setAttribute("class",(e[H]("class")||"").trim()+" "+t)},G=function(e,t){var n;(n=q(e,t))&&e.setAttribute("class",(e[H]("class")||"").replace(n," "))},J=function(t,n,e){var a=e?c:"removeEventListener";e&&J(t,n),i.forEach(function(e){t[a](e,n)})},K=function(e,t,n,a,i){var r=L.createEvent("Event");return n||(n={}),n.instance=R,r.initEvent(t,!a,!i),r.detail=n,e.dispatchEvent(r),r},Q=function(e,t){var n;!a&&(n=o.picturefill||k.pf)?(t&&t.src&&!e[H]("srcset")&&e.setAttribute("srcset",t.src),n({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)},U=function(e,t){return(getComputedStyle(e,null)||{})[t]},s=function(e,t,n){for(n=n||e.offsetWidth;n<k.minSize&&t&&!e._lazysizesWidth;)n=t.offsetWidth,t=t.parentNode;return n},V=function(){var n,a,t=[],i=[],r=t,s=function(){var e=r;for(r=t.length?i:t,a=!(n=!0);e.length;)e.shift()();n=!1},e=function(e,t){n&&!t?e.apply(this,arguments):(r.push(e),a||(a=!0,(L.hidden?O:u)(s)))};return e._lsFlush=s,e}(),X=function(n,e){return e?function(){V(n)}:function(){var e=this,t=arguments;V(function(){n.apply(e,t)})}},Y=function(e){var t,n,a=function(){t=null,e()},i=function(){var e=l.now()-n;e<99?O(i,99-e):(P||a)(a)};return function(){n=l.now(),t||(t=O(i,99))}};!function(){var e,t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(e in k=o.lazySizesConfig||o.lazysizesConfig||{},t)e in k||(k[e]=t[e]);o.lazySizesConfig=k,O(function(){k.init&&r()})}();var e=function(){var m,z,u,y,t,h,v,g,p,C,b,A,r=/^img$/i,f=/^iframe$/i,E="onscroll"in o&&!/(gle|ing)bot/.test(navigator.userAgent),_=0,w=0,M=-1,N=function(e){w--,(!e||w<0||!e.target)&&(w=0)},x=function(e){return null==A&&(A="hidden"==U(L.body,"visibility")),A||"hidden"!=U(e.parentNode,"visibility")&&"hidden"!=U(e,"visibility")},W=function(e,t){var n,a=e,i=x(e);for(g-=t,b+=t,p-=t,C+=t;i&&(a=a.offsetParent)&&a!=L.body&&a!=D;)(i=0<(U(a,"opacity")||1))&&"visible"!=U(a,"overflow")&&(n=a.getBoundingClientRect(),i=C>n.left&&p<n.right&&b>n.top-1&&g<n.bottom+1);return i},e=function(){var e,t,n,a,i,r,s,o,l,c,d,u,f=R.elements;if((y=k.loadMode)&&w<8&&(e=f.length)){for(t=0,M++,c=!k.expand||k.expand<1?500<D.clientHeight&&500<D.clientWidth?500:370:k.expand,R._defEx=c,d=c*k.expFactor,u=k.hFac,A=null,_<d&&w<1&&2<M&&2<y&&!L.hidden?(_=d,M=0):_=1<y&&1<M&&w<6?c:0;t<e;t++)if(f[t]&&!f[t]._lazyRace)if(E)if((o=f[t][H]("data-expand"))&&(r=1*o)||(r=_),l!==r&&(h=innerWidth+r*u,v=innerHeight+r,s=-1*r,l=r),n=f[t].getBoundingClientRect(),(b=n.bottom)>=s&&(g=n.top)<=v&&(C=n.right)>=s*u&&(p=n.left)<=h&&(b||C||p||g)&&(k.loadHidden||x(f[t]))&&(z&&w<3&&!o&&(y<3||M<4)||W(f[t],r))){if(S(f[t]),i=!0,9<w)break}else!i&&z&&!a&&w<4&&M<4&&2<y&&(m[0]||k.preloadAfterLoad)&&(m[0]||!o&&(b||C||p||g||"auto"!=f[t][H](k.sizesAttr)))&&(a=m[0]||f[t]);else S(f[t]);a&&!i&&S(a)}},n=function(e){var n,a=0,i=k.throttleDelay,r=k.ricTimeout,t=function(){n=!1,a=l.now(),e()},s=P&&49<r?function(){P(t,{timeout:r}),r!==k.ricTimeout&&(r=k.ricTimeout)}:X(function(){O(t)},!0);return function(e){var t;(e=!0===e)&&(r=33),n||(n=!0,(t=i-(l.now()-a))<0&&(t=0),e||t<9?s():O(s,t))}}(e),T=function(e){var t=e.target;t._lazyCache?delete t._lazyCache:(N(e),j(t,k.loadedClass),G(t,k.loadingClass),J(t,B),K(t,"lazyloaded"))},a=X(T),B=function(e){a({target:e.target})},F=function(e){var t,n=e[H](k.srcsetAttr);(t=k.customMedia[e[H]("data-media")||e[H]("media")])&&e.setAttribute("media",t),n&&e.setAttribute("srcset",n)},s=X(function(e,t,n,a,i){var r,s,o,l,c,d;(c=K(e,"lazybeforeunveil",t)).defaultPrevented||(a&&(n?j(e,k.autosizesClass):e.setAttribute("sizes",a)),s=e[H](k.srcsetAttr),r=e[H](k.srcAttr),i&&(o=e.parentNode,l=o&&$.test(o.nodeName||"")),d=t.firesLoad||"src"in e&&(s||r||l),c={target:e},j(e,k.loadingClass),d&&(clearTimeout(u),u=O(N,2500),J(e,B,!0)),l&&I.call(o.getElementsByTagName("source"),F),s?e.setAttribute("srcset",s):r&&!l&&(f.test(e.nodeName)?function(t,n){try{t.contentWindow.location.replace(n)}catch(e){t.src=n}}(e,r):e.src=r),i&&(s||l)&&Q(e,{src:r})),e._lazyRace&&delete e._lazyRace,G(e,k.lazyClass),V(function(){(!d||e.complete&&1<e.naturalWidth)&&(T(c),e._lazyCache=!0,O(function(){"_lazyCache"in e&&delete e._lazyCache},9))},!0)}),S=function(e){var t,n=r.test(e.nodeName),a=n&&(e[H](k.sizesAttr)||e[H]("sizes")),i="auto"==a;(!i&&z||!n||!e[H]("src")&&!e.srcset||e.complete||q(e,k.errorClass)||!q(e,k.lazyClass))&&(t=K(e,"lazyunveilread").detail,i&&Z.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,w++,s(e,t,i,a,n))},i=function(){if(!z)if(l.now()-t<999)O(i,999);else{var e=Y(function(){k.loadMode=3,n()});z=!0,k.loadMode=3,n(),d("scroll",function(){3==k.loadMode&&(k.loadMode=2),e()},!0)}};return{_:function(){t=l.now(),R.elements=L.getElementsByClassName(k.lazyClass),m=L.getElementsByClassName(k.lazyClass+" "+k.preloadClass),d("scroll",n,!0),d("resize",n,!0),o.MutationObserver?new MutationObserver(n).observe(D,{childList:!0,subtree:!0,attributes:!0}):(D[c]("DOMNodeInserted",n,!0),D[c]("DOMAttrModified",n,!0),setInterval(n,999)),d("hashchange",n,!0),["focus","mouseover","click","load","transitionend","animationend","webkitAnimationEnd"].forEach(function(e){L[c](e,n,!0)}),/d$|^c/.test(L.readyState)?i():(d("load",i),L[c]("DOMContentLoaded",n),O(i,2e4)),R.elements.length?(e(),V._lsFlush()):n()},checkElems:n,unveil:S}}(),Z=function(){var n,r=X(function(e,t,n,a){var i,r,s;if(e._lazysizesWidth=a,a+="px",e.setAttribute("sizes",a),$.test(t.nodeName||""))for(i=t.getElementsByTagName("source"),r=0,s=i.length;r<s;r++)i[r].setAttribute("sizes",a);n.detail.dataAttr||Q(e,n.detail)}),a=function(e,t,n){var a,i=e.parentNode;i&&(n=s(e,i,n),(a=K(e,"lazybeforesizes",{width:n,dataAttr:!!t})).defaultPrevented||(n=a.detail.width)&&n!==e._lazysizesWidth&&r(e,i,a,n))},e=Y(function(){var e,t=n.length;if(t)for(e=0;e<t;e++)a(n[e])});return{_:function(){n=L.getElementsByClassName(k.autosizesClass),d("resize",e)},checkElems:e,updateElem:a}}(),r=function(){r.i||(r.i=!0,Z._(),e._())};return R={cfg:k,autoSizer:Z,loader:e,init:r,uP:Q,aC:j,rC:G,hC:q,fire:K,gW:s,rAF:V}}(e,e.document);e.lazySizes=n,"object"==typeof module&&module.exports&&(module.exports=n)}(window);
assets/js/packery.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,i){"use strict";"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(t){i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("jquery")):e.jQueryBridget=i(e,e.jQuery)}(window,function(t,e){"use strict";var d=Array.prototype.slice,i=t.console,l=void 0===i?function(){}:function(t){i.error(t)};function n(u,o,c){(c=c||e||t.jQuery)&&(o.prototype.option||(o.prototype.option=function(t){c.isPlainObject(t)&&(this.options=c.extend(!0,this.options,t))}),c.fn[u]=function(t){if("string"!=typeof t)return n=t,this.each(function(t,e){var i=c.data(e,u);i?(i.option(n),i._init()):(i=new o(e,n),c.data(e,u,i))}),this;var e,s,r,a,h,n,i=d.call(arguments,1);return r=i,h="$()."+u+'("'+(s=t)+'")',(e=this).each(function(t,e){var i=c.data(e,u);if(i){var n=i[s];if(n&&"_"!=s.charAt(0)){var o=n.apply(i,r);a=void 0===a?o:a}else l(h+" is not a valid method")}else l(u+" not initialized. Cannot call methods, i.e. "+h)}),void 0!==a?a:e},s(c))}function s(t){!t||t&&t.bridget||(t.bridget=n)}return s(e||t.jQuery),n}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function y(t){var e=parseFloat(t);return-1==t.indexOf("%")&&!isNaN(e)&&e}var i="undefined"==typeof console?function(){}:function(t){console.error(t)},v=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],_=v.length;function x(t){var e=getComputedStyle(t);return e||i("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}var b,E=!1;function T(t){if(function(){if(!E){E=!0;var t=document.createElement("div");t.style.width="200px",t.style.padding="1px 2px 3px 4px",t.style.borderStyle="solid",t.style.borderWidth="1px 2px 3px 4px",t.style.boxSizing="border-box";var e=document.body||document.documentElement;e.appendChild(t);var i=x(t);T.isBoxSizeOuter=b=200==y(i.width),e.removeChild(t)}}(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var e=x(t);if("none"==e.display)return function(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<_;e++)t[v[e]]=0;return t}();var i={};i.width=t.offsetWidth,i.height=t.offsetHeight;for(var n=i.isBorderBox="border-box"==e.boxSizing,o=0;o<_;o++){var s=v[o],r=e[s],a=parseFloat(r);i[s]=isNaN(a)?0:a}var h=i.paddingLeft+i.paddingRight,u=i.paddingTop+i.paddingBottom,c=i.marginLeft+i.marginRight,d=i.marginTop+i.marginBottom,l=i.borderLeftWidth+i.borderRightWidth,f=i.borderTopWidth+i.borderBottomWidth,p=n&&b,g=y(e.width);!1!==g&&(i.width=g+(p?0:h+l));var m=y(e.height);return!1!==m&&(i.height=m+(p?0:u+f)),i.innerWidth=i.width-(h+l),i.innerHeight=i.height-(u+f),i.outerWidth=i.width+c,i.outerHeight=i.height+d,i}}return T}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}(this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var s=this._onceEvents&&this._onceEvents[t];o;){var r=s&&s[o];r&&(this.off(t,o),delete s[o]),o.apply(this,e),o=i[n+=r?0:1]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var i=function(){var t=Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var n=e[i]+"MatchesSelector";if(t[n])return n}}();return function(t,e){return t[i](e)}}),function(e,i){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(t){return i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("desandro-matches-selector")):e.fizzyUIUtils=i(e,e.matchesSelector)}(window,function(u,s){var c={extend:function(t,e){for(var i in e)t[i]=e[i];return t},modulo:function(t,e){return(t%e+e)%e},makeArray:function(t){var e=[];if(Array.isArray(t))e=t;else if(t&&"number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e},removeFrom:function(t,e){var i=t.indexOf(e);-1!=i&&t.splice(i,1)},getParent:function(t,e){for(;t!=document.body;)if(t=t.parentNode,s(t,e))return t},getQueryElement:function(t){return"string"==typeof t?document.querySelector(t):t},handleEvent:function(t){var e="on"+t.type;this[e]&&this[e](t)},filterFindElements:function(t,n){t=c.makeArray(t);var o=[];return t.forEach(function(t){if(t instanceof HTMLElement)if(n){s(t,n)&&o.push(t);for(var e=t.querySelectorAll(n),i=0;i<e.length;i++)o.push(e[i])}else o.push(t)}),o},debounceMethod:function(t,e,n){var o=t.prototype[e],s=e+"Timeout";t.prototype[e]=function(){var t=this[s];t&&clearTimeout(t);var e=arguments,i=this;this[s]=setTimeout(function(){o.apply(i,e),delete i[s]},n||100)}},docReady:function(t){"complete"==document.readyState?t():document.addEventListener("DOMContentLoaded",t)},toDashed:function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()}},d=u.console;return c.htmlInit=function(a,h){c.docReady(function(){var t=c.toDashed(h),o="data-"+t,e=document.querySelectorAll("["+o+"]"),i=document.querySelectorAll(".js-"+t),n=c.makeArray(e).concat(c.makeArray(i)),s=o+"-options",r=u.jQuery;n.forEach(function(e){var t,i=e.getAttribute(o)||e.getAttribute(s);try{t=i&&JSON.parse(i)}catch(t){return void(d&&d.error("Error parsing "+o+" on "+e.className+": "+t))}var n=new a(e,t);r&&r.data(e,h,n)})})},c}),function(t,e){"function"==typeof define&&define.amd?define("outlayer/item",["ev-emitter/ev-emitter","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("ev-emitter"),require("get-size")):(t.Outlayer={},t.Outlayer.Item=e(t.EvEmitter,t.getSize))}(window,function(t,e){"use strict";var i=document.documentElement.style,n="string"==typeof i.transition?"transition":"WebkitTransition",o="string"==typeof i.transform?"transform":"WebkitTransform",s={WebkitTransition:"webkitTransitionEnd",transition:"transitionend"}[n],r={transform:o,transition:n,transitionDuration:n+"Duration",transitionProperty:n+"Property",transitionDelay:n+"Delay"};function a(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}var h=a.prototype=Object.create(t.prototype);h.constructor=a,h._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},h.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},h.getSize=function(){this.size=e(this.element)},h.css=function(t){var e=this.element.style;for(var i in t){e[r[i]||i]=t[i]}},h.getPosition=function(){var t=getComputedStyle(this.element),e=this.layout._getOption("originLeft"),i=this.layout._getOption("originTop"),n=t[e?"left":"right"],o=t[i?"top":"bottom"],s=this.layout.size,r=-1!=n.indexOf("%")?parseFloat(n)/100*s.width:parseInt(n,10),a=-1!=o.indexOf("%")?parseFloat(o)/100*s.height:parseInt(o,10);r=isNaN(r)?0:r,a=isNaN(a)?0:a,r-=e?s.paddingLeft:s.paddingRight,a-=i?s.paddingTop:s.paddingBottom,this.position.x=r,this.position.y=a},h.layoutPosition=function(){var t=this.layout.size,e={},i=this.layout._getOption("originLeft"),n=this.layout._getOption("originTop"),o=i?"paddingLeft":"paddingRight",s=i?"left":"right",r=i?"right":"left",a=this.position.x+t[o];e[s]=this.getXValue(a),e[r]="";var h=n?"paddingTop":"paddingBottom",u=n?"top":"bottom",c=n?"bottom":"top",d=this.position.y+t[h];e[u]=this.getYValue(d),e[c]="",this.css(e),this.emitEvent("layout",[this])},h.getXValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&!e?t/this.layout.size.width*100+"%":t+"px"},h.getYValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&e?t/this.layout.size.height*100+"%":t+"px"},h._transitionTo=function(t,e){this.getPosition();var i=this.position.x,n=this.position.y,o=parseInt(t,10),s=parseInt(e,10),r=o===this.position.x&&s===this.position.y;if(this.setPosition(t,e),!r||this.isTransitioning){var a=t-i,h=e-n,u={};u.transform=this.getTranslate(a,h),this.transition({to:u,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})}else this.layoutPosition()},h.getTranslate=function(t,e){return"translate3d("+(t=this.layout._getOption("originLeft")?t:-t)+"px, "+(e=this.layout._getOption("originTop")?e:-e)+"px, 0)"},h.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},h.moveTo=h._transitionTo,h.setPosition=function(t,e){this.position.x=parseInt(t,10),this.position.y=parseInt(e,10)},h._nonTransition=function(t){for(var e in this.css(t.to),t.isCleaning&&this._removeStyles(t.to),t.onTransitionEnd)t.onTransitionEnd[e].call(this)},h.transition=function(t){if(parseFloat(this.layout.options.transitionDuration)){var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&&(e.clean[i]=!0);if(t.from){this.css(t.from);this.element.offsetHeight;null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0}else this._nonTransition(t)};var u="opacity,"+o.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()});h.enableTransition=function(){if(!this.isTransitioning){var t=this.layout.options.transitionDuration;t="number"==typeof t?t+"ms":t,this.css({transitionProperty:u,transitionDuration:t,transitionDelay:this.staggerDelay||0}),this.element.addEventListener(s,this,!1)}},h.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},h.onotransitionend=function(t){this.ontransitionend(t)};var c={"-webkit-transform":"transform"};h.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,i=c[t.propertyName]||t.propertyName;if(delete e.ingProperties[i],function(t){for(var e in t)return!1;return!0}(e.ingProperties)&&this.disableTransition(),i in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[i]),i in e.onEnd)e.onEnd[i].call(this),delete e.onEnd[i];this.emitEvent("transitionEnd",[this])}},h.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(s,this,!1),this.isTransitioning=!1},h._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var d={transitionProperty:"",transitionDuration:"",transitionDelay:""};return h.removeTransitionStyles=function(){this.css(d)},h.stagger=function(t){t=isNaN(t)?0:t,this.staggerDelay=t+"ms"},h.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},h.remove=function(){n&&parseFloat(this.layout.options.transitionDuration)?(this.once("transitionEnd",function(){this.removeElem()}),this.hide()):this.removeElem()},h.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options,e={};e[this.getHideRevealTransitionEndProperty("visibleStyle")]=this.onRevealTransitionEnd,this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0,onTransitionEnd:e})},h.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},h.getHideRevealTransitionEndProperty=function(t){var e=this.layout.options[t];if(e.opacity)return"opacity";for(var i in e)return i},h.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options,e={};e[this.getHideRevealTransitionEndProperty("hiddenStyle")]=this.onHideTransitionEnd,this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:e})},h.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},h.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},a}),function(o,s){"use strict";"function"==typeof define&&define.amd?define("outlayer/outlayer",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(t,e,i,n){return s(o,t,e,i,n)}):"object"==typeof module&&module.exports?module.exports=s(o,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):o.Outlayer=s(o,o.EvEmitter,o.getSize,o.fizzyUIUtils,o.Outlayer.Item)}(window,function(t,e,o,s,n){"use strict";var r=t.console,a=t.jQuery,i=function(){},h=0,u={};function c(t,e){var i=s.getQueryElement(t);if(i){this.element=i,a&&(this.$element=a(this.element)),this.options=s.extend({},this.constructor.defaults),this.option(e);var n=++h;this.element.outlayerGUID=n,(u[n]=this)._create(),this._getOption("initLayout")&&this.layout()}else r&&r.error("Bad element for "+this.constructor.namespace+": "+(i||t))}c.namespace="outlayer",c.Item=n,c.defaults={containerStyle:{position:"relative"},initLayout:!0,originLeft:!0,originTop:!0,resize:!0,resizeContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}};var d=c.prototype;function l(t){function e(){t.apply(this,arguments)}return(e.prototype=Object.create(t.prototype)).constructor=e}s.extend(d,e.prototype),d.option=function(t){s.extend(this.options,t)},d._getOption=function(t){var e=this.constructor.compatOptions[t];return e&&void 0!==this.options[e]?this.options[e]:this.options[t]},c.compatOptions={initLayout:"isInitLayout",horizontal:"isHorizontal",layoutInstant:"isLayoutInstant",originLeft:"isOriginLeft",originTop:"isOriginTop",resize:"isResizeBound",resizeContainer:"isResizingContainer"},d._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),s.extend(this.element.style,this.options.containerStyle),this._getOption("resize")&&this.bindResize()},d.reloadItems=function(){this.items=this._itemize(this.element.children)},d._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,n=[],o=0;o<e.length;o++){var s=new i(e[o],this);n.push(s)}return n},d._filterFindItemElements=function(t){return s.filterFindElements(t,this.options.itemSelector)},d.getItemElements=function(){return this.items.map(function(t){return t.element})},d.layout=function(){this._resetLayout(),this._manageStamps();var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;this.layoutItems(this.items,e),this._isLayoutInited=!0},d._init=d.layout,d._resetLayout=function(){this.getSize()},d.getSize=function(){this.size=o(this.element)},d._getMeasurement=function(t,e){var i,n=this.options[t];this[t]=n?("string"==typeof n?i=this.element.querySelector(n):n instanceof HTMLElement&&(i=n),i?o(i)[e]:n):0},d.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},d._getItemsForLayout=function(t){return t.filter(function(t){return!t.isIgnored})},d._layoutItems=function(t,i){if(this._emitCompleteOnItems("layout",t),t&&t.length){var n=[];t.forEach(function(t){var e=this._getItemLayoutPosition(t);e.item=t,e.isInstant=i||t.isLayoutInstant,n.push(e)},this),this._processLayoutQueue(n)}},d._getItemLayoutPosition=function(){return{x:0,y:0}},d._processLayoutQueue=function(t){this.updateStagger(),t.forEach(function(t,e){this._positionItem(t.item,t.x,t.y,t.isInstant,e)},this)},d.updateStagger=function(){var t=this.options.stagger;if(null!=t)return this.stagger=function(t){if("number"==typeof t)return t;var e=t.match(/(^\d*\.?\d*)(\w*)/),i=e&&e[1],n=e&&e[2];if(!i.length)return 0;i=parseFloat(i);var o=f[n]||1;return i*o}(t),this.stagger;this.stagger=0},d._positionItem=function(t,e,i,n,o){n?t.goTo(e,i):(t.stagger(o*this.stagger),t.moveTo(e,i))},d._postLayout=function(){this.resizeContainer()},d.resizeContainer=function(){if(this._getOption("resizeContainer")){var t=this._getContainerSize();t&&(this._setContainerMeasure(t.width,!0),this._setContainerMeasure(t.height,!1))}},d._getContainerSize=i,d._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&&(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},d._emitCompleteOnItems=function(e,t){var i=this;function n(){i.dispatchEvent(e+"Complete",null,[t])}var o=t.length;if(t&&o){var s=0;t.forEach(function(t){t.once(e,r)})}else n();function r(){++s==o&&n()}},d.dispatchEvent=function(t,e,i){var n=e?[e].concat(i):i;if(this.emitEvent(t,n),a)if(this.$element=this.$element||a(this.element),e){var o=a.Event(e);o.type=t,this.$element.trigger(o,i)}else this.$element.trigger(t,i)},d.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},d.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},d.stamp=function(t){(t=this._find(t))&&(this.stamps=this.stamps.concat(t),t.forEach(this.ignore,this))},d.unstamp=function(t){(t=this._find(t))&&t.forEach(function(t){s.removeFrom(this.stamps,t),this.unignore(t)},this)},d._find=function(t){if(t)return"string"==typeof t&&(t=this.element.querySelectorAll(t)),t=s.makeArray(t)},d._manageStamps=function(){this.stamps&&this.stamps.length&&(this._getBoundingRect(),this.stamps.forEach(this._manageStamp,this))},d._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},d._manageStamp=i,d._getElementOffset=function(t){var e=t.getBoundingClientRect(),i=this._boundingRect,n=o(t);return{left:e.left-i.left-n.marginLeft,top:e.top-i.top-n.marginTop,right:i.right-e.right-n.marginRight,bottom:i.bottom-e.bottom-n.marginBottom}},d.handleEvent=s.handleEvent,d.bindResize=function(){t.addEventListener("resize",this),this.isResizeBound=!0},d.unbindResize=function(){t.removeEventListener("resize",this),this.isResizeBound=!1},d.onresize=function(){this.resize()},s.debounceMethod(c,"onresize",100),d.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},d.needsResizeLayout=function(){var t=o(this.element);return this.size&&t&&t.innerWidth!==this.size.innerWidth},d.addItems=function(t){var e=this._itemize(t);return e.length&&(this.items=this.items.concat(e)),e},d.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},d.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},d.reveal=function(t){if(this._emitCompleteOnItems("reveal",t),t&&t.length){var i=this.updateStagger();t.forEach(function(t,e){t.stagger(e*i),t.reveal()})}},d.hide=function(t){if(this._emitCompleteOnItems("hide",t),t&&t.length){var i=this.updateStagger();t.forEach(function(t,e){t.stagger(e*i),t.hide()})}},d.revealItemElements=function(t){var e=this.getItems(t);this.reveal(e)},d.hideItemElements=function(t){var e=this.getItems(t);this.hide(e)},d.getItem=function(t){for(var e=0;e<this.items.length;e++){var i=this.items[e];if(i.element==t)return i}},d.getItems=function(t){t=s.makeArray(t);var i=[];return t.forEach(function(t){var e=this.getItem(t);e&&i.push(e)},this),i},d.remove=function(t){var e=this.getItems(t);this._emitCompleteOnItems("remove",e),e&&e.length&&e.forEach(function(t){t.remove(),s.removeFrom(this.items,t)},this)},d.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="",this.items.forEach(function(t){t.destroy()}),this.unbindResize();var e=this.element.outlayerGUID;delete u[e],delete this.element.outlayerGUID,a&&a.removeData(this.element,this.constructor.namespace)},c.data=function(t){var e=(t=s.getQueryElement(t))&&t.outlayerGUID;return e&&u[e]},c.create=function(t,e){var i=l(c);return i.defaults=s.extend({},c.defaults),s.extend(i.defaults,e),i.compatOptions=s.extend({},c.compatOptions),i.namespace=t,i.data=c.data,i.Item=l(n),s.htmlInit(i,t),a&&a.bridget&&a.bridget(t,i),i};var f={ms:1,s:1e3};return c.Item=n,c}),function(t,e){"function"==typeof define&&define.amd?define("packery/js/rect",e):"object"==typeof module&&module.exports?module.exports=e():(t.Packery=t.Packery||{},t.Packery.Rect=e())}(window,function(){"use strict";function a(t){for(var e in a.defaults)this[e]=a.defaults[e];for(e in t)this[e]=t[e]}a.defaults={x:0,y:0,width:0,height:0};var t=a.prototype;return t.contains=function(t){var e=t.width||0,i=t.height||0;return this.x<=t.x&&this.y<=t.y&&this.x+this.width>=t.x+e&&this.y+this.height>=t.y+i},t.overlaps=function(t){var e=this.x+this.width,i=this.y+this.height,n=t.x+t.width,o=t.y+t.height;return this.x<n&&e>t.x&&this.y<o&&i>t.y},t.getMaximalFreeRects=function(t){if(!this.overlaps(t))return!1;var e,i=[],n=this.x+this.width,o=this.y+this.height,s=t.x+t.width,r=t.y+t.height;return this.y<t.y&&(e=new a({x:this.x,y:this.y,width:this.width,height:t.y-this.y}),i.push(e)),s<n&&(e=new a({x:s,y:this.y,width:n-s,height:this.height}),i.push(e)),r<o&&(e=new a({x:this.x,y:r,width:this.width,height:o-r}),i.push(e)),this.x<t.x&&(e=new a({x:this.x,y:this.y,width:t.x-this.x,height:this.height}),i.push(e)),i},t.canFit=function(t){return this.width>=t.width&&this.height>=t.height},a}),function(t,e){if("function"==typeof define&&define.amd)define("packery/js/packer",["./rect"],e);else if("object"==typeof module&&module.exports)module.exports=e(require("./rect"));else{var i=t.Packery=t.Packery||{};i.Packer=e(i.Rect)}}(window,function(e){"use strict";function t(t,e,i){this.width=t||0,this.height=e||0,this.sortDirection=i||"downwardLeftToRight",this.reset()}var i=t.prototype;i.reset=function(){this.spaces=[];var t=new e({x:0,y:0,width:this.width,height:this.height});this.spaces.push(t),this.sorter=n[this.sortDirection]||n.downwardLeftToRight},i.pack=function(t){for(var e=0;e<this.spaces.length;e++){var i=this.spaces[e];if(i.canFit(t)){this.placeInSpace(t,i);break}}},i.columnPack=function(t){for(var e=0;e<this.spaces.length;e++){var i=this.spaces[e];if(i.x<=t.x&&i.x+i.width>=t.x+t.width&&i.height>=t.height-.01){t.y=i.y,this.placed(t);break}}},i.rowPack=function(t){for(var e=0;e<this.spaces.length;e++){var i=this.spaces[e];if(i.y<=t.y&&i.y+i.height>=t.y+t.height&&i.width>=t.width-.01){t.x=i.x,this.placed(t);break}}},i.placeInSpace=function(t,e){t.x=e.x,t.y=e.y,this.placed(t)},i.placed=function(t){for(var e=[],i=0;i<this.spaces.length;i++){var n=this.spaces[i],o=n.getMaximalFreeRects(t);o?e.push.apply(e,o):e.push(n)}this.spaces=e,this.mergeSortSpaces()},i.mergeSortSpaces=function(){t.mergeRects(this.spaces),this.spaces.sort(this.sorter)},i.addSpace=function(t){this.spaces.push(t),this.mergeSortSpaces()},t.mergeRects=function(t){var e=0,i=t[e];t:for(;i;){for(var n=0,o=t[e+n];o;){if(o==i)n++;else{if(o.contains(i)){t.splice(e,1),i=t[e];continue t}i.contains(o)?t.splice(e+n,1):n++}o=t[e+n]}i=t[++e]}return t};var n={downwardLeftToRight:function(t,e){return t.y-e.y||t.x-e.x},rightwardTopToBottom:function(t,e){return t.x-e.x||t.y-e.y}};return t}),function(t,e){"function"==typeof define&&define.amd?define("packery/js/item",["outlayer/outlayer","./rect"],e):"object"==typeof module&&module.exports?module.exports=e(require("outlayer"),require("./rect")):t.Packery.Item=e(t.Outlayer,t.Packery.Rect)}(window,function(t,e){"use strict";var i="string"==typeof document.documentElement.style.transform?"transform":"WebkitTransform",n=function(){t.Item.apply(this,arguments)},o=n.prototype=Object.create(t.Item.prototype),s=o._create;o._create=function(){s.call(this),this.rect=new e};var r=o.moveTo;return o.moveTo=function(t,e){var i=Math.abs(this.position.x-t),n=Math.abs(this.position.y-e);this.layout.dragItemCount&&!this.isPlacing&&!this.isTransitioning&&i<1&&n<1?this.goTo(t,e):r.apply(this,arguments)},o.enablePlacing=function(){this.removeTransitionStyles(),this.isTransitioning&&i&&(this.element.style[i]="none"),this.isTransitioning=!1,this.getSize(),this.layout._setRectSize(this.element,this.rect),this.isPlacing=!0},o.disablePlacing=function(){this.isPlacing=!1},o.removeElem=function(){this.element.parentNode.removeChild(this.element),this.layout.packer.addSpace(this.rect),this.emitEvent("remove",[this])},o.showDropPlaceholder=function(){var t=this.dropPlaceholder;t||((t=this.dropPlaceholder=document.createElement("div")).className="packery-drop-placeholder",t.style.position="absolute"),t.style.width=this.size.width+"px",t.style.height=this.size.height+"px",this.positionDropPlaceholder(),this.layout.element.appendChild(t)},o.positionDropPlaceholder=function(){this.dropPlaceholder.style[i]="translate("+this.rect.x+"px, "+this.rect.y+"px)"},o.hideDropPlaceholder=function(){var t=this.dropPlaceholder.parentNode;t&&t.removeChild(this.dropPlaceholder)},n}),function(t,e){"function"==typeof define&&define.amd?define(["get-size/get-size","outlayer/outlayer","packery/js/rect","packery/js/packer","packery/js/item"],e):"object"==typeof module&&module.exports?module.exports=e(require("get-size"),require("outlayer"),require("./rect"),require("./packer"),require("./item")):t.Packery=e(t.getSize,t.Outlayer,t.Packery.Rect,t.Packery.Packer,t.Packery.Item)}(window,function(c,t,g,e,i){"use strict";g.prototype.canFit=function(t){return this.width>=t.width-1&&this.height>=t.height-1};var n=t.create("packery");n.Item=i;var o=n.prototype;function s(t,e){return t.position.y-e.position.y||t.position.x-e.position.x}function r(t,e){return t.position.x-e.position.x||t.position.y-e.position.y}o._create=function(){t.prototype._create.call(this),this.packer=new e,this.shiftPacker=new e,this.isEnabled=!0,this.dragItemCount=0;var i=this;this.handleDraggabilly={dragStart:function(){i.itemDragStart(this.element)},dragMove:function(){i.itemDragMove(this.element,this.position.x,this.position.y)},dragEnd:function(){i.itemDragEnd(this.element)}},this.handleUIDraggable={start:function(t,e){e&&i.itemDragStart(t.currentTarget)},drag:function(t,e){e&&i.itemDragMove(t.currentTarget,e.position.left,e.position.top)},stop:function(t,e){e&&i.itemDragEnd(t.currentTarget)}}},o._resetLayout=function(){var t,e,i;this.getSize(),this._getMeasurements(),i=this._getOption("horizontal")?(t=1/0,e=this.size.innerHeight+this.gutter,"rightwardTopToBottom"):(t=this.size.innerWidth+this.gutter,e=1/0,"downwardLeftToRight"),this.packer.width=this.shiftPacker.width=t,this.packer.height=this.shiftPacker.height=e,this.packer.sortDirection=this.shiftPacker.sortDirection=i,this.packer.reset(),this.maxY=0,this.maxX=0},o._getMeasurements=function(){this._getMeasurement("columnWidth","width"),this._getMeasurement("rowHeight","height"),this._getMeasurement("gutter","width")},o._getItemLayoutPosition=function(t){if(this._setRectSize(t.element,t.rect),this.isShifting||0<this.dragItemCount){var e=this._getPackMethod();this.packer[e](t.rect)}else this.packer.pack(t.rect);return this._setMaxXY(t.rect),t.rect},o.shiftLayout=function(){this.isShifting=!0,this.layout(),delete this.isShifting},o._getPackMethod=function(){return this._getOption("horizontal")?"rowPack":"columnPack"},o._setMaxXY=function(t){this.maxX=Math.max(t.x+t.width,this.maxX),this.maxY=Math.max(t.y+t.height,this.maxY)},o._setRectSize=function(t,e){var i=c(t),n=i.outerWidth,o=i.outerHeight;(n||o)&&(n=this._applyGridGutter(n,this.columnWidth),o=this._applyGridGutter(o,this.rowHeight)),e.width=Math.min(n,this.packer.width),e.height=Math.min(o,this.packer.height)},o._applyGridGutter=function(t,e){if(!e)return t+this.gutter;var i=t%(e+=this.gutter);return t=Math[i&&i<1?"round":"ceil"](t/e)*e},o._getContainerSize=function(){return this._getOption("horizontal")?{width:this.maxX-this.gutter}:{height:this.maxY-this.gutter}},o._manageStamp=function(t){var e,i=this.getItem(t);if(i&&i.isPlacing)e=i.rect;else{var n=this._getElementOffset(t);e=new g({x:this._getOption("originLeft")?n.left:n.right,y:this._getOption("originTop")?n.top:n.bottom})}this._setRectSize(t,e),this.packer.placed(e),this._setMaxXY(e)},o.sortItemsByPosition=function(){var t=this._getOption("horizontal")?r:s;this.items.sort(t)},o.fit=function(t,e,i){var n=this.getItem(t);n&&(this.stamp(n.element),n.enablePlacing(),this.updateShiftTargets(n),e=void 0===e?n.rect.x:e,i=void 0===i?n.rect.y:i,this.shift(n,e,i),this._bindFitEvents(n),n.moveTo(n.rect.x,n.rect.y),this.shiftLayout(),this.unstamp(n.element),this.sortItemsByPosition(),n.disablePlacing())},o._bindFitEvents=function(t){var e=this,i=0;function n(){2==++i&&e.dispatchEvent("fitComplete",null,[t])}t.once("layout",n),this.once("layoutComplete",n)},o.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&(this.options.shiftPercentResize?this.resizeShiftPercentLayout():this.layout())},o.needsResizeLayout=function(){var t=c(this.element),e=this._getOption("horizontal")?"innerHeight":"innerWidth";return t[e]!=this.size[e]},o.resizeShiftPercentLayout=function(){var t=this._getItemsForLayout(this.items),e=this._getOption("horizontal"),i=e?"y":"x",n=e?"height":"width",o=e?"rowHeight":"columnWidth",s=e?"innerHeight":"innerWidth",r=this[o];if(r=r&&r+this.gutter){this._getMeasurements();var a=this[o]+this.gutter;t.forEach(function(t){var e=Math.round(t.rect[i]/r);t.rect[i]=e*a})}else{var h=c(this.element)[s]+this.gutter,u=this.packer[n];t.forEach(function(t){t.rect[i]=t.rect[i]/u*h})}this.shiftLayout()},o.itemDragStart=function(t){if(this.isEnabled){this.stamp(t);var e=this.getItem(t);e&&(e.enablePlacing(),e.showDropPlaceholder(),this.dragItemCount++,this.updateShiftTargets(e))}},o.updateShiftTargets=function(t){this.shiftPacker.reset(),this._getBoundingRect();var o=this._getOption("originLeft"),s=this._getOption("originTop");this.stamps.forEach(function(t){var e=this.getItem(t);if(!e||!e.isPlacing){var i=this._getElementOffset(t),n=new g({x:o?i.left:i.right,y:s?i.top:i.bottom});this._setRectSize(t,n),this.shiftPacker.placed(n)}},this);var h,u=this._getOption("horizontal"),e=u?"rowHeight":"columnWidth",c=u?"height":"width";this.shiftTargetKeys=[],this.shiftTargets=[];var d=this[e];if(d=d&&d+this.gutter){var i=Math.ceil(t.rect[c]/d),n=Math.floor((this.shiftPacker[c]+this.gutter)/d);h=(n-i)*d;for(var r=0;r<n;r++){var a=u?0:r*d,l=u?r*d:0;this._addShiftTarget(a,l,h)}}else h=this.shiftPacker[c]+this.gutter-t.rect[c],this._addShiftTarget(0,0,h);var f=this._getItemsForLayout(this.items),p=this._getPackMethod();f.forEach(function(t){var e=t.rect;this._setRectSize(t.element,e),this.shiftPacker[p](e),this._addShiftTarget(e.x,e.y,h);var i=u?e.x+e.width:e.x,n=u?e.y:e.y+e.height;if(this._addShiftTarget(i,n,h),d)for(var o=Math.round(e[c]/d),s=1;s<o;s++){var r=u?i:e.x+d*s,a=u?e.y+d*s:n;this._addShiftTarget(r,a,h)}},this)},o._addShiftTarget=function(t,e,i){var n=this._getOption("horizontal")?e:t;if(!(0!==n&&i<n)){var o=t+","+e;-1!=this.shiftTargetKeys.indexOf(o)||(this.shiftTargetKeys.push(o),this.shiftTargets.push({x:t,y:e}))}},o.shift=function(t,e,i){var r,a=1/0,h={x:e,y:i};this.shiftTargets.forEach(function(t){var e,i,n,o,s=(n=(i=h).x-(e=t).x,o=i.y-e.y,Math.sqrt(n*n+o*o));s<a&&(r=t,a=s)}),t.rect.x=r.x,t.rect.y=r.y};o.itemDragMove=function(t,e,i){var n=this.isEnabled&&this.getItem(t);if(n){e-=this.size.paddingLeft,i-=this.size.paddingTop;var o=this,s=new Date;this._itemDragTime&&s-this._itemDragTime<120?(clearTimeout(this.dragTimeout),this.dragTimeout=setTimeout(r,120)):(r(),this._itemDragTime=s)}function r(){o.shift(n,e,i),n.positionDropPlaceholder(),o.layout()}},o.itemDragEnd=function(t){var e=this.isEnabled&&this.getItem(t);if(e){clearTimeout(this.dragTimeout),e.element.classList.add("is-positioning-post-drag");var i=0,n=this;e.once("layout",o),this.once("layoutComplete",o),e.moveTo(e.rect.x,e.rect.y),this.layout(),this.dragItemCount=Math.max(0,this.dragItemCount-1),this.sortItemsByPosition(),e.disablePlacing(),this.unstamp(e.element)}function o(){2==++i&&(e.element.classList.remove("is-positioning-post-drag"),e.hideDropPlaceholder(),n.dispatchEvent("dragItemPositioned",null,[e]))}},o.bindDraggabillyEvents=function(t){this._bindDraggabillyEvents(t,"on")},o.unbindDraggabillyEvents=function(t){this._bindDraggabillyEvents(t,"off")},o._bindDraggabillyEvents=function(t,e){var i=this.handleDraggabilly;t[e]("dragStart",i.dragStart),t[e]("dragMove",i.dragMove),t[e]("dragEnd",i.dragEnd)},o.bindUIDraggableEvents=function(t){this._bindUIDraggableEvents(t,"on")},o.unbindUIDraggableEvents=function(t){this._bindUIDraggableEvents(t,"off")},o._bindUIDraggableEvents=function(t,e){var i=this.handleUIDraggable;t[e]("dragstart",i.start)[e]("drag",i.drag)[e]("dragstop",i.stop)};var a=o.destroy;return o.destroy=function(){a.apply(this,arguments),this.isEnabled=!1},n.Rect=g,n.Packer=e,n});
1
+ !function(e,i){"use strict";"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(t){i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("jquery")):e.jQueryBridget=i(e,e.jQuery)}(window,function(t,e){"use strict";var i=Array.prototype.slice,n=t.console,d=void 0===n?function(){}:function(t){n.error(t)};function o(u,o,c){(c=c||e||t.jQuery)&&(o.prototype.option||(o.prototype.option=function(t){c.isPlainObject(t)&&(this.options=c.extend(!0,this.options,t))}),c.fn[u]=function(t){return"string"==typeof t?function(t,s,r){var a,h="$()."+u+'("'+s+'")';return t.each(function(t,e){var i=c.data(e,u);if(i){var n=i[s];if(n&&"_"!=s.charAt(0)){var o=n.apply(i,r);a=void 0===a?o:a}else d(h+" is not a valid method")}else d(u+" not initialized. Cannot call methods, i.e. "+h)}),void 0!==a?a:t}(this,t,i.call(arguments,1)):(function(t,n){t.each(function(t,e){var i=c.data(e,u);i?(i.option(n),i._init()):(i=new o(e,n),c.data(e,u,i))})}(this,t),this)},s(c))}function s(t){!t||t&&t.bridget||(t.bridget=o)}return s(e||t.jQuery),o}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function y(t){var e=parseFloat(t);return-1==t.indexOf("%")&&!isNaN(e)&&e}var i="undefined"==typeof console?function(){}:function(t){console.error(t)},v=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],_=v.length;function x(t){var e=getComputedStyle(t);return e||i("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}var b,E=!1;function T(t){if(function(){if(!E){E=!0;var t=document.createElement("div");t.style.width="200px",t.style.padding="1px 2px 3px 4px",t.style.borderStyle="solid",t.style.borderWidth="1px 2px 3px 4px",t.style.boxSizing="border-box";var e=document.body||document.documentElement;e.appendChild(t);var i=x(t);T.isBoxSizeOuter=b=200==y(i.width),e.removeChild(t)}}(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var e=x(t);if("none"==e.display)return function(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<_;e++)t[v[e]]=0;return t}();var i={};i.width=t.offsetWidth,i.height=t.offsetHeight;for(var n=i.isBorderBox="border-box"==e.boxSizing,o=0;o<_;o++){var s=v[o],r=e[s],a=parseFloat(r);i[s]=isNaN(a)?0:a}var h=i.paddingLeft+i.paddingRight,u=i.paddingTop+i.paddingBottom,c=i.marginLeft+i.marginRight,d=i.marginTop+i.marginBottom,l=i.borderLeftWidth+i.borderRightWidth,f=i.borderTopWidth+i.borderBottomWidth,p=n&&b,g=y(e.width);!1!==g&&(i.width=g+(p?0:h+l));var m=y(e.height);return!1!==m&&(i.height=m+(p?0:u+f)),i.innerWidth=i.width-(h+l),i.innerHeight=i.height-(u+f),i.outerWidth=i.width+c,i.outerHeight=i.height+d,i}}return T}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}(this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var s=this._onceEvents&&this._onceEvents[t];o;){var r=s&&s[o];r&&(this.off(t,o),delete s[o]),o.apply(this,e),o=i[n+=r?0:1]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var i=function(){var t=Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var n=e[i]+"MatchesSelector";if(t[n])return n}}();return function(t,e){return t[i](e)}}),function(e,i){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(t){return i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("desandro-matches-selector")):e.fizzyUIUtils=i(e,e.matchesSelector)}(window,function(u,s){var c={extend:function(t,e){for(var i in e)t[i]=e[i];return t},modulo:function(t,e){return(t%e+e)%e},makeArray:function(t){var e=[];if(Array.isArray(t))e=t;else if(t&&"number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e},removeFrom:function(t,e){var i=t.indexOf(e);-1!=i&&t.splice(i,1)},getParent:function(t,e){for(;t!=document.body;)if(t=t.parentNode,s(t,e))return t},getQueryElement:function(t){return"string"==typeof t?document.querySelector(t):t},handleEvent:function(t){var e="on"+t.type;this[e]&&this[e](t)},filterFindElements:function(t,n){t=c.makeArray(t);var o=[];return t.forEach(function(t){if(t instanceof HTMLElement)if(n){s(t,n)&&o.push(t);for(var e=t.querySelectorAll(n),i=0;i<e.length;i++)o.push(e[i])}else o.push(t)}),o},debounceMethod:function(t,e,n){var o=t.prototype[e],s=e+"Timeout";t.prototype[e]=function(){var t=this[s];t&&clearTimeout(t);var e=arguments,i=this;this[s]=setTimeout(function(){o.apply(i,e),delete i[s]},n||100)}},docReady:function(t){"complete"==document.readyState?t():document.addEventListener("DOMContentLoaded",t)},toDashed:function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()}},d=u.console;return c.htmlInit=function(a,h){c.docReady(function(){var t=c.toDashed(h),o="data-"+t,e=document.querySelectorAll("["+o+"]"),i=document.querySelectorAll(".js-"+t),n=c.makeArray(e).concat(c.makeArray(i)),s=o+"-options",r=u.jQuery;n.forEach(function(e){var t,i=e.getAttribute(o)||e.getAttribute(s);try{t=i&&JSON.parse(i)}catch(t){return void(d&&d.error("Error parsing "+o+" on "+e.className+": "+t))}var n=new a(e,t);r&&r.data(e,h,n)})})},c}),function(t,e){"function"==typeof define&&define.amd?define("outlayer/item",["ev-emitter/ev-emitter","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("ev-emitter"),require("get-size")):(t.Outlayer={},t.Outlayer.Item=e(t.EvEmitter,t.getSize))}(window,function(t,e){"use strict";var i=document.documentElement.style,n="string"==typeof i.transition?"transition":"WebkitTransition",o="string"==typeof i.transform?"transform":"WebkitTransform",s={WebkitTransition:"webkitTransitionEnd",transition:"transitionend"}[n],r={transform:o,transition:n,transitionDuration:n+"Duration",transitionProperty:n+"Property",transitionDelay:n+"Delay"};function a(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}var h=a.prototype=Object.create(t.prototype);h.constructor=a,h._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},h.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},h.getSize=function(){this.size=e(this.element)},h.css=function(t){var e=this.element.style;for(var i in t){e[r[i]||i]=t[i]}},h.getPosition=function(){var t=getComputedStyle(this.element),e=this.layout._getOption("originLeft"),i=this.layout._getOption("originTop"),n=t[e?"left":"right"],o=t[i?"top":"bottom"],s=this.layout.size,r=-1!=n.indexOf("%")?parseFloat(n)/100*s.width:parseInt(n,10),a=-1!=o.indexOf("%")?parseFloat(o)/100*s.height:parseInt(o,10);r=isNaN(r)?0:r,a=isNaN(a)?0:a,r-=e?s.paddingLeft:s.paddingRight,a-=i?s.paddingTop:s.paddingBottom,this.position.x=r,this.position.y=a},h.layoutPosition=function(){var t=this.layout.size,e={},i=this.layout._getOption("originLeft"),n=this.layout._getOption("originTop"),o=i?"paddingLeft":"paddingRight",s=i?"left":"right",r=i?"right":"left",a=this.position.x+t[o];e[s]=this.getXValue(a),e[r]="";var h=n?"paddingTop":"paddingBottom",u=n?"top":"bottom",c=n?"bottom":"top",d=this.position.y+t[h];e[u]=this.getYValue(d),e[c]="",this.css(e),this.emitEvent("layout",[this])},h.getXValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&!e?t/this.layout.size.width*100+"%":t+"px"},h.getYValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&e?t/this.layout.size.height*100+"%":t+"px"},h._transitionTo=function(t,e){this.getPosition();var i=this.position.x,n=this.position.y,o=parseInt(t,10),s=parseInt(e,10),r=o===this.position.x&&s===this.position.y;if(this.setPosition(t,e),!r||this.isTransitioning){var a=t-i,h=e-n,u={};u.transform=this.getTranslate(a,h),this.transition({to:u,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})}else this.layoutPosition()},h.getTranslate=function(t,e){return"translate3d("+(t=this.layout._getOption("originLeft")?t:-t)+"px, "+(e=this.layout._getOption("originTop")?e:-e)+"px, 0)"},h.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},h.moveTo=h._transitionTo,h.setPosition=function(t,e){this.position.x=parseInt(t,10),this.position.y=parseInt(e,10)},h._nonTransition=function(t){for(var e in this.css(t.to),t.isCleaning&&this._removeStyles(t.to),t.onTransitionEnd)t.onTransitionEnd[e].call(this)},h.transition=function(t){if(parseFloat(this.layout.options.transitionDuration)){var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&&(e.clean[i]=!0);if(t.from){this.css(t.from);this.element.offsetHeight;null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0}else this._nonTransition(t)};var u="opacity,"+o.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()});h.enableTransition=function(){if(!this.isTransitioning){var t=this.layout.options.transitionDuration;t="number"==typeof t?t+"ms":t,this.css({transitionProperty:u,transitionDuration:t,transitionDelay:this.staggerDelay||0}),this.element.addEventListener(s,this,!1)}},h.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},h.onotransitionend=function(t){this.ontransitionend(t)};var c={"-webkit-transform":"transform"};h.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,i=c[t.propertyName]||t.propertyName;if(delete e.ingProperties[i],function(t){for(var e in t)return!1;return!0}(e.ingProperties)&&this.disableTransition(),i in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[i]),i in e.onEnd)e.onEnd[i].call(this),delete e.onEnd[i];this.emitEvent("transitionEnd",[this])}},h.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(s,this,!1),this.isTransitioning=!1},h._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var d={transitionProperty:"",transitionDuration:"",transitionDelay:""};return h.removeTransitionStyles=function(){this.css(d)},h.stagger=function(t){t=isNaN(t)?0:t,this.staggerDelay=t+"ms"},h.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},h.remove=function(){n&&parseFloat(this.layout.options.transitionDuration)?(this.once("transitionEnd",function(){this.removeElem()}),this.hide()):this.removeElem()},h.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options,e={};e[this.getHideRevealTransitionEndProperty("visibleStyle")]=this.onRevealTransitionEnd,this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0,onTransitionEnd:e})},h.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},h.getHideRevealTransitionEndProperty=function(t){var e=this.layout.options[t];if(e.opacity)return"opacity";for(var i in e)return i},h.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options,e={};e[this.getHideRevealTransitionEndProperty("hiddenStyle")]=this.onHideTransitionEnd,this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:e})},h.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},h.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},a}),function(o,s){"use strict";"function"==typeof define&&define.amd?define("outlayer/outlayer",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(t,e,i,n){return s(o,t,e,i,n)}):"object"==typeof module&&module.exports?module.exports=s(o,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):o.Outlayer=s(o,o.EvEmitter,o.getSize,o.fizzyUIUtils,o.Outlayer.Item)}(window,function(t,e,o,s,n){"use strict";var r=t.console,a=t.jQuery,i=function(){},h=0,u={};function c(t,e){var i=s.getQueryElement(t);if(i){this.element=i,a&&(this.$element=a(this.element)),this.options=s.extend({},this.constructor.defaults),this.option(e);var n=++h;this.element.outlayerGUID=n,(u[n]=this)._create(),this._getOption("initLayout")&&this.layout()}else r&&r.error("Bad element for "+this.constructor.namespace+": "+(i||t))}c.namespace="outlayer",c.Item=n,c.defaults={containerStyle:{position:"relative"},initLayout:!0,originLeft:!0,originTop:!0,resize:!0,resizeContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}};var d=c.prototype;function l(t){function e(){t.apply(this,arguments)}return(e.prototype=Object.create(t.prototype)).constructor=e}s.extend(d,e.prototype),d.option=function(t){s.extend(this.options,t)},d._getOption=function(t){var e=this.constructor.compatOptions[t];return e&&void 0!==this.options[e]?this.options[e]:this.options[t]},c.compatOptions={initLayout:"isInitLayout",horizontal:"isHorizontal",layoutInstant:"isLayoutInstant",originLeft:"isOriginLeft",originTop:"isOriginTop",resize:"isResizeBound",resizeContainer:"isResizingContainer"},d._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),s.extend(this.element.style,this.options.containerStyle),this._getOption("resize")&&this.bindResize()},d.reloadItems=function(){this.items=this._itemize(this.element.children)},d._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,n=[],o=0;o<e.length;o++){var s=new i(e[o],this);n.push(s)}return n},d._filterFindItemElements=function(t){return s.filterFindElements(t,this.options.itemSelector)},d.getItemElements=function(){return this.items.map(function(t){return t.element})},d.layout=function(){this._resetLayout(),this._manageStamps();var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;this.layoutItems(this.items,e),this._isLayoutInited=!0},d._init=d.layout,d._resetLayout=function(){this.getSize()},d.getSize=function(){this.size=o(this.element)},d._getMeasurement=function(t,e){var i,n=this.options[t];n?("string"==typeof n?i=this.element.querySelector(n):n instanceof HTMLElement&&(i=n),this[t]=i?o(i)[e]:n):this[t]=0},d.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},d._getItemsForLayout=function(t){return t.filter(function(t){return!t.isIgnored})},d._layoutItems=function(t,i){if(this._emitCompleteOnItems("layout",t),t&&t.length){var n=[];t.forEach(function(t){var e=this._getItemLayoutPosition(t);e.item=t,e.isInstant=i||t.isLayoutInstant,n.push(e)},this),this._processLayoutQueue(n)}},d._getItemLayoutPosition=function(){return{x:0,y:0}},d._processLayoutQueue=function(t){this.updateStagger(),t.forEach(function(t,e){this._positionItem(t.item,t.x,t.y,t.isInstant,e)},this)},d.updateStagger=function(){var t=this.options.stagger;if(null!=t)return this.stagger=function(t){if("number"==typeof t)return t;var e=t.match(/(^\d*\.?\d*)(\w*)/),i=e&&e[1],n=e&&e[2];if(!i.length)return 0;i=parseFloat(i);var o=f[n]||1;return i*o}(t),this.stagger;this.stagger=0},d._positionItem=function(t,e,i,n,o){n?t.goTo(e,i):(t.stagger(o*this.stagger),t.moveTo(e,i))},d._postLayout=function(){this.resizeContainer()},d.resizeContainer=function(){if(this._getOption("resizeContainer")){var t=this._getContainerSize();t&&(this._setContainerMeasure(t.width,!0),this._setContainerMeasure(t.height,!1))}},d._getContainerSize=i,d._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&&(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},d._emitCompleteOnItems=function(e,t){var i=this;function n(){i.dispatchEvent(e+"Complete",null,[t])}var o=t.length;if(t&&o){var s=0;t.forEach(function(t){t.once(e,r)})}else n();function r(){++s==o&&n()}},d.dispatchEvent=function(t,e,i){var n=e?[e].concat(i):i;if(this.emitEvent(t,n),a)if(this.$element=this.$element||a(this.element),e){var o=a.Event(e);o.type=t,this.$element.trigger(o,i)}else this.$element.trigger(t,i)},d.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},d.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},d.stamp=function(t){(t=this._find(t))&&(this.stamps=this.stamps.concat(t),t.forEach(this.ignore,this))},d.unstamp=function(t){(t=this._find(t))&&t.forEach(function(t){s.removeFrom(this.stamps,t),this.unignore(t)},this)},d._find=function(t){if(t)return"string"==typeof t&&(t=this.element.querySelectorAll(t)),t=s.makeArray(t)},d._manageStamps=function(){this.stamps&&this.stamps.length&&(this._getBoundingRect(),this.stamps.forEach(this._manageStamp,this))},d._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},d._manageStamp=i,d._getElementOffset=function(t){var e=t.getBoundingClientRect(),i=this._boundingRect,n=o(t);return{left:e.left-i.left-n.marginLeft,top:e.top-i.top-n.marginTop,right:i.right-e.right-n.marginRight,bottom:i.bottom-e.bottom-n.marginBottom}},d.handleEvent=s.handleEvent,d.bindResize=function(){t.addEventListener("resize",this),this.isResizeBound=!0},d.unbindResize=function(){t.removeEventListener("resize",this),this.isResizeBound=!1},d.onresize=function(){this.resize()},s.debounceMethod(c,"onresize",100),d.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},d.needsResizeLayout=function(){var t=o(this.element);return this.size&&t&&t.innerWidth!==this.size.innerWidth},d.addItems=function(t){var e=this._itemize(t);return e.length&&(this.items=this.items.concat(e)),e},d.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},d.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},d.reveal=function(t){if(this._emitCompleteOnItems("reveal",t),t&&t.length){var i=this.updateStagger();t.forEach(function(t,e){t.stagger(e*i),t.reveal()})}},d.hide=function(t){if(this._emitCompleteOnItems("hide",t),t&&t.length){var i=this.updateStagger();t.forEach(function(t,e){t.stagger(e*i),t.hide()})}},d.revealItemElements=function(t){var e=this.getItems(t);this.reveal(e)},d.hideItemElements=function(t){var e=this.getItems(t);this.hide(e)},d.getItem=function(t){for(var e=0;e<this.items.length;e++){var i=this.items[e];if(i.element==t)return i}},d.getItems=function(t){t=s.makeArray(t);var i=[];return t.forEach(function(t){var e=this.getItem(t);e&&i.push(e)},this),i},d.remove=function(t){var e=this.getItems(t);this._emitCompleteOnItems("remove",e),e&&e.length&&e.forEach(function(t){t.remove(),s.removeFrom(this.items,t)},this)},d.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="",this.items.forEach(function(t){t.destroy()}),this.unbindResize();var e=this.element.outlayerGUID;delete u[e],delete this.element.outlayerGUID,a&&a.removeData(this.element,this.constructor.namespace)},c.data=function(t){var e=(t=s.getQueryElement(t))&&t.outlayerGUID;return e&&u[e]},c.create=function(t,e){var i=l(c);return i.defaults=s.extend({},c.defaults),s.extend(i.defaults,e),i.compatOptions=s.extend({},c.compatOptions),i.namespace=t,i.data=c.data,i.Item=l(n),s.htmlInit(i,t),a&&a.bridget&&a.bridget(t,i),i};var f={ms:1,s:1e3};return c.Item=n,c}),function(t,e){"function"==typeof define&&define.amd?define("packery/js/rect",e):"object"==typeof module&&module.exports?module.exports=e():(t.Packery=t.Packery||{},t.Packery.Rect=e())}(window,function(){"use strict";function a(t){for(var e in a.defaults)this[e]=a.defaults[e];for(e in t)this[e]=t[e]}a.defaults={x:0,y:0,width:0,height:0};var t=a.prototype;return t.contains=function(t){var e=t.width||0,i=t.height||0;return this.x<=t.x&&this.y<=t.y&&this.x+this.width>=t.x+e&&this.y+this.height>=t.y+i},t.overlaps=function(t){var e=this.x+this.width,i=this.y+this.height,n=t.x+t.width,o=t.y+t.height;return this.x<n&&e>t.x&&this.y<o&&i>t.y},t.getMaximalFreeRects=function(t){if(!this.overlaps(t))return!1;var e,i=[],n=this.x+this.width,o=this.y+this.height,s=t.x+t.width,r=t.y+t.height;return this.y<t.y&&(e=new a({x:this.x,y:this.y,width:this.width,height:t.y-this.y}),i.push(e)),s<n&&(e=new a({x:s,y:this.y,width:n-s,height:this.height}),i.push(e)),r<o&&(e=new a({x:this.x,y:r,width:this.width,height:o-r}),i.push(e)),this.x<t.x&&(e=new a({x:this.x,y:this.y,width:t.x-this.x,height:this.height}),i.push(e)),i},t.canFit=function(t){return this.width>=t.width&&this.height>=t.height},a}),function(t,e){if("function"==typeof define&&define.amd)define("packery/js/packer",["./rect"],e);else if("object"==typeof module&&module.exports)module.exports=e(require("./rect"));else{var i=t.Packery=t.Packery||{};i.Packer=e(i.Rect)}}(window,function(e){"use strict";function t(t,e,i){this.width=t||0,this.height=e||0,this.sortDirection=i||"downwardLeftToRight",this.reset()}var i=t.prototype;i.reset=function(){this.spaces=[];var t=new e({x:0,y:0,width:this.width,height:this.height});this.spaces.push(t),this.sorter=n[this.sortDirection]||n.downwardLeftToRight},i.pack=function(t){for(var e=0;e<this.spaces.length;e++){var i=this.spaces[e];if(i.canFit(t)){this.placeInSpace(t,i);break}}},i.columnPack=function(t){for(var e=0;e<this.spaces.length;e++){var i=this.spaces[e];if(i.x<=t.x&&i.x+i.width>=t.x+t.width&&i.height>=t.height-.01){t.y=i.y,this.placed(t);break}}},i.rowPack=function(t){for(var e=0;e<this.spaces.length;e++){var i=this.spaces[e];if(i.y<=t.y&&i.y+i.height>=t.y+t.height&&i.width>=t.width-.01){t.x=i.x,this.placed(t);break}}},i.placeInSpace=function(t,e){t.x=e.x,t.y=e.y,this.placed(t)},i.placed=function(t){for(var e=[],i=0;i<this.spaces.length;i++){var n=this.spaces[i],o=n.getMaximalFreeRects(t);o?e.push.apply(e,o):e.push(n)}this.spaces=e,this.mergeSortSpaces()},i.mergeSortSpaces=function(){t.mergeRects(this.spaces),this.spaces.sort(this.sorter)},i.addSpace=function(t){this.spaces.push(t),this.mergeSortSpaces()},t.mergeRects=function(t){var e=0,i=t[e];t:for(;i;){for(var n=0,o=t[e+n];o;){if(o==i)n++;else{if(o.contains(i)){t.splice(e,1),i=t[e];continue t}i.contains(o)?t.splice(e+n,1):n++}o=t[e+n]}i=t[++e]}return t};var n={downwardLeftToRight:function(t,e){return t.y-e.y||t.x-e.x},rightwardTopToBottom:function(t,e){return t.x-e.x||t.y-e.y}};return t}),function(t,e){"function"==typeof define&&define.amd?define("packery/js/item",["outlayer/outlayer","./rect"],e):"object"==typeof module&&module.exports?module.exports=e(require("outlayer"),require("./rect")):t.Packery.Item=e(t.Outlayer,t.Packery.Rect)}(window,function(t,e){"use strict";var i="string"==typeof document.documentElement.style.transform?"transform":"WebkitTransform",n=function(){t.Item.apply(this,arguments)},o=n.prototype=Object.create(t.Item.prototype),s=o._create;o._create=function(){s.call(this),this.rect=new e};var r=o.moveTo;return o.moveTo=function(t,e){var i=Math.abs(this.position.x-t),n=Math.abs(this.position.y-e);this.layout.dragItemCount&&!this.isPlacing&&!this.isTransitioning&&i<1&&n<1?this.goTo(t,e):r.apply(this,arguments)},o.enablePlacing=function(){this.removeTransitionStyles(),this.isTransitioning&&i&&(this.element.style[i]="none"),this.isTransitioning=!1,this.getSize(),this.layout._setRectSize(this.element,this.rect),this.isPlacing=!0},o.disablePlacing=function(){this.isPlacing=!1},o.removeElem=function(){this.element.parentNode.removeChild(this.element),this.layout.packer.addSpace(this.rect),this.emitEvent("remove",[this])},o.showDropPlaceholder=function(){var t=this.dropPlaceholder;t||((t=this.dropPlaceholder=document.createElement("div")).className="packery-drop-placeholder",t.style.position="absolute"),t.style.width=this.size.width+"px",t.style.height=this.size.height+"px",this.positionDropPlaceholder(),this.layout.element.appendChild(t)},o.positionDropPlaceholder=function(){this.dropPlaceholder.style[i]="translate("+this.rect.x+"px, "+this.rect.y+"px)"},o.hideDropPlaceholder=function(){var t=this.dropPlaceholder.parentNode;t&&t.removeChild(this.dropPlaceholder)},n}),function(t,e){"function"==typeof define&&define.amd?define(["get-size/get-size","outlayer/outlayer","packery/js/rect","packery/js/packer","packery/js/item"],e):"object"==typeof module&&module.exports?module.exports=e(require("get-size"),require("outlayer"),require("./rect"),require("./packer"),require("./item")):t.Packery=e(t.getSize,t.Outlayer,t.Packery.Rect,t.Packery.Packer,t.Packery.Item)}(window,function(c,t,g,e,i){"use strict";g.prototype.canFit=function(t){return this.width>=t.width-1&&this.height>=t.height-1};var n=t.create("packery");n.Item=i;var o=n.prototype;function s(t,e){return t.position.y-e.position.y||t.position.x-e.position.x}function r(t,e){return t.position.x-e.position.x||t.position.y-e.position.y}o._create=function(){t.prototype._create.call(this),this.packer=new e,this.shiftPacker=new e,this.isEnabled=!0,this.dragItemCount=0;var i=this;this.handleDraggabilly={dragStart:function(){i.itemDragStart(this.element)},dragMove:function(){i.itemDragMove(this.element,this.position.x,this.position.y)},dragEnd:function(){i.itemDragEnd(this.element)}},this.handleUIDraggable={start:function(t,e){e&&i.itemDragStart(t.currentTarget)},drag:function(t,e){e&&i.itemDragMove(t.currentTarget,e.position.left,e.position.top)},stop:function(t,e){e&&i.itemDragEnd(t.currentTarget)}}},o._resetLayout=function(){var t,e,i;this.getSize(),this._getMeasurements(),i=this._getOption("horizontal")?(t=1/0,e=this.size.innerHeight+this.gutter,"rightwardTopToBottom"):(t=this.size.innerWidth+this.gutter,e=1/0,"downwardLeftToRight"),this.packer.width=this.shiftPacker.width=t,this.packer.height=this.shiftPacker.height=e,this.packer.sortDirection=this.shiftPacker.sortDirection=i,this.packer.reset(),this.maxY=0,this.maxX=0},o._getMeasurements=function(){this._getMeasurement("columnWidth","width"),this._getMeasurement("rowHeight","height"),this._getMeasurement("gutter","width")},o._getItemLayoutPosition=function(t){if(this._setRectSize(t.element,t.rect),this.isShifting||0<this.dragItemCount){var e=this._getPackMethod();this.packer[e](t.rect)}else this.packer.pack(t.rect);return this._setMaxXY(t.rect),t.rect},o.shiftLayout=function(){this.isShifting=!0,this.layout(),delete this.isShifting},o._getPackMethod=function(){return this._getOption("horizontal")?"rowPack":"columnPack"},o._setMaxXY=function(t){this.maxX=Math.max(t.x+t.width,this.maxX),this.maxY=Math.max(t.y+t.height,this.maxY)},o._setRectSize=function(t,e){var i=c(t),n=i.outerWidth,o=i.outerHeight;(n||o)&&(n=this._applyGridGutter(n,this.columnWidth),o=this._applyGridGutter(o,this.rowHeight)),e.width=Math.min(n,this.packer.width),e.height=Math.min(o,this.packer.height)},o._applyGridGutter=function(t,e){if(!e)return t+this.gutter;var i=t%(e+=this.gutter);return t=Math[i&&i<1?"round":"ceil"](t/e)*e},o._getContainerSize=function(){return this._getOption("horizontal")?{width:this.maxX-this.gutter}:{height:this.maxY-this.gutter}},o._manageStamp=function(t){var e,i=this.getItem(t);if(i&&i.isPlacing)e=i.rect;else{var n=this._getElementOffset(t);e=new g({x:this._getOption("originLeft")?n.left:n.right,y:this._getOption("originTop")?n.top:n.bottom})}this._setRectSize(t,e),this.packer.placed(e),this._setMaxXY(e)},o.sortItemsByPosition=function(){var t=this._getOption("horizontal")?r:s;this.items.sort(t)},o.fit=function(t,e,i){var n=this.getItem(t);n&&(this.stamp(n.element),n.enablePlacing(),this.updateShiftTargets(n),e=void 0===e?n.rect.x:e,i=void 0===i?n.rect.y:i,this.shift(n,e,i),this._bindFitEvents(n),n.moveTo(n.rect.x,n.rect.y),this.shiftLayout(),this.unstamp(n.element),this.sortItemsByPosition(),n.disablePlacing())},o._bindFitEvents=function(t){var e=this,i=0;function n(){2==++i&&e.dispatchEvent("fitComplete",null,[t])}t.once("layout",n),this.once("layoutComplete",n)},o.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&(this.options.shiftPercentResize?this.resizeShiftPercentLayout():this.layout())},o.needsResizeLayout=function(){var t=c(this.element),e=this._getOption("horizontal")?"innerHeight":"innerWidth";return t[e]!=this.size[e]},o.resizeShiftPercentLayout=function(){var t=this._getItemsForLayout(this.items),e=this._getOption("horizontal"),i=e?"y":"x",n=e?"height":"width",o=e?"rowHeight":"columnWidth",s=e?"innerHeight":"innerWidth",r=this[o];if(r=r&&r+this.gutter){this._getMeasurements();var a=this[o]+this.gutter;t.forEach(function(t){var e=Math.round(t.rect[i]/r);t.rect[i]=e*a})}else{var h=c(this.element)[s]+this.gutter,u=this.packer[n];t.forEach(function(t){t.rect[i]=t.rect[i]/u*h})}this.shiftLayout()},o.itemDragStart=function(t){if(this.isEnabled){this.stamp(t);var e=this.getItem(t);e&&(e.enablePlacing(),e.showDropPlaceholder(),this.dragItemCount++,this.updateShiftTargets(e))}},o.updateShiftTargets=function(t){this.shiftPacker.reset(),this._getBoundingRect();var o=this._getOption("originLeft"),s=this._getOption("originTop");this.stamps.forEach(function(t){var e=this.getItem(t);if(!e||!e.isPlacing){var i=this._getElementOffset(t),n=new g({x:o?i.left:i.right,y:s?i.top:i.bottom});this._setRectSize(t,n),this.shiftPacker.placed(n)}},this);var h,u=this._getOption("horizontal"),e=u?"rowHeight":"columnWidth",c=u?"height":"width";this.shiftTargetKeys=[],this.shiftTargets=[];var d=this[e];if(d=d&&d+this.gutter){var i=Math.ceil(t.rect[c]/d),n=Math.floor((this.shiftPacker[c]+this.gutter)/d);h=(n-i)*d;for(var r=0;r<n;r++){var a=u?0:r*d,l=u?r*d:0;this._addShiftTarget(a,l,h)}}else h=this.shiftPacker[c]+this.gutter-t.rect[c],this._addShiftTarget(0,0,h);var f=this._getItemsForLayout(this.items),p=this._getPackMethod();f.forEach(function(t){var e=t.rect;this._setRectSize(t.element,e),this.shiftPacker[p](e),this._addShiftTarget(e.x,e.y,h);var i=u?e.x+e.width:e.x,n=u?e.y:e.y+e.height;if(this._addShiftTarget(i,n,h),d)for(var o=Math.round(e[c]/d),s=1;s<o;s++){var r=u?i:e.x+d*s,a=u?e.y+d*s:n;this._addShiftTarget(r,a,h)}},this)},o._addShiftTarget=function(t,e,i){var n=this._getOption("horizontal")?e:t;if(!(0!==n&&i<n)){var o=t+","+e;-1!=this.shiftTargetKeys.indexOf(o)||(this.shiftTargetKeys.push(o),this.shiftTargets.push({x:t,y:e}))}},o.shift=function(t,e,i){var n,o=1/0,s={x:e,y:i};this.shiftTargets.forEach(function(t){var e=function(t,e){var i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)}(t,s);e<o&&(n=t,o=e)}),t.rect.x=n.x,t.rect.y=n.y};o.itemDragMove=function(t,e,i){var n=this.isEnabled&&this.getItem(t);if(n){e-=this.size.paddingLeft,i-=this.size.paddingTop;var o=this,s=new Date;this._itemDragTime&&s-this._itemDragTime<120?(clearTimeout(this.dragTimeout),this.dragTimeout=setTimeout(r,120)):(r(),this._itemDragTime=s)}function r(){o.shift(n,e,i),n.positionDropPlaceholder(),o.layout()}},o.itemDragEnd=function(t){var e=this.isEnabled&&this.getItem(t);if(e){clearTimeout(this.dragTimeout),e.element.classList.add("is-positioning-post-drag");var i=0,n=this;e.once("layout",o),this.once("layoutComplete",o),e.moveTo(e.rect.x,e.rect.y),this.layout(),this.dragItemCount=Math.max(0,this.dragItemCount-1),this.sortItemsByPosition(),e.disablePlacing(),this.unstamp(e.element)}function o(){2==++i&&(e.element.classList.remove("is-positioning-post-drag"),e.hideDropPlaceholder(),n.dispatchEvent("dragItemPositioned",null,[e]))}},o.bindDraggabillyEvents=function(t){this._bindDraggabillyEvents(t,"on")},o.unbindDraggabillyEvents=function(t){this._bindDraggabillyEvents(t,"off")},o._bindDraggabillyEvents=function(t,e){var i=this.handleDraggabilly;t[e]("dragStart",i.dragStart),t[e]("dragMove",i.dragMove),t[e]("dragEnd",i.dragEnd)},o.bindUIDraggableEvents=function(t){this._bindUIDraggableEvents(t,"on")},o.unbindUIDraggableEvents=function(t){this._bindUIDraggableEvents(t,"off")},o._bindUIDraggableEvents=function(t,e){var i=this.handleUIDraggable;t[e]("dragstart",i.start)[e]("drag",i.drag)[e]("dragstop",i.stop)};var a=o.destroy;return o.destroy=function(){a.apply(this,arguments),this.isEnabled=!1},n.Rect=g,n.Packer=e,n});
assets/js/wp-modula-gallery.js CHANGED
@@ -9,6 +9,7 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
9
  'containerSize': false,
10
  'size': false,
11
  },
 
12
  initialize: function( args ){
13
  var resizer = this;
14
 
@@ -30,6 +31,7 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
30
  resizer.windowResize();
31
  });
32
  },
 
33
  generateSize: function(){
34
  var columns = this.get( 'columns' ),
35
  gutter = this.get( 'gutter' ),
9
  'containerSize': false,
10
  'size': false,
11
  },
12
+
13
  initialize: function( args ){
14
  var resizer = this;
15
 
31
  resizer.windowResize();
32
  });
33
  },
34
+
35
  generateSize: function(){
36
  var columns = this.get( 'columns' ),
37
  gutter = this.get( 'gutter' ),
assets/js/wp-modula-items.js CHANGED
@@ -7,18 +7,19 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
7
  updateInterval: false,
8
 
9
  initialize: function() {
10
-
11
  // Listen to remove items from collections
12
- this.listenTo( this, 'remove', this.checkSave );
13
- this.listenTo( this, 'add', this.checkSave );
 
14
 
 
 
15
  },
16
 
17
  moveItem: function( model, index ){
18
  var currentIndex = this.indexOf( model );
19
 
20
  if ( currentIndex != index ) {
21
-
22
  // silence this to stop excess event triggers
23
  this.remove(model, {silent: true});
24
  this.add(model, {at: index-1});
@@ -32,50 +33,10 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
32
  var removedItem = this.at( 0 );
33
  removedItem.delete();
34
  }
35
-
36
  this.add( model );
37
 
38
  },
39
 
40
- checkSave: function() {
41
- var self = this;
42
-
43
- $('#publishing-action .spinner').addClass( 'is-active' );
44
- $('#publishing-action #publish').attr( 'disabled', 'disabled' );
45
-
46
- if ( ! self.updateInterval ) {
47
- self.updateInterval = setInterval( $.proxy( self.saveImages, self ), 1000);
48
- }else{
49
- clearInterval( self.updateInterval );
50
- self.updateInterval = setInterval( $.proxy( self.saveImages, self ), 1000);
51
- }
52
- },
53
-
54
- saveImages: function() {
55
- var images = [],
56
- ajaxData, self = this;
57
- clearInterval( this.updateInterval );
58
-
59
- this.each( function( item ) {
60
- var attributes = item.getAttributes();
61
- images[ attributes['index'] ] = attributes;
62
- });
63
-
64
- ajaxData = { '_wpnonce' : modulaHelper['_wpnonce'], 'action' : 'modula_save_images', gallery : modulaHelper['id'] };
65
- ajaxData['images'] = JSON.stringify( images );
66
-
67
- $.ajax({
68
- method: 'POST',
69
- url: modulaHelper['ajax_url'],
70
- data: ajaxData,
71
- dataType: 'json',
72
- }).done(function( msg ) {
73
- $('#publishing-action .spinner').removeClass( 'is-active' );
74
- $('#publishing-action #publish').removeAttr( 'disabled' );
75
- });
76
-
77
- }
78
-
79
  });
80
 
81
  var modulaItem = Backbone.Model.extend( {
@@ -127,7 +88,7 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
127
  }
128
 
129
  // save
130
- this.listenTo( this, 'change', this.checkSave );
131
 
132
  },
133
 
@@ -190,45 +151,6 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
190
 
191
  },
192
 
193
- checkSave: function() {
194
-
195
- var self = this,
196
- changedAttributes = _.keys( self.changedAttributes() );
197
-
198
- if ( changedAttributes.includes( 'index' ) ) {
199
- return;
200
- }
201
-
202
- $('#publishing-action .spinner').addClass( 'is-active' );
203
- $('#publishing-action #publish').attr( 'disabled', 'disabled' );
204
-
205
- if ( ! self.updateInterval ) {
206
- self.updateInterval = setInterval( $.proxy( self.saveImage, self ), 1000 );
207
- }else{
208
- clearInterval( self.updateInterval );
209
- self.updateInterval = setInterval( $.proxy( self.saveImage, self ), 1000 );
210
- }
211
- },
212
-
213
- saveImage: function() {
214
- var json = this.getAttributes();
215
- clearInterval( this.updateInterval );
216
-
217
- ajaxData = { '_wpnonce': modulaHelper['_wpnonce'], 'action': 'modula_save_image', 'gallery': modulaHelper['id'] };
218
- ajaxData['image'] = JSON.stringify( json );
219
-
220
- $.ajax({
221
- method: 'POST',
222
- url: modulaHelper['ajax_url'],
223
- data: ajaxData,
224
- dataType: 'json',
225
- }).done(function( msg ) {
226
- $('#publishing-action .spinner').removeClass( 'is-active' );
227
- $('#publishing-action #publish').removeAttr( 'disabled' );
228
- });
229
-
230
- }
231
-
232
  } );
233
 
234
  var modulaItemView = Backbone.View.extend({
@@ -381,6 +303,8 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
381
  // Render our view in order to update width/height.
382
  this.render();
383
 
 
 
384
  modula.GalleryView.resetPackary();
385
  },
386
 
7
  updateInterval: false,
8
 
9
  initialize: function() {
 
10
  // Listen to remove items from collections
11
+ this.listenTo( this, 'remove', $.proxy( wp.Modula.Save.checkSave, wp.Modula.Save ) );
12
+ this.listenTo( this, 'add', $.proxy( wp.Modula.Save.checkSave, wp.Modula.Save ) );
13
+ },
14
 
15
+ modelId: function( attrs ) {
16
+ return attrs.id;
17
  },
18
 
19
  moveItem: function( model, index ){
20
  var currentIndex = this.indexOf( model );
21
 
22
  if ( currentIndex != index ) {
 
23
  // silence this to stop excess event triggers
24
  this.remove(model, {silent: true});
25
  this.add(model, {at: index-1});
33
  var removedItem = this.at( 0 );
34
  removedItem.delete();
35
  }
 
36
  this.add( model );
37
 
38
  },
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  });
41
 
42
  var modulaItem = Backbone.Model.extend( {
88
  }
89
 
90
  // save
91
+ // this.listenTo( this, 'change', this.checkSave );
92
 
93
  },
94
 
151
 
152
  },
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  } );
155
 
156
  var modulaItemView = Backbone.View.extend({
303
  // Render our view in order to update width/height.
304
  this.render();
305
 
306
+ // Save Image
307
+ wp.Modula.Save.saveImage( this.model.get( 'id' ) );
308
  modula.GalleryView.resetPackary();
309
  },
310
 
assets/js/wp-modula-modal.js CHANGED
@@ -269,7 +269,9 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
269
  * Saves the image metadata
270
  */
271
  saveItem: function( event ) {
272
- var view;
 
 
273
 
274
  event.preventDefault();
275
 
@@ -280,29 +282,33 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
280
  view = this.item.get( 'view' );
281
  view.render();
282
 
283
- // Tell the view we've finished successfully
284
- this.trigger( 'loaded loaded:success' );
285
-
286
  // Show the user the 'saved' notice for 1.5 seconds
287
  var saved = this.$el.find( '.saved' );
288
  saved.fadeIn();
289
- setTimeout( function() {
 
 
 
290
  saved.fadeOut();
291
- }, 1500 );
292
 
293
  },
294
 
295
  saveItemAndClose: function ( event ){
296
- var view;
 
297
 
298
  event.preventDefault();
299
 
300
  // Tell the View we're loading
301
  this.trigger( 'loading' );
302
 
303
- // Get item view and render it.
304
- view = this.model.get( 'wpMediaView' );
305
- view.close();
 
 
 
306
 
307
  },
308
 
269
  * Saves the image metadata
270
  */
271
  saveItem: function( event ) {
272
+ var view,
273
+ self = this,
274
+ item = this.model.get( 'item' );
275
 
276
  event.preventDefault();
277
 
282
  view = this.item.get( 'view' );
283
  view.render();
284
 
 
 
 
285
  // Show the user the 'saved' notice for 1.5 seconds
286
  var saved = this.$el.find( '.saved' );
287
  saved.fadeIn();
288
+
289
+ wp.Modula.Save.saveImage( item.get( 'id' ), function(){
290
+ // Tell the view we've finished successfully
291
+ self.trigger( 'loaded loaded:success' );
292
  saved.fadeOut();
293
+ });
294
 
295
  },
296
 
297
  saveItemAndClose: function ( event ){
298
+ var view,
299
+ self = this;
300
 
301
  event.preventDefault();
302
 
303
  // Tell the View we're loading
304
  this.trigger( 'loading' );
305
 
306
+ clearInterval( wp.Modula.Save.updateInterval );
307
+ wp.Modula.Save.saveImages( function(){
308
+ // Get item view and render it.
309
+ view = self.model.get( 'wpMediaView' );
310
+ view.close();
311
+ });
312
 
313
  },
314
 
assets/js/wp-modula-save.js ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
2
+
3
+ (function( $, modula ){
4
+
5
+ var modulaSaveImages = {
6
+ updateInterval: false,
7
+
8
+ checkSave: function() {
9
+ var self = this;
10
+
11
+ $('#publishing-action .spinner').addClass( 'is-active' );
12
+ $('#publishing-action #publish').attr( 'disabled', 'disabled' );
13
+
14
+ if ( ! self.updateInterval ) {
15
+ self.updateInterval = setInterval( $.proxy( self.saveImages, self), 1000);
16
+ }else{
17
+ clearInterval( self.updateInterval );
18
+ self.updateInterval = setInterval( $.proxy( self.saveImages, self), 1000);
19
+ }
20
+ },
21
+
22
+ saveImages: function( callback = false ) {
23
+ var images = [],
24
+ self = this,
25
+ ajaxData;
26
+
27
+ clearInterval( self.updateInterval );
28
+
29
+ wp.Modula.Items.each( function( item ) {
30
+ var attributes = item.getAttributes();
31
+ images[ attributes['index'] ] = attributes;
32
+ });
33
+
34
+ ajaxData = { '_wpnonce' : modulaHelper['_wpnonce'], 'action' : 'modula_save_images', gallery : modulaHelper['id'] };
35
+ ajaxData['images'] = JSON.stringify( images );
36
+
37
+ $.ajax({
38
+ method: 'POST',
39
+ url: modulaHelper['ajax_url'],
40
+ data: ajaxData,
41
+ dataType: 'json',
42
+ }).done(function( msg ) {
43
+ $('#publishing-action .spinner').removeClass( 'is-active' );
44
+ $('#publishing-action #publish').removeAttr( 'disabled' );
45
+
46
+ if( typeof callback === "function" ) {
47
+ callback();
48
+ }
49
+ });
50
+ },
51
+
52
+ saveImage: function( id, callback = false ) {
53
+ var image = wp.Modula.Items.get( id ),
54
+ json = image.getAttributes();
55
+
56
+ $('#publishing-action .spinner').addClass( 'is-active' );
57
+ $('#publishing-action #publish').attr( 'disabled', 'disabled' );
58
+
59
+ ajaxData = { '_wpnonce': modulaHelper['_wpnonce'], 'action': 'modula_save_image', 'gallery': modulaHelper['id'] };
60
+ ajaxData['image'] = JSON.stringify( json );
61
+
62
+ $.ajax({
63
+ method: 'POST',
64
+ url: modulaHelper['ajax_url'],
65
+ data: ajaxData,
66
+ dataType: 'json',
67
+ }).done(function( msg ) {
68
+ $('#publishing-action .spinner').removeClass( 'is-active' );
69
+ $('#publishing-action #publish').removeAttr( 'disabled' );
70
+
71
+ if( typeof callback === "function" ) {
72
+ callback();
73
+ }
74
+ });
75
+ }
76
+ }
77
+
78
+ modula.Save = modulaSaveImages;
79
+
80
+ }( jQuery, wp.Modula ))
changelog.txt CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  = 2.0.6 - 13.03.2019 =
2
  * Changed how we save images
3
  * Change some strings
1
+ = 2.0.6 - 13.03.2019 =
2
+ * Improved save sistem
3
+ * Added Lazy Load function
4
+ * Fixed XSS issue
5
+ * Fixed minor CSS isues
6
+
7
  = 2.0.6 - 13.03.2019 =
8
  * Changed how we save images
9
  * Change some strings
includes/admin/class-modula-cpt-fields-helper.php CHANGED
@@ -8,25 +8,16 @@ class Modula_CPT_Fields_Helper {
8
  public static function get_tabs() {
9
 
10
  $general_description = '<p>' . esc_html__( 'Choose between creative or custom grid (build your own). Pick your favorite lightbox style and easily design your gallery.', 'modula-best-grid-gallery' ) . '</p>';
11
- // $general_description .= self::generate_more_help_links();
12
-
13
  $caption_description = '<p>' . esc_html__( 'The settings below adjust how the image title/description will appear on the front-end.', 'modula-best-grid-gallery' ) . '</p>';
14
- // $caption_description .= self::generate_more_help_links();
15
-
16
  $social_description = '<p>' . esc_html__( 'Here you can add social sharing buttons to your the images in your gallery.', 'modula-best-grid-gallery' ) . '</p>';
17
- // $social_description .= self::generate_more_help_links();
18
-
19
  $loadingeffects_description = '<p>' . esc_html__( 'The settings below adjust the effect applied to the images after the page is fully loaded.', 'modula-best-grid-gallery' ) . '</p>';
20
- // $loadingeffects_description .= self::generate_more_help_links();
21
-
22
  $hover_description = '<p>' . esc_html__( 'Select how your images will behave on hover. Hover styles for your images.', 'modula-best-grid-gallery' ) . '</p>';
23
- // $hover_description .= self::generate_more_help_links();
24
-
25
  $style_description = '<p>' . esc_html__( 'Here you can style the look of your images.', 'modula-best-grid-gallery' ) . '</p>';
26
- // $style_description .= self::generate_more_help_links();
27
-
28
  $customizations_description = '<p>' . esc_html__( 'Use this section to add custom CSS to your gallery for advanced modifications.', 'modula-best-grid-gallery' ) . '</p>';
29
- // $customizations_description .= self::generate_more_help_links();
 
 
 
30
 
31
  return apply_filters( 'modula_gallery_tabs', array(
32
  'general' => array(
@@ -39,6 +30,7 @@ class Modula_CPT_Fields_Helper {
39
  'filters' => array(
40
  'label' => esc_html__( 'Filters', 'modula-best-grid-gallery' ),
41
  'title' => esc_html__( 'Filters', 'modula-best-grid-gallery' ),
 
42
  "icon" => "dashicons dashicons-filter",
43
  'badge' => esc_html__( 'PRO', 'modula-best-grid-gallery' ),
44
  'priority' => 15,
@@ -95,7 +87,6 @@ class Modula_CPT_Fields_Helper {
95
  'responsive' => array(
96
  'label' => esc_html__( 'Responsive', 'modula-best-grid-gallery' ),
97
  'title' => esc_html__( 'Responsive Settings', 'modula-best-grid-gallery' ),
98
- 'badge' => esc_html__( 'Beta', 'modula-best-grid-gallery' ),
99
  "icon" => "dashicons dashicons-smartphone",
100
  'priority' => 90,
101
  ),
@@ -391,6 +382,15 @@ class Modula_CPT_Fields_Helper {
391
  'priority' => 50,
392
  ),
393
  ),
 
 
 
 
 
 
 
 
 
394
  'responsive' => array(
395
  'enable_responsive' => array(
396
  "name" => esc_html__( 'Custom responsiveness', 'modula-best-grid-gallery' ),
@@ -431,6 +431,16 @@ class Modula_CPT_Fields_Helper {
431
  ),
432
  ) );
433
 
 
 
 
 
 
 
 
 
 
 
434
  if ( 'all' == $tab ) {
435
  return $fields;
436
  }
@@ -480,6 +490,7 @@ class Modula_CPT_Fields_Helper {
480
  'columns' => 6,
481
  'gutter' => 10,
482
  'helpergrid' => 0,
 
483
  ) );
484
  }
485
 
8
  public static function get_tabs() {
9
 
10
  $general_description = '<p>' . esc_html__( 'Choose between creative or custom grid (build your own). Pick your favorite lightbox style and easily design your gallery.', 'modula-best-grid-gallery' ) . '</p>';
 
 
11
  $caption_description = '<p>' . esc_html__( 'The settings below adjust how the image title/description will appear on the front-end.', 'modula-best-grid-gallery' ) . '</p>';
 
 
12
  $social_description = '<p>' . esc_html__( 'Here you can add social sharing buttons to your the images in your gallery.', 'modula-best-grid-gallery' ) . '</p>';
 
 
13
  $loadingeffects_description = '<p>' . esc_html__( 'The settings below adjust the effect applied to the images after the page is fully loaded.', 'modula-best-grid-gallery' ) . '</p>';
 
 
14
  $hover_description = '<p>' . esc_html__( 'Select how your images will behave on hover. Hover styles for your images.', 'modula-best-grid-gallery' ) . '</p>';
 
 
15
  $style_description = '<p>' . esc_html__( 'Here you can style the look of your images.', 'modula-best-grid-gallery' ) . '</p>';
 
 
16
  $customizations_description = '<p>' . esc_html__( 'Use this section to add custom CSS to your gallery for advanced modifications.', 'modula-best-grid-gallery' ) . '</p>';
17
+ $filters_description = sprintf( '<p><strong>%s</strong><br><br>%s</p>',
18
+ esc_html__( 'Easily let website visitors sort photos in your gallery by adding filters.', 'modula-best-grid-gallery' ),
19
+ esc_html__( 'Use this tab to create new filters which you can then start assigning filters to by editing images individually or by using the bulk edit option.', 'modula-best-grid-gallery' )
20
+ );
21
 
22
  return apply_filters( 'modula_gallery_tabs', array(
23
  'general' => array(
30
  'filters' => array(
31
  'label' => esc_html__( 'Filters', 'modula-best-grid-gallery' ),
32
  'title' => esc_html__( 'Filters', 'modula-best-grid-gallery' ),
33
+ 'description' => $filters_description,
34
  "icon" => "dashicons dashicons-filter",
35
  'badge' => esc_html__( 'PRO', 'modula-best-grid-gallery' ),
36
  'priority' => 15,
87
  'responsive' => array(
88
  'label' => esc_html__( 'Responsive', 'modula-best-grid-gallery' ),
89
  'title' => esc_html__( 'Responsive Settings', 'modula-best-grid-gallery' ),
 
90
  "icon" => "dashicons dashicons-smartphone",
91
  'priority' => 90,
92
  ),
382
  'priority' => 50,
383
  ),
384
  ),
385
+ 'speedup' => array(
386
+ 'lazy_load' => array(
387
+ "name" => esc_html__( 'Lazy Load', 'modula-best-grid-gallery' ),
388
+ "description" => esc_html__( 'Enable/Disable lazy load', 'modula-best-grid-gallery' ),
389
+ "type" => "toggle",
390
+ "default" => 0,
391
+ 'priority' => 1,
392
+ ),
393
+ ),
394
  'responsive' => array(
395
  'enable_responsive' => array(
396
  "name" => esc_html__( 'Custom responsiveness', 'modula-best-grid-gallery' ),
431
  ),
432
  ) );
433
 
434
+ if ( ! isset( $fields['speedup']['lazy_load'] ) ) {
435
+ $fields['speedup']['lazy_load'] = array(
436
+ "name" => esc_html__( 'Lazy Load', 'modula-best-grid-gallery' ),
437
+ "description" => esc_html__( 'Enable/Disable lazy load', 'modula-best-grid-gallery' ),
438
+ "type" => "toggle",
439
+ "default" => 0,
440
+ 'priority' => 0,
441
+ );
442
+ }
443
+
444
  if ( 'all' == $tab ) {
445
  return $fields;
446
  }
490
  'columns' => 6,
491
  'gutter' => 10,
492
  'helpergrid' => 0,
493
+ 'lazy_load' => 0,
494
  ) );
495
  }
496
 
includes/admin/class-modula-upsells.php CHANGED
@@ -23,7 +23,7 @@ class Modula_Upsells {
23
  $upsell_box .= '<h2>' . esc_html( $title ) . '</h2>';
24
  $upsell_box .= '<p class="modula-upsell-description">' . esc_html( $description ) . '</p>';
25
  $upsell_box .= '<p>';
26
- $upsell_box .= '<a target="_blank" href="https://wp-modula.com/pricing/?utm_source=modula-lite&utm_medium=' . $tab . '-tab&utm_campaign=litevspro#lite-vs-pro" class="button">' . esc_html__( 'See LITE vs PRO Differences', 'modula-best-grid-gallery' ) . '</a>';
27
  $upsell_box .= '<a target="_blank" href="https://wp-modula.com/pricing/?utm_source=modula-lite&utm_medium=' . $tab . '-tab&utm_campaign=upsell" class="button-primary button">' . esc_html__( 'Get Modula Pro!', 'modula-best-grid-gallery' ) . '</a>';
28
  $upsell_box .= '</p>';
29
  $upsell_box .= '</div>';
23
  $upsell_box .= '<h2>' . esc_html( $title ) . '</h2>';
24
  $upsell_box .= '<p class="modula-upsell-description">' . esc_html( $description ) . '</p>';
25
  $upsell_box .= '<p>';
26
+ // $upsell_box .= '<a target="_blank" href="https://wp-modula.com/pricing/?utm_source=modula-lite&utm_medium=' . $tab . '-tab&utm_campaign=litevspro#lite-vs-pro" class="button">' . esc_html__( 'See LITE vs PRO Differences', 'modula-best-grid-gallery' ) . '</a>';
27
  $upsell_box .= '<a target="_blank" href="https://wp-modula.com/pricing/?utm_source=modula-lite&utm_medium=' . $tab . '-tab&utm_campaign=upsell" class="button-primary button">' . esc_html__( 'Get Modula Pro!', 'modula-best-grid-gallery' ) . '</a>';
28
  $upsell_box .= '</p>';
29
  $upsell_box .= '</div>';
includes/admin/modula-js-templates.php CHANGED
@@ -40,7 +40,7 @@
40
  <span class="name"><?php esc_html_e( 'Title', 'modula-best-grid-gallery' ); ?></span>
41
  <input type="text" name="title" value="{{ data.title }}" />
42
  <div class="description">
43
- <?php esc_html_e( 'Image titles can take any type of HTML. You can adjust the position of the titles in the main Lightbox settings.', 'modula-best-grid-gallery' ); ?>
44
  </div>
45
  </label>
46
 
40
  <span class="name"><?php esc_html_e( 'Title', 'modula-best-grid-gallery' ); ?></span>
41
  <input type="text" name="title" value="{{ data.title }}" />
42
  <div class="description">
43
+ <?php esc_html_e( 'Image titles can take any type of HTML.', 'modula-best-grid-gallery' ); ?>
44
  </div>
45
  </label>
46
 
includes/class-modula.php CHANGED
@@ -172,6 +172,7 @@ class Modula {
172
  wp_enqueue_script( 'modula-resize-senzor', MODULA_URL . 'assets/js/resizesensor.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
173
  wp_enqueue_script( 'modula-packery', MODULA_URL . 'assets/js/packery.min.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-droppable', 'jquery-ui-resizable', 'jquery-ui-draggable' ), MODULA_LITE_VERSION, true );
174
  wp_enqueue_script( 'modula-settings', MODULA_URL . 'assets/js/wp-modula-settings.js', array( 'jquery', 'jquery-ui-slider', 'wp-color-picker', 'jquery-ui-sortable' ), MODULA_LITE_VERSION, true );
 
175
  wp_enqueue_script( 'modula-items', MODULA_URL . 'assets/js/wp-modula-items.js', array(), MODULA_LITE_VERSION, true );
176
  wp_enqueue_script( 'modula-modal', MODULA_URL . 'assets/js/wp-modula-modal.js', array(), MODULA_LITE_VERSION, true );
177
  wp_enqueue_script( 'modula-upload', MODULA_URL . 'assets/js/wp-modula-upload.js', array(), MODULA_LITE_VERSION, true );
172
  wp_enqueue_script( 'modula-resize-senzor', MODULA_URL . 'assets/js/resizesensor.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
173
  wp_enqueue_script( 'modula-packery', MODULA_URL . 'assets/js/packery.min.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-droppable', 'jquery-ui-resizable', 'jquery-ui-draggable' ), MODULA_LITE_VERSION, true );
174
  wp_enqueue_script( 'modula-settings', MODULA_URL . 'assets/js/wp-modula-settings.js', array( 'jquery', 'jquery-ui-slider', 'wp-color-picker', 'jquery-ui-sortable' ), MODULA_LITE_VERSION, true );
175
+ wp_enqueue_script( 'modula-save', MODULA_URL . 'assets/js/wp-modula-save.js', array(), MODULA_LITE_VERSION, true );
176
  wp_enqueue_script( 'modula-items', MODULA_URL . 'assets/js/wp-modula-items.js', array(), MODULA_LITE_VERSION, true );
177
  wp_enqueue_script( 'modula-modal', MODULA_URL . 'assets/js/wp-modula-modal.js', array(), MODULA_LITE_VERSION, true );
178
  wp_enqueue_script( 'modula-upload', MODULA_URL . 'assets/js/wp-modula-upload.js', array(), MODULA_LITE_VERSION, true );
includes/helper/class-modula-helper.php CHANGED
@@ -19,10 +19,14 @@ class Modula_Helper {
19
  foreach ( $attributes as $name => $value ) {
20
 
21
  if ( in_array( $name, array( 'alt', 'rel', 'title' ) ) ) {
 
 
22
  $value = wp_strip_all_tags( $value );
 
 
23
  }
24
 
25
- $return .= ' ' . esc_attr( $name ) . '="' . esc_attr( $value ) . '"';
26
  }
27
 
28
  return $return;
19
  foreach ( $attributes as $name => $value ) {
20
 
21
  if ( in_array( $name, array( 'alt', 'rel', 'title' ) ) ) {
22
+ $value = str_replace('<', '&lt;', $value );
23
+ $value = strip_tags( htmlspecialchars( $value ) );
24
  $value = wp_strip_all_tags( $value );
25
+ }else{
26
+ $value = esc_attr( $value );
27
  }
28
 
29
+ $return .= ' ' . esc_attr( $name ) . '="' . $value . '"';
30
  }
31
 
32
  return $return;
includes/public/class-modula-shortcode.php CHANGED
@@ -20,19 +20,18 @@ class Modula_Shortcode {
20
  add_filter( 'modula_shortcode_item_data', 'modula_check_lightboxes_and_links', 15, 3 );
21
  add_filter( 'modula_shortcode_item_data', 'modula_check_hover_effect', 20, 3 );
22
  add_filter( 'modula_shortcode_item_data', 'modula_check_custom_grid', 25, 3 );
 
23
  }
24
 
25
  public function add_gallery_scripts() {
26
 
27
  wp_register_style( 'lightbox2_stylesheet', MODULA_URL . 'assets/css/lightbox.min.css', null, MODULA_LITE_VERSION );
28
-
29
- // @todo: move effects to modula style
30
  wp_register_style( 'modula', MODULA_URL . 'assets/css/modula.css', null, MODULA_LITE_VERSION );
31
- wp_register_style( 'modula-effects', MODULA_URL . 'assets/css/effects.css', null, MODULA_LITE_VERSION );
32
 
33
  // Scripts necessary for some galleries
34
  wp_register_script( 'lightbox2_script', MODULA_URL . 'assets/js/lightbox.min.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
35
  wp_register_script( 'packery', MODULA_URL . 'assets/js/packery.min.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
 
36
 
37
  // @todo: minify all css & js for a better optimization.
38
  wp_register_script( 'modula', MODULA_URL . 'assets/js/jquery-modula.min.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
@@ -105,6 +104,10 @@ class Modula_Shortcode {
105
  wp_enqueue_script( 'packery' );
106
  }
107
 
 
 
 
 
108
  /* Enqueue lightbox related scripts & styles */
109
  switch ( $settings['lightbox'] ) {
110
  case "lightbox2":
@@ -119,7 +122,7 @@ class Modula_Shortcode {
119
 
120
  // Main CSS & JS
121
  $necessary_scripts = apply_filters( 'modula_necessary_scripts', array( 'modula' ) );
122
- $necessary_styles = apply_filters( 'modula_necessary_styles', array( 'modula', 'modula-effects' ) );
123
 
124
  if ( ! empty( $necessary_scripts ) ) {
125
  foreach ( $necessary_scripts as $script ) {
@@ -159,6 +162,7 @@ class Modula_Shortcode {
159
  'enableResponsive' => isset( $settings['enable_responsive'] ) ? $settings['enable_responsive'] : 0,
160
  'tabletColumns' => isset( $settings['tablet_columns'] ) ? $settings['tablet_columns'] : 2,
161
  'mobileColumns' => isset( $settings['mobile_columns'] ) ? $settings['mobile_columns'] : 1,
 
162
  );
163
 
164
  $template_data['js_config'] = apply_filters( 'modula_gallery_settings', $js_config, $settings );
20
  add_filter( 'modula_shortcode_item_data', 'modula_check_lightboxes_and_links', 15, 3 );
21
  add_filter( 'modula_shortcode_item_data', 'modula_check_hover_effect', 20, 3 );
22
  add_filter( 'modula_shortcode_item_data', 'modula_check_custom_grid', 25, 3 );
23
+ add_filter( 'modula_shortcode_item_data', 'modula_enable_lazy_load', 30, 3 );
24
  }
25
 
26
  public function add_gallery_scripts() {
27
 
28
  wp_register_style( 'lightbox2_stylesheet', MODULA_URL . 'assets/css/lightbox.min.css', null, MODULA_LITE_VERSION );
 
 
29
  wp_register_style( 'modula', MODULA_URL . 'assets/css/modula.css', null, MODULA_LITE_VERSION );
 
30
 
31
  // Scripts necessary for some galleries
32
  wp_register_script( 'lightbox2_script', MODULA_URL . 'assets/js/lightbox.min.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
33
  wp_register_script( 'packery', MODULA_URL . 'assets/js/packery.min.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
34
+ wp_register_script( 'lazysizes', MODULA_URL . 'assets/js/lazysizes.min.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
35
 
36
  // @todo: minify all css & js for a better optimization.
37
  wp_register_script( 'modula', MODULA_URL . 'assets/js/jquery-modula.min.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
104
  wp_enqueue_script( 'packery' );
105
  }
106
 
107
+ if ( '1' == $settings['lazy_load'] ) {
108
+ wp_enqueue_script( 'lazysizes' );
109
+ }
110
+
111
  /* Enqueue lightbox related scripts & styles */
112
  switch ( $settings['lightbox'] ) {
113
  case "lightbox2":
122
 
123
  // Main CSS & JS
124
  $necessary_scripts = apply_filters( 'modula_necessary_scripts', array( 'modula' ) );
125
+ $necessary_styles = apply_filters( 'modula_necessary_styles', array( 'modula' ) );
126
 
127
  if ( ! empty( $necessary_scripts ) ) {
128
  foreach ( $necessary_scripts as $script ) {
162
  'enableResponsive' => isset( $settings['enable_responsive'] ) ? $settings['enable_responsive'] : 0,
163
  'tabletColumns' => isset( $settings['tablet_columns'] ) ? $settings['tablet_columns'] : 2,
164
  'mobileColumns' => isset( $settings['mobile_columns'] ) ? $settings['mobile_columns'] : 1,
165
+ 'lazyLoad' => isset( $settings['lazy_load'] ) ? $settings['lazy_load'] : 1,
166
  );
167
 
168
  $template_data['js_config'] = apply_filters( 'modula_gallery_settings', $js_config, $settings );
includes/public/modula-helper-functions.php CHANGED
@@ -120,4 +120,23 @@ function modula_check_custom_grid( $item_data, $item, $settings ) {
120
 
121
  return $item_data;
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  }
120
 
121
  return $item_data;
122
 
123
+ }
124
+
125
+ function modula_enable_lazy_load( $item_data, $item, $settings ){
126
+
127
+ if ( '1' != $settings['lazy_load'] ) {
128
+ return $item_data;
129
+ }
130
+
131
+ if ( isset( $item_data['img_classes'] ) && is_array( $item_data['img_classes'] ) ) {
132
+ $item_data['img_classes'][] = 'lazyload';
133
+ }
134
+
135
+ if ( isset( $item_data['img_attributes']['src'] ) ) {
136
+ unset( $item_data['img_attributes']['src'] );
137
+ }
138
+
139
+ $item_data['img_attributes']['data-source'] = 'modula';
140
+
141
+ return $item_data;
142
  }
includes/public/templates/items/item.php CHANGED
@@ -12,7 +12,7 @@
12
 
13
  <?php do_action( 'modula_item_after_image', $data ); ?>
14
 
15
- <div class="figc">
16
  <div class="figc-inner">
17
  <?php if ( ! $data->hide_title ): ?>
18
  <h2 class='jtg-title'><?php echo wp_kses_post( $data->title ); ?></h2>
12
 
13
  <?php do_action( 'modula_item_after_image', $data ); ?>
14
 
15
+ <div class="figc<?php echo '' == $data->title ? ' no-title' : '' ?><?php echo '' == $data->description ? ' no-description' : '' ?>">
16
  <div class="figc-inner">
17
  <?php if ( ! $data->hide_title ): ?>
18
  <h2 class='jtg-title'><?php echo wp_kses_post( $data->title ); ?></h2>