=s.oldScroll,u=h&&p,c=!h&&!p,!g&&u?(d.queueTrigger(s.backward),o[d.group.id]=d.group):!g&&c?(d.queueTrigger(s.forward),o[d.group.id]=d.group):g&&s.oldScroll>=d.triggerPoint&&(d.queueTrigger(s.forward),o[d.group.id]=d.group)}}return n.requestAnimationFrame(function(){for(var t in o)o[t].flushTriggers()}),this},e.findOrCreateByElement=function(t){return e.findByElement(t)||new e(t)},e.refreshAll=function(){for(var t in o)o[t].refresh()},e.findByElement=function(t){return o[t.waypointContextKey]},window.onload=function(){r&&r(),e.refreshAll()},n.requestAnimationFrame=function(e){var i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||t;i.call(window,e)},n.Context=e}(),function(){"use strict";function t(t,e){return t.triggerPoint-e.triggerPoint}function e(t,e){return e.triggerPoint-t.triggerPoint}function i(t){this.name=t.name,this.axis=t.axis,this.id=this.name+"-"+this.axis,this.waypoints=[],this.clearTriggerQueues(),o[this.axis][this.name]=this}var o={vertical:{},horizontal:{}},n=window.Waypoint;i.prototype.add=function(t){this.waypoints.push(t)},i.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}},i.prototype.flushTriggers=function(){for(var i in this.triggerQueues){var o=this.triggerQueues[i],n="up"===i||"left"===i;o.sort(n?e:t);for(var r=0,s=o.length;s>r;r+=1){var a=o[r];(a.options.continuous||r===o.length-1)&&a.trigger([i])}}this.clearTriggerQueues()},i.prototype.next=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints),o=i===this.waypoints.length-1;return o?null:this.waypoints[i+1]},i.prototype.previous=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints);return i?this.waypoints[i-1]:null},i.prototype.queueTrigger=function(t,e){this.triggerQueues[e].push(t)},i.prototype.remove=function(t){var e=n.Adapter.inArray(t,this.waypoints);e>-1&&this.waypoints.splice(e,1)},i.prototype.first=function(){return this.waypoints[0]},i.prototype.last=function(){return this.waypoints[this.waypoints.length-1]},i.findOrCreate=function(t){return o[t.axis][t.name]||new i(t)},n.Group=i}(),function(){"use strict";function t(t){this.$element=e(t)}var e=$ezJQuery,i=window.Waypoint;e.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],function(e,i){t.prototype[i]=function(){var t=Array.prototype.slice.call(arguments);return this.$element[i].apply(this.$element,t)}}),e.each(["extend","inArray","isEmptyObject"],function(i,o){t[o]=e[o]}),i.adapters.push({name:"jquery",Adapter:t}),i.Adapter=t}(),function(){"use strict";function t(t){return function(){var i=[],o=arguments[0];return t.isFunction(arguments[0])&&(o=t.extend({},arguments[1]),o.handler=arguments[0]),this.each(function(){var n=t.extend({},o,{element:this});"string"==typeof n.context&&(n.context=t(this).closest(n.context)[0]),i.push(new e(n))}),i}}var e=window.Waypoint;$ezJQuery&&($ezJQuery.fn.waypoint=t($ezJQuery)),window.Zepto&&(window.Zepto.fn.waypoint=t(window.Zepto))}();
!function(){"use strict";function t(s){this.options=e.extend({},i.defaults,t.defaults,s),this.element=this.options.element,this.$element=e(this.element),this.createWrapper(),this.createWaypoint()}var e=$ezJQuery,i=window.Waypoint;t.prototype.createWaypoint=function(){var t=this.options.handler;this.waypoint=new i(e.extend({},this.options,{element:this.wrapper,handler:e.proxy(function(e){var i=this.options.direction.indexOf(e)>-1,s=i?this.$element.outerHeight(!0):"";this.$wrapper.height(s),this.$element.toggleClass(this.options.stuckClass,i),t&&t.call(this,e)},this)}))},t.prototype.createWrapper=function(){this.options.wrapper&&this.$element.wrap(this.options.wrapper),this.$wrapper=this.$element.parent(),this.wrapper=this.$wrapper[0]},t.prototype.destroy=function(){this.$element.parent()[0]===this.wrapper&&(this.waypoint.destroy(),this.$element.removeClass(this.options.stuckClass),this.options.wrapper&&this.$element.unwrap())},t.defaults={wrapper:'',stuckClass:"stuck",direction:"down right"},i.Sticky=t}();
if ( !!$ezJQuery('#ez-sticky-ad-1').length && !$ezJQuery('#ez-sticky-ad-1').is(':empty')) {
__JASS.onWindowLoad(run);
}
function run() {
var stickyElement = function (stickyAdPosition) {
var stickyEl = document.querySelector("#ez-sticky-ad-" + stickyAdPosition);
var stopEl = document.querySelector('.ezoic-sticky-cutoff');
if (stickyEl == null || stopEl == null) return;
var stickyElExtraOffset = ezGetTopPositionForAd(stickyEl);
var stopElWP = new Waypoint({
element: stopEl,
handler: function (direction) {
if (direction == 'down') {
var footerOffset = $ezJQuery(stopEl).offset();
$ezJQuery(stickyEl).css({
position: 'absolute',
top: footerOffset.top - stickyElExtraOffset - $ezJQuery(stickyEl).outerHeight()
});
} else if (direction == 'up') {
$ezJQuery(stickyEl).attr('style', '');
}
},
offset: function () {
return $ezJQuery(stickyEl).outerHeight();
}
});
var myStickyEl = new Waypoint.Sticky({
element: stickyEl,
wrapper: false,
stuckClass: 'ez-sticky-class'
});
};
var ezGetTopPositionForAd = function (docEl) {
var stickyElExtraTop = 0;
var el = $ezJQuery(docEl);
if (el.offsetParent()) {
el = el.offsetParent();
var maxLoops = 10;
var currentLoop = 1;
do {
stickyElExtraTop += el[0].offsetTop;
currentLoop++;
if (currentLoop > maxLoops || el.prop('tagName') == 'HTML') break;
} while (el = el.offsetParent());
}
return stickyElExtraTop;
};
var ezCheckWayRefresh = function () {
var changed = false;
var height = ezStickyHeightEl.height();
var sidebarHeight = ezSidebarHeightEl.height();
height = Math.floor(height);
sidebarHeight = Math.floor(sidebarHeight);
if (height != ezStickyCurrentHeight) {
ezStickyCurrentHeight = height;
changed = true;
}
if (sidebarHeight != ezSidebarCurrentHeight) {
ezSidebarCurrentHeight = sidebarHeight;
changed = true;
}
if (changed == true) {
Waypoint.refreshAll();
}
};
var ezStickyHeightEl = $ezJQuery('#stylesheet_body');
var ezStickyCurrentHeight = ezStickyHeightEl.height();
var ezSidebarHeightEl = $ezJQuery('.ezSidebar');
var ezSidebarCurrentHeight = ezSidebarHeightEl.height();
if ($ezJQuery(".ezoic-sticky-cutoff").offset().top > ($ezJQuery("#ez-sticky-ad-1").offset().top + $ezJQuery('#ez-sticky-ad-1').height())) {
stickyElement(1);
$ezJQuery(window).on("scroll", function () {
ezCheckWayRefresh();
});
window.setInterval(function () {
ezCheckWayRefresh();
}, 5000);
}
}
}
})();