|
|
|
@ -1,11 +1,20 @@
|
|
|
|
|
(function() { |
|
|
|
|
(function (root, factory) { |
|
|
|
|
if (typeof define === 'function' && define.amd) { |
|
|
|
|
define(function() { |
|
|
|
|
return factory(root); |
|
|
|
|
}); |
|
|
|
|
} else if (typeof exports === 'object') { |
|
|
|
|
module.exports = factory; |
|
|
|
|
} else { |
|
|
|
|
root.echo = factory(root); |
|
|
|
|
} |
|
|
|
|
})(this, function (root) { |
|
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
var echo = {}; |
|
|
|
|
var root = {}; |
|
|
|
|
|
|
|
|
|
var callback = function () { |
|
|
|
|
}; |
|
|
|
|
var callback = function () {}; |
|
|
|
|
|
|
|
|
|
var offset, poll, delay, useDebounce, unload; |
|
|
|
|
|
|
|
|
@ -35,7 +44,7 @@
|
|
|
|
|
|
|
|
|
|
echo.init = function (opts) { |
|
|
|
|
opts = opts || {}; |
|
|
|
|
root = opts.viewport || this || (0,eval)('this') |
|
|
|
|
root = opts.viewport || this || (0,eval)('this'); |
|
|
|
|
var offsetAll = opts.offset || 0; |
|
|
|
|
var offsetVertical = opts.offsetVertical || offsetAll; |
|
|
|
|
var offsetHorizontal = opts.offsetHorizontal || offsetAll; |
|
|
|
@ -69,8 +78,8 @@
|
|
|
|
|
var view = { |
|
|
|
|
l: 0 - offset.l, |
|
|
|
|
t: 0 - offset.t, |
|
|
|
|
b: (root.innerHeight || root.clientHeight) + offset.b, |
|
|
|
|
r: (root.innerWidth || root.clientWidth) + offset.r |
|
|
|
|
b: (root.innerHeight || document.documentElement.clientHeight) + offset.b, |
|
|
|
|
r: (root.innerWidth || document.documentElement.clientWidth) + offset.r |
|
|
|
|
}; |
|
|
|
|
for (var i = 0; i < length; i++) { |
|
|
|
|
elem = nodes[i]; |
|
|
|
@ -121,14 +130,6 @@
|
|
|
|
|
clearTimeout(poll); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if ((typeof module !== "undefined" && module !== null) && module.exports) { |
|
|
|
|
module.exports = echo; |
|
|
|
|
} else if (typeof define === 'function') { |
|
|
|
|
define(function() { |
|
|
|
|
return echo; |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
root.echo = echo; |
|
|
|
|
} |
|
|
|
|
}()); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|