From 10b308e584382291e1a82639545e47edda48ae7f Mon Sep 17 00:00:00 2001 From: Fabian Hoffmann Date: Wed, 21 Sep 2016 20:45:21 +0200 Subject: [PATCH] set default timeout interval to 1 sec. saucelabs is too slow :( --- spec/loadIfVisibleSpec.js | 2 +- src/justlazy.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/loadIfVisibleSpec.js b/spec/loadIfVisibleSpec.js index d54ee8b..a071c36 100644 --- a/spec/loadIfVisibleSpec.js +++ b/spec/loadIfVisibleSpec.js @@ -2,7 +2,7 @@ var base64Image = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAA var base64Image2 = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"; var base64Image3 = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA9"; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 100; +jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; var triggerScrollEvent = function(y) { window.scroll(0, y); diff --git a/src/justlazy.min.js b/src/justlazy.min.js index 1ad4658..ad86957 100644 --- a/src/justlazy.min.js +++ b/src/justlazy.min.js @@ -1 +1 @@ -!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof module&&module.exports?module.exports=b():a.Justlazy=b()}(this,function(){"use strict";var a=function(a,c,d){var e=document.createElement("img");e.onload=function(){d&&d.call(e)},e.alt=c.alt,c.title&&(e.title=c.title),c.errorHandler&&e.setAttribute("onerror",c.errorHandler),c.srcset&&e.setAttribute("srcset",c.srcset),e.src=c.src,b(a,e)},b=function(a,b){var c=a.parentNode;c&&c.replaceChild(b,a)},c=function(a){return{src:a.getAttribute("data-src"),alt:a.getAttribute("data-alt"),title:a.getAttribute("data-title"),errorHandler:a.getAttribute("data-error-handler"),srcset:a.getAttribute("data-srcset")}},d=function(a){return a||{}},e=function(b,e){var f=c(b);e=d(e),f.src&&(f.alt||""===f.alt)?a(b,f,e.onloadCallback):e.onerrorCallback&&e.onerrorCallback.call(b)},f=function(a,b){var c=window.innerHeight||document.documentElement.clientHeight,d=b||0;return a.getBoundingClientRect().top-c<=d},g=function(a,b){var c=function(d){f(a,b.threshold)&&(e(a,b),window.removeEventListener?window.removeEventListener(d.type,c,!1):window.detachEvent("on"+d.type,c))};return c},h=function(a,b){var c=d(b);if(f(a,c.threshold))e(a,b);else{var h=g(a,c);window.addEventListener?window.addEventListener("scroll",h,!1):window.attachEvent("onscroll",h)}},i=function(a,b){for(var c=document.querySelectorAll("."+a),d=0;d