1var COBJustifiedGallery; 2var COBMasonryGallery; 3 4 5(function ($) { 6 7 COBJustifiedGallery = function (settings) { 8 9 this.settings = settings; 10 this.nodeClass = '.fl-node-' + settings.id; 11 this.node = $(this.nodeClass); 12 this.wrapperClass = this.nodeClass + ' .' + settings.wrapperClass; 13 this.wrapper = $(this.wrapperClass); 14 this.postClass = this.wrapperClass + ' .' + settings.itemClass; 15 //this.paginationClass = '.' + settings.paginationClass; 16 //this.paginationNextClass = '.' + settings.paginationNextClass; 17 this.paginationClass = this.nodeClass + ' .' + settings.paginationClass; 18 this.paginationNextClass = this.nodeClass + ' .' + settings.paginationNextClass; 19 20 //if (this._hasPosts()) { 21 22 // Justified Gallery does not support lazy load so force lazy loading now 23 this._forceLazyLoad(this.wrapper) ; 24 25 this._initLayout(); 26 this._initInfiniteScroll(); 27 28 $(window).resize($.proxy(this._initLayout, this)); 29 30 //} 31 32 }; 33 34 COBJustifiedGallery.prototype = { 35 36 settings: {}, 37 nodeClass: '', 38 node: null, 39 wrapperClass: '', 40 wrapper: null, 41 postClass: '', 42 paginationClass: '', 43 paginationNextClass: '', 44 currentBreakpoint: '', 45 lazyLoading: false, 46 lazyLoaded: [], 47 48 _hasPosts: function () { 49 50 return $(this.postClass).length > 0; 51 52 }, 53 54 _initLayout: function () { 55 56 this._gridLayout(); 57 58 //// Bind Images Lazy Loaded. 59 //var wrap = $(this.wrapperClass); 60 //var self = this; 61 //var callback = this._onImageLazyLoaded; 62 // 63 //this.wrapper.delegate('img', 'lazyload', function () { 64 // $.proxy(callback, self)(this); 65 //}); 66 67 }, 68 69 _gridLayout: function () { 70 71 var breakpoint = this._getBreakpoint(); 72 73 if( this.currentBreakpoint !== null && breakpoint.key != this.currentBreakpoint.key ) { 74 75 this.currentBreakpoint = breakpoint; 76 77 this.wrapper.justifiedGallery({ 78 rowHeight: this.currentBreakpoint.rowHeight, 79 lastRow: 'justify', 80 margins: this.currentBreakpoint.margins, 81 captions: this.settings.captions, 82 selector: this.settings.selector, 83 cssAnimation: this.settings.cssAnimation 84 }); 85 86 } 87 88 }, 89 90 _initInfiniteScroll: function () { 91 92 if (this.settings.pagination == 'scroll' && typeof FLBuilder === 'undefined') { 93 this._infiniteScroll(); 94 } 95 96 }, 97 98 _infiniteScroll: function (settings) { 99 100 this.wrapper.infinitescroll({ 101 navSelector: this.paginationClass, 102 nextSelector: this.paginationNextClass, 103 itemSelector: this.postClass, 104 prefill: true, 105 bufferPx: 200, 106 loading: { 107 msgText: 'Loading', 108 finishedMsg: '', 109 img: this.settings.loaderImg, 110 speed: 1 111 } 112 }, $.proxy(this._infiniteScrollComplete, this)); 113 114 //setTimeout(function () { 115 // $(window).trigger('resize'); 116 //}, 100); 117 118 }, 119 120 _infiniteScrollComplete: function (elements) { 121 122 elements = $(elements); 123 124 // Force Lazy Load of img. 125 this._forceLazyLoad(elements) ; 126 //elements.find('img[data-src]').each(function () { 127 // var img = $(this) 128 // img.attr('src', img.data('src')); 129 // img.removeClass('lasy-hidden'); 130 // img.addClass('lasy-loaded'); 131 //}); 132 133 this.wrapper.justifiedGallery('norewind'); 134 135 }, 136 137 _getBreakpoint: function() { 138
139 // Breakpoints have to be ordered from geatest to lowest max width 140 for( var i = 0; i < this.settings.breakpoints.length; i++ ) { 141 142 var breakpoint = this.settings.breakpoints[i]; 143 144 if( breakpoint.maxWidth > window.innerWidth ) { 145 146 return breakpoint; 147 break; 148 149 } 150 151 } 152 153 }, 154 155 _forceLazyLoad: function(elements) { 156 157 // Force Lazy Load of img. 158 elements.find('img[data-src]').each(function () { 159 var img = $(this) 160 img.attr('src', img.data('src')); 161 img.removeClass('lasy-hidden'); 162 img.addClass('lasy-loaded'); 163 }); 164 165 } 166 167 //_onImageLazyLoaded: function (img) { 168 // this.lazyLoaded.push(img); 169 // 170 // if (this.lazyLoading == false) { 171 // this.lazyLoading = true; 172 // 173 // var container = $(this.wrapperClass); 174 // 175 // container.imagesLoaded($.proxy(function () { 176 // this.lazyLoading = false; 177 // elements = $(this.lazyLoaded); 178 // this.lazyLoaded = []; 179 // this._imagesLazyLoaded(elements); 180 // }, this)); 181 // } 182 //}, 183 // 184 //_imagesLazyLoaded: function (items) { 185 // var wrap = $(this.wrapperClass); 186 // 187 // wrap.masonry('layout'); 188 //} 189 }; 190 191 COBMasonryGallery = function (settings) { 192 193 this.settings = settings; 194 this.nodeClass = '.fl-node-' + settings.id; 195 this.node = $(this.nodeClass); 196 this.wrapperClass = this.nodeClass + ' .' + settings.wrapperClass; 197 this.wrapper = $(this.wrapperClass); 198 this.postClass = this.wrapperClass + ' .' + settings.itemClass; 199 this.paginationClass = this.nodeClass + ' .' + settings.paginationClass; 200 this.paginationNextClass = this.nodeClass + ' .' + settings.paginationNextClass; 201 202 //if (this._hasPosts()) { 203 204 this._initLayout(); 205 this._initInfiniteScroll(); 206 207 //} 208 209 }; 210 211 COBMasonryGallery.prototype = { 212 213 settings: {}, 214 nodeClass: '', 215 node: null, 216 wrapperClass: '', 217 wrapper: null, 218 postClass: '', 219 paginationClass: '', 220 paginationNextClass: '', 221 lazyLoading: false, 222 lazyLoaded: [], 223 224 _hasPosts: function () { 225 return $(this.postClass).length > 0; 226 }, 227 228 _initLayout: function () { 229 230 this._gridLayout(); 231 232 $(this.postClass).css('visibility', 'visible'); 233 234 // Bind Images Lazy Loaded. 235 var self = this, 236 callback = this._onImageLazyLoaded; 237 238 this.wrapper.delegate('img', 'lazyload', function () { 239 $.proxy(callback, self)(this); 240 }); 241 242 }, 243 244 _gridLayout: function () { 245 246 var self = this; 247 248 this.wrapper.masonry({ 249 columnWidth: this.postClass, 250 itemSelector: this.postClass, 251 transitionDuration: 0 252 }); 253 254 this.wrapper.imagesLoaded(function () { 255 self.wrapper.masonry(); 256 }); 257 258 }, 259 260 _initInfiniteScroll: function () { 261 262 if (this.settings.pagination == 'scroll' && typeof FLBuilder === 'undefined') { 263 this._infiniteScroll(); 264 } 265 266 }, 267 268 _infiniteScroll: function (settings) { 269 270 this.wrapper.infinitescroll({ 271 navSelector: this.paginationClass, 272 nextSelector: this.paginationNextClass, 273 itemSelector: this.postClass, 274 prefill: true, 275 bufferPx: 200, 276 loading: { 277 msgText: 'Loading', 278 finishedMsg: '', 279 img: this.settings.loaderImg, 280 speed: 1 281 } 282 }, $.proxy(this._infiniteScrollComplete, this)); 283 284 setTimeout(function () { 285 $(window).trigger('resize'); 286 }, 100); 287 288 }, 289 290 _infiniteScrollComplete: function (elements) { 291 292 var self = this; 293 294 elements = $(elements); 295 296 // Force Lazy Load of img. 297 elements.find('img[data-src]').each(function () { 298 var img = $(this) 299 img.attr('src', img.data('src')); 300 img.removeClass('lasy-hidden'); 301 img.addClass('lasy-loaded'); 302 }); 303 304 this.wrapper.imagesLoaded(function () { 305 self.wrapper.masonry('appended', elements); 306 elements.css('visibility', 'visible'); 307 }); 308 309 }, 310 311 _onImageLazyLoaded: function (img) { 312 313 this.lazyLoaded.push(img); 314 315 if (this.lazyLoading == false) { 316 this.lazyLoading = true; 317 318 this.wrapper.imagesLoaded($.proxy(function () { 319 this.lazyLoading = false;
320 elements = $(this.lazyLoaded); 321 this.lazyLoaded = []; 322 this._imagesLazyLoaded(elements); 323 }, this)); 324 } 325 326 }, 327 328 // nj_150410: 329 _imagesLazyLoaded: function (items) { 330 331 this.wrapper.masonry('layout'); 332 333 } 334 }; 335 336})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.