1!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.OnScreen=t()}(this,function(){"use strict";function n(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{tolerance:0};if(!e)throw new Error("You should specify the element you want to test");"string"==typeof e&&(e=document.querySelector(e));var n=e.getBoundingClientRect();return 0<n.bottom-t.tolerance&&0<n.right-t.tolerance&&n.left+t.tolerance<(window.innerWidth||document.documentElement.clientWidth)&&n.top+t.tolerance<(window.innerHeight||document.documentElement.clientHeight)}function r(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{tolerance:0,container:""};if(!e)throw new Error("You should specify the element you want to test");if("string"==typeof e&&(e=document.querySelector(e)),"string"==typeof t&&(t={tolerance:0,container:document.querySelector(t)}),"string"==typeof t.container&&(t.container=document.querySelector(t.container)),t instanceof HTMLElement&&(t={tolerance:0,container:t}),!t.container)throw new Error("You should specify a container element");var n=t.container.getBoundingClientRect();return e.offsetTop+e.clientHeight-t.tolerance>t.container.scrollTop&&e.offsetLeft+e.clientWidth-t.tolerance>t.container.scrollLeft&&e.offsetLeft+t.tolerance<n.width+t.container.scrollLeft&&e.offsetTop+t.tolerance<n.height+t.container.scrollTop}function e(){var e,t,n,o=this,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{tolerance:0,debounce:100,container:window};this.options={},this.trackedElements={},Object.defineProperties(this.options,{container:{configurable:!1,enumerable:!1,get:function(){var e=void 0;return"string"==typeof i.container?e=document.querySelector(i.container):i.container instanceof HTMLElement&&(e=i.container),e||window},set:function(e){i.container=e}},debounce:{get:function(){return parseInt(i.debounce,10)||100},set:function(e){i.debounce=e}},tolerance:{get:function(){return parseInt(i.tolerance,10)||0},set:function(e){i.tolerance=e}}}),Object.defineProperty(this,"_scroll",{enumerable:!1,configurable:!1,writable:!1,value:this._debouncedScroll.call(this)}),e=document.querySelector("body"),t=function(){Object.keys(o.trackedElements).forEach(function(e){o.on("enter",e),o.on("leave",e)})},(n=window.MutationObserver||window.WebKitMutationObserver)?new n(t).observe(e,{childList:!0,subtree:!0}):(e.addEventListener("DOMNodeInserted",t,!1),e.addEventListener("DOMNodeRemoved",t,!1)),this.attach()}return Object.defineProperties(e.prototype,{_debouncedScroll:{configurable:!1,writable:!1,enumerable:!1,value:function(){var e=this,t=void 0;return function(){clearTimeout(t),t=setTimeout(function(){!function(){var o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{tolerance:0},t=Object.keys(o),i=void 0;t.length&&(i=e.container===window?n:r,t.forEach(function(n){o[n].nodes.forEach(function(t){if(i(t.node,e)?(t.wasVisible=t.isVisible,t.isVisible=!0):(t.wasVisible=t.isVisible,t.isVisible=!1),!0===t.isVisible&&!1===t.wasVisible){if(!o[n].enter)return;Object.keys(o[n].enter).forEach(function(e){"function"==typeof o[n].enter[e]&&o[n].enter[e](t.node,"enter")})}if(!1===t.isVisible&&!0===t.wasVisible){if(!o[n].leave)return;Object.keys(o[n].leave).forEach(function(e){"function"==typeof o[n].leave[e]&&o[n].leave[e](t.node,"leave")})}})}))}(e.trackedElements,e.options)},e.options.debounce)}}},attach:{configurable:!1,writable:!1,enumerable:!1,value:function(){var e=this.options.container;e instanceof HTMLElement&&"static"===window.getComputedStyle(e).position&&(e.style.position="relative"),e.addEventListener("scroll",this._scroll),window.addEventListener("resize",this._scroll),this._scroll(),this.attached=!0}},destroy:{configurable:!1,writable:!1,enumerable:!1,value:function(){this.options.container.removeEventListener("scroll",this._scroll),window.removeEventListener("resize",this._scroll),this.attached=!1}},off:{configurable:!1,writable:!1,enumerable:!1,value:function(e,t,n){var o=Object.keys(this.trackedElements[t].enter||{}),i=Object.keys(this.trackedElements[t].leave||{});if({}.hasOwnProperty.call(this.trackedElements,t))if(n){if(this.trackedElements[t][e]){var r="function"==typeof n?n.name:n;delete this.trackedElements[t][e][r]}}else delete this.trackedElements[t][e];o.length||i.length||delete this.trackedElements[t]}},on:{configurable:!1,writable:!1,enumerable:!1,value:function(e,t,n){if(!e)throw new Error("No event given. Choose either enter or leave");
vendor: 531 bytes, line 1
1if(!t)throw new Error("No selector to track");if(["enter","leave"].indexOf(e)<0)throw new Error(e+" event is not supported");({}).hasOwnProperty.call(this.trackedElements,t)||(this.trackedElements[t]={}),this.trackedElements[t].nodes=[];for(var o=0,i=document.querySelectorAll(t);o<i.length;o++){var r={isVisible:!1,wasVisible:!1,node:i[o]};this.trackedElements[t].nodes.push(r)}"function"==typeof n&&(this.trackedElements[t][e]||(this.trackedElements[t][e]={}),this.trackedElements[t][e][n.name||"anonymous"]=n)}}}),e.check=n,e});
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.