Browse Source

dont turn it into an array, keep it as a nodeList

pull/47/head
Raphael Eidus 11 years ago
parent
commit
5cdfa2df3b
  1. 4
      dist/echo.js
  2. 2
      dist/echo.min.js
  3. 4
      src/echo.js

4
dist/echo.js vendored

@ -32,11 +32,11 @@ window.Echo = (function (global, document, undefined) {
*/
var _pollImages = function () {
var src,
length,
i,
elem,
view,
nodes = [].slice.call(document.querySelectorAll('img[data-echo]'));
nodes = document.querySelectorAll('img[data-echo]'),
length = nodes.length;
view = {
l: 0 - offset.l,
t: 0 - offset.t,

2
dist/echo.min.js vendored

@ -1,2 +1,2 @@
/*! Echo v1.5.0 | (c) 2014 @toddmotto | MIT license | github.com/toddmotto/echo */
window.Echo=function(a,b){"use strict";var c,d,e,f,g=function(){},h=function(a,b){var c=a.getBoundingClientRect();return c.right>=b.l&&c.bottom>=b.t&&c.left<=b.r&&c.top<=b.b},i=function(){var a,d,e,i,j,k=[].slice.call(b.querySelectorAll("img[data-echo]"));for(j={l:0-c.l,t:0-c.t,b:(window.innerHeight||b.documentElement.clientHeight)+c.b,r:(window.innerWidth||b.documentElement.clientWidth)+c.r},e=0;d>e;e++)i=k[e],h(i,j)?(f&&i.setAttribute("data-echo-placeholder",i.src),i.src=i.getAttribute("data-echo"),f||i.removeAttribute("data-echo"),g(i,"load")):f&&(a=i.getAttribute("data-echo-placeholder"))&&(i.src=a,i.removeAttribute("data-echo-placeholder"),g(i,"unload"));d||l()},j=function(){clearTimeout(e),e=setTimeout(i,d)},k=function(e){function h(a,b){return parseInt(a||b,10)}e=e||{};var k=e.offset||0,l=e.offsetVertical||k,m=e.offsetHorizontal||k;c={t:h(e.offsetTop,l),b:h(e.offsetBottom,l),l:h(e.offsetLeft,m),r:h(e.offsetRight,m)},d=h(e.throttle,250),f=!!e.unload,g=e.callback||g,i(),b.addEventListener?(a.addEventListener("scroll",j,!1),a.addEventListener("load",j,!1)):(a.attachEvent("onscroll",j),a.attachEvent("onload",j))},l=function(){b.removeEventListener?a.removeEventListener("scroll",j):a.detachEvent("onscroll",j),clearTimeout(e)};return{init:k,detach:l,render:i}}(this,document);
window.Echo=function(a,b){"use strict";var c,d,e,f,g=function(){},h=function(a,b){var c=a.getBoundingClientRect();return c.right>=b.l&&c.bottom>=b.t&&c.left<=b.r&&c.top<=b.b},i=function(){var a,d,e,i,j=b.querySelectorAll("img[data-echo]"),k=j.length;for(i={l:0-c.l,t:0-c.t,b:(window.innerHeight||b.documentElement.clientHeight)+c.b,r:(window.innerWidth||b.documentElement.clientWidth)+c.r},d=0;k>d;d++)e=j[d],h(e,i)?(f&&e.setAttribute("data-echo-placeholder",e.src),e.src=e.getAttribute("data-echo"),f||e.removeAttribute("data-echo"),g(e,"load")):f&&(a=e.getAttribute("data-echo-placeholder"))&&(e.src=a,e.removeAttribute("data-echo-placeholder"),g(e,"unload"));k||l()},j=function(){clearTimeout(e),e=setTimeout(i,d)},k=function(e){function h(a,b){return parseInt(a||b,10)}e=e||{};var k=e.offset||0,l=e.offsetVertical||k,m=e.offsetHorizontal||k;c={t:h(e.offsetTop,l),b:h(e.offsetBottom,l),l:h(e.offsetLeft,m),r:h(e.offsetRight,m)},d=h(e.throttle,250),f=!!e.unload,g=e.callback||g,i(),b.addEventListener?(a.addEventListener("scroll",j,!1),a.addEventListener("load",j,!1)):(a.attachEvent("onscroll",j),a.attachEvent("onload",j))},l=function(){b.removeEventListener?a.removeEventListener("scroll",j):a.detachEvent("onscroll",j),clearTimeout(e)};return{init:k,detach:l,render:i}}(this,document);

4
src/echo.js

@ -31,11 +31,11 @@ window.Echo = (function (global, document, undefined) {
*/
var _pollImages = function () {
var src,
length,
i,
elem,
view,
nodes = [].slice.call(document.querySelectorAll('img[data-echo]'));
nodes = document.querySelectorAll('img[data-echo]'),
length = nodes.length;
view = {
l: 0 - offset.l,
t: 0 - offset.t,

Loading…
Cancel
Save