1/*� 2* Advanced Plugins� 3*� 4* @author Advanced Plugins� 5* @copyright Advanced Plugins� 6* @website https://advancedplugins.com� 7*/� 8� 9jQuery(function($) {� 10� 11(function($, window, document, undefined) {� 12 var $window = $(window);� 13� 14 $.fn.lazyload = function(options) {� 15 var elements = this;� 16 var $container;� 17 var settings = {� 18 threshold : 0,� 19 failure_limit : 0,� 20 event : "scroll.lazyload",� 21 effect : "show",� 22 container : window,� 23 data_attribute : "original",� 24 data_srcset : "srcset",� 25 skip_invisible : false,� 26 appear : null,� 27 load : null,� 28 trigger_class : null,� 29 placeholder : "data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs="� 30 };� 31� 32 function update() {� 33 var counter = 0;� 34� 35 elements.each(function() {� 36 var $this = $(this);� 37 if (settings.skip_invisible && !$this.is(":visible")) {� 38 return;� 39 }� 40 if ($.abovethetop(this, settings) ||� 41 $.leftofbegin(this, settings)) {� 42 /* Nothing. */� 43 } else if (!$.belowthefold(this, settings) &&� 44 !$.rightoffold(this, settings)) {� 45 $this.trigger("appear");� 46 /* if we found an image we'll load, reset the counter */� 47 counter = 0;� 48 } else {� 49 if (++counter > settings.failure_limit) {� 50 return false;� 51 }� 52 }� 53 });� 54� 55 }� 56� 57 if(options) {� 58 /* Maintain BC for a couple of versions. */� 59 if (undefined !== options.failurelimit) {� 60 options.failure_limit = options.failurelimit;� 61 delete options.failurelimit;� 62 }� 63 if (undefined !== options.effectspeed) {� 64 options.effect_speed = options.effectspeed;� 65 delete options.effectspeed;� 66 }� 67� 68 $.extend(settings, options);� 69 }� 70� 71 /* Cache container as jQuery as object. */� 72 $container = (settings.container === undefined ||� 73 settings.container === window) ? $window : $(settings.container);� 74� 75 /* Fire one scroll event per scroll. Not one scroll event per image. */� 76 if (0 === settings.event.indexOf("scroll")) {� 77 $container.off(settings.event).on(settings.event, function() {� 78 return update();� 79 });� 80 }� 81� 82 this.each(function() {� 83 var self = this;� 84 var $self = $(self);� 85� 86 self.loaded = false;� 87� 88 /* If no src attribute given use data:uri. */� 89 if ($self.attr("src") === undefined || $self.attr("src") === false) {� 90 if ($self.is("img")) {� 91 $self.attr("src", settings.placeholder);� 92 }� 93 }� 94� 95 /* When appear is triggered load original image. */� 96 $self.one("appear", function() {� 97 if (!this.loaded) {� 98 if (settings.appear) {� 99 var elements_left = elements.length;� 100 settings.appear.call(self, elements_left, settings);� 101 }� 102 $("<img />")� 103 .one("load", function() {� 104 var original = $self.attr("data-" + settings.data_attribute);� 105 var srcset = $self.attr("data-" + settings.data_srcset);� 106� 107 if (original !== $self.attr("src")) {� 108 $self.hide();� 109 if ($self.is("img")) {� 110 $self.attr("src", original);� 111 if (srcset !== null) {� 112 $self.attr("srcset", srcset);� 113 }� 114 } if ($self.is("video")) {� 115 $self.attr("poster", original);� 116 } else {� 117 $self.css("background-image", "url('" + original + "')");� 118 }� 119 $self[settings.effect](settings.effect_speed);� 120 }� 121� 122 self.loaded = true;� 123� 124 /* Remove image from array so it is not looped next time. */�
125 var temp = $.grep(elements, function(element) {� 126 return !element.loaded;� 127 });� 128 elements = $(temp);� 129� 130 if (settings.load) {� 131 var elements_left = elements.length;� 132 settings.load.call(self, elements_left, settings);� 133 }� 134 })� 135 .bind("error", function(){� 136 � 137 if(settings.trigger_class)� 138 $(self).removeClass(settings.trigger_class);� 139� 140 $(self).removeClass('uitlazyload');� 141 $(self).trigger("error");� 142� 143 })� 144 .attr({� 145 "src": $self.attr("data-" + settings.data_attribute),� 146 "srcset": $self.attr("data-" + settings.data_srcset) || ""� 147 });� 148 }� 149 });� 150� 151 /* When wanted event is triggered load original image */� 152 /* by triggering appear. */� 153 if (0 !== settings.event.indexOf("scroll")) {� 154 $self.off(settings.event).on(settings.event, function() {� 155 if (!self.loaded) {� 156 $self.trigger("appear");� 157 }� 158 });� 159 }� 160 });� 161� 162 /* Check if something appears when window is resized. */� 163 $window.off("resize.lazyload").bind("resize.lazyload", function() {� 164 update();� 165 });� 166� 167 /* With IOS5 force loading images when navigating with back button. */� 168 /* Non optimal workaround. */� 169 if ((/(?:iphone|ipod|ipad).*os 5/gi).test(navigator.appVersion)) {� 170 $window.on("pageshow", function(event) {� 171 if (event.originalEvent && event.originalEvent.persisted) {� 172 elements.each(function() {� 173 $(this).trigger("appear");� 174 });� 175 }� 176 });� 177 }� 178� 179 /* Force initial check if images should appear. */� 180 $(function() {� 181 update();� 182 });� 183� 184 return this;� 185 };� 186� 187 /* Convenience methods in jQuery namespace. */� 188 /* Use as $.belowthefold(element, {threshold : 100, container : window}) */� 189� 190 $.belowthefold = function(element, settings) {� 191 var fold;� 192� 193 if (settings.container === undefined || settings.container === window) {� 194 fold = (window.innerHeight ? window.innerHeight : $window.height()) + $window.scrollTop();� 195 } else {� 196 fold = $(settings.container).offset().top + $(settings.container).height();� 197 }� 198� 199 return fold <= $(element).offset().top - settings.threshold;� 200 };� 201� 202 $.rightoffold = function(element, settings) {� 203 var fold;� 204� 205 if (settings.container === undefined || settings.container === window) {� 206 fold = $window.width() + $window.scrollLeft();� 207 } else {� 208 fold = $(settings.container).offset().left + $(settings.container).width();� 209 }� 210� 211 return fold <= $(element).offset().left - settings.threshold;� 212 };� 213� 214 $.abovethetop = function(element, settings) {� 215 var fold;� 216� 217 if (settings.container === undefined || settings.container === window) {� 218 fold = $window.scrollTop();� 219 } else {� 220 fold = $(settings.container).offset().top;� 221 }� 222� 223 return fold >= $(element).offset().top + settings.threshold + $(element).height();� 224 };� 225� 226 $.leftofbegin = function(element, settings) {� 227 var fold;� 228� 229 if (settings.container === undefined || settings.container === window) {� 230 fold = $window.scrollLeft();� 231 } else {� 232 fold = $(settings.container).offset().left;� 233 }� 234� 235 return fold >= $(element).offset().left + settings.threshold + $(element).width();� 236 };� 237� 238 $.inviewport = function(element, settings) {� 239 return !$.rightoffold(element, settings) && !$.leftofbegin(element, settings) &&� 240 !$.belowthefold(element, settings) && !$.abovethetop(element, settings);� 241 };� 242� 243 /* Custom selectors for your convenience. */� 244 /* Use as $("img:below-the-fold").something() or */� 245 /* $("img").filter(":below-the-fold").something() which is faster */�
246� 247 $.extend($.expr[":"], {� 248 "below-the-fold" : function(a) { return $.belowthefold(a, {threshold : 0}); },� 249 "above-the-top" : function(a) { return !$.belowthefold(a, {threshold : 0}); },� 250 "right-of-screen": function(a) { return $.rightoffold(a, {threshold : 0}); },� 251 "left-of-screen" : function(a) { return !$.rightoffold(a, {threshold : 0}); },� 252 "in-viewport" : function(a) { return $.inviewport(a, {threshold : 0}); },� 253 /* Maintain BC for couple of versions. */� 254 "above-the-fold" : function(a) { return !$.belowthefold(a, {threshold : 0}); },� 255 "right-of-fold" : function(a) { return $.rightoffold(a, {threshold : 0}); },� 256 "left-of-fold" : function(a) { return !$.rightoffold(a, {threshold : 0}); }� 257 });� 258� 259})(jQuery, window, document);� 260� 261� 262function trigger_recheck()� 263{� 264 if (jQuery('.modal.in img.uitlazyload').length > 0)� 265 {� 266 jQuery('.modal.in img.uitlazyload').each(function(){� 267 var el = jQuery(this);� 268 el.attr('src', el.attr('data-original') );� 269 el.removeClass('uitlazyload');� 270 el.attr({'data-uitlazyload': 1});� 271� 272 });� 273 }� 274� 275� 276 $('img.uitlazyload').each(function(){� 277 var t = $(this);� 278 if(t.is(':in-viewport'))� 279 {� 280 t.attr('src', t.attr('data-original') );� 281 t.removeClass('uitlazyload');� 282 t.attr({'data-uitlazyload': 1});� 283 }� 284 � 285 });� 286� 287� 288 /* $(window).scroll();*/� 289� 290}� 291function lazyload_init() {� 292 � 293� 294 � 295� 296 $("img.uitlazyload").lazyload({� 297 load: function () {� 298 � 299 jQuery(this).attr({'data-uitlazyload': 1});� 300 jQuery(this).removeClass('uitlazyload');� 301 jQuery(this).css('background-image', 'none');� 302 },� 303 'trigger_class': 'uitlazyload'� 304 });� 305� 306 if (jQuery('.content_scene_cat img.uitlazyload, .content_scene_man img.uitlazyload, .content_scene_sup img.uitlazyload, #image-block img.uitlazyload, .product-images img.uitlazyload, #thumbs_list img.uitlazyload').length > 0)� 307 {� 308 jQuery('.content_scene_cat img.uitlazyload, .content_scene_man img.uitlazyload, .content_scene_sup img.uitlazyload, #image-block img.uitlazyload, .product-images img.uitlazyload, #thumbs_list img.uitlazyload').each(function(){� 309 var el = jQuery(this);� 310 el.attr('src', el.attr('data-original') );� 311 el.removeClass('uitlazyload');� 312 el.attr({'data-uitlazyload': 1});� 313� 314 });� 315 }� 316� 317� 318}� 319� 320 $(window).on('load', function () {� 321 � 322 $("img.uitlazyload").attr({'data-uitlazyload': 0});� 323� 324 lazyload_init();� 325� 326 setInterval(function(){ trigger_recheck(); }, 200);� 327� 328 $(document).ajaxSuccess(function() {� 329 lazyload_init();� 330 });� 331� 332 $(document).on("click", function() {� 333 lazyload_init();� 334 });� 335 � 336� 337 � 338 if(jQuery('body').attr('id') == 'product')� 339 {� 340 var incremental = 0;� 341 var initiated_zoom = false;� 342 var internvalzoom = setInterval(function(){ � 343� 344 if(incremental>= 10)� 345 {� 346 clearInterval(internvalzoom);� 347 }� 348� 349 if(initiated_zoom)� 350 {� 351 clearInterval(internvalzoom);� 352 }� 353 else� 354 {� 355 if(jQuery('.zoomContainer').length > 0)� 356 {� 357 clearInterval(internvalzoom);� 358 setTimeout(function(){ jQuery('.thumb').first().click();$( window ).resize(); }, 150);� 359 setTimeout(function(){ jQuery('.thumb').first().click();$( window ).resize(); }, 250);� 360 }� 361 }� 362 incremental++;� 363� 364 }, 100);� 365 }� 366� 367});� 368� 369});
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.