var isCtrl = false;
document.onkeyup=function(e)
{
if(e.which == 17) isCtrl=false;
if(e.which == 18) isAlt=false;
}
document.onkeydown=function(e)
{
if(e.which == 17) isCtrl=true;
if(e.which == 18) isAlt=true;
if(e.which == 69 && isCtrl == true && isAlt == true)
{
// if bar already exists, close it
if($ezJQuery('#ezoic-bar-overlay').length)
{
$ezJQuery('#ezoic-bar-overlay').slideDown('slow').remove();
}
else
{
init_ez_bar();
}
}
}
function ez_force_recache()
{
var url = document.URL;
//create a form object
var form = document.createElement("form");
form.setAttribute("id", "force_recache");
form.setAttribute("method", "POST");
form.setAttribute("action", url);
//create hidden field
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "ez_force_recache");
hiddenField.setAttribute("value", "force_recache");
form.appendChild(hiddenField);
//inject form and submit it
document.body.appendChild(form);
form.submit();
}
function init_ez_bar() {
// If overlay already exists, remove it
var ezOverlay = $ezJQuery('#ezoic-overlay');
if ($ezJQuery(ezOverlay.length)) {
$ezJQuery(ezOverlay).remove();
}
// Add Open Sans web font to document head
$ezJQuery('head').append(" ");
if (document.cookie.indexOf("ezoic_show_disable_ads") >= 0) {
var disable_link = "
Hide \"Disable this ad position\" placeholders. ";
} else {
var disable_link = "Disable Ad Positions ";
}
// Create the overlay element
var overlay = $ezJQuery('');
// Append it to the body
$ezJQuery(overlay).appendTo('body');
// Style for ezoic overlay
overlay.css({
'fontFamily': 'Open Sans',
'position': 'fixed',
'bottom': '0px',
'left': '0px',
'height': '50px',
'width': '100%',
'z-index': '1000000',
'backgroundColor': 'rgba(255, 255, 255, 0.9)',
'border-top': '1px solid #eeeeee',
'box-shadow': '0px 2px 2px -2px rgba(0, 0, 0, 0.25)',
'text-shadow': '0 -1px 0 rgba(0, 0, 0, 0.25)'
});
$ezJQuery('#ezoic-bar-overlay a').css({
'color': '#444444',
'fontFamily': 'Open Sans',
'text-shadow': '0 -1px 0 rgba(0, 0, 0, 0.25)'
});
$ezJQuery('#ezoic-bar-container').css({
'max-width': 'none',
'width': '100%'
});
$ezJQuery('ul#ezoic-bar-actions').css({
'float': 'left',
'height': '50px',
'line-height': '50px',
'list-style': 'none',
'margin': '0px',
'max-width': 'none',
'padding': '0px'
});
$ezJQuery('#ezoic-bar-actions li').css({
'display': 'inline',
'font-size': '14px',
'padding-left': '0px'
});
$ezJQuery('#ezoic-bar-actions li a').css({
'color': '#444444',
'font-size': '14px',
'height': '50px',
'line-height': '50px',
'padding-left': '15px',
'padding-right': '15px',
'text-align': 'center',
'text-decoration': 'none'
})
.hover(
function() {
$ezJQuery(this).css('color', '#888888');
},
function() {
$ezJQuery(this).css('color', '#444444');
}
);
$ezJQuery('#ezoic-bar-logo').css({
'color': '#444444',
'float': 'left',
'font-weight': '700',
'padding-left': '20px',
'padding-right': '20px',
'padding-top': '12px'
});
$ezJQuery('#ezoic-bar-logo img').css({
'max-height': '26px'
});
// Close ezoic window on click
$ezJQuery('#ezoic-bar-close')
.on('click', function (e) {
e.preventDefault();
$ezJQuery('#ezoic-bar-overlay').remove();
})
.css({
'float': 'right',
'line-height': '50px',
'padding': '0 20px',
'color': '#444444'
});
// trigger recache
$ezJQuery('.js-ez-force-recache')
.on('click', function (e) {
e.preventDefault();
var self = $ezJQuery(this);
var text = self.text();
self.text('Clearing cache...');
ez_force_recache();
});
$ezJQuery('.js-ez-disable-ad-positions')
.on('click', function (e) {
e.preventDefault();
var self = $ezJQuery(this);
var text = self.text();
self.text('Authorizing...');
window.location.replace("http://" + window.location.host + "/utilcave_com/auth.php?enable_ad_placeholders=1&rurl=" + encodeURIComponent(window.location.href) + "&did="+did);
});
$ezJQuery('.js-ez-enable-ad-positions')
.on('click', function (e) {
e.preventDefault();
var self = $ezJQuery(this);
var text = self.text();
self.text('Refreshing...');
window.location.replace("http://" + window.location.host + "/utilcave_com/auth.php?disable_ad_placeholders=1&rurl=" + encodeURIComponent(window.location.href));
});
// trigger hide template
$ezJQuery('.js-ez-hide-template')
.on('click', function (e) {
e.preventDefault();
var self = $ezJQuery(this);
var text = self.text();
self.text('Saving preference...');
$ezJQuery.ajax({
url: '/ezoic_ajax/hide_template.php',
data: { ezdomain: ezdomain },
success: function(data) {
self.text(text);
ez_force_recache();
}
});
});
}
if(typeof execute_ez_queue == "function")
{
if(typeof $ezJQuery != 'undefined')
{
$ezJQuery(window).load(function(){execute_ez_queue()});
}
else
{
window.onload=execute_ez_queue;
}
}
if(typeof $ezJQuery != 'undefined')
{
var inf_load;
var ez_inf_timer=0;
$ezJQuery(window).load(function()
{
inf_load = setInterval(load_il_track, 500);
$ezJQuery( "iframe[ id *= ox_frame_ ]" ).setIframeClickEvents(33).on("iframeClickEvent", ez_awesome_click);
$ezJQuery( "iframe[ id *= google ],iframe[ id *= aswift ]" ).setIframeClickEvents(5).on("iframeClickEvent", ez_awesome_click);
$ezJQuery(".OUTBRAIN>.ob-widget").setIframeClickEvents(41).on("iframeClickEvent", ez_awesome_click);
$ezJQuery("script:contains('taboola')~div[id *= 'taboola-']").setIframeClickEvents(37).on("iframeClickEvent", ez_awesome_click);
});
function load_il_track() {
ez_inf_timer++;
$ezJQuery("span.IL_AD, .IL_BASE").not("span.IL_AD *, .IL_BASE *").each(function() {
if($ezJQuery(this).data("handlersAttached") !== true) {
$ezJQuery(this).data({handlersAttached: true})
.mouseover(function() {
if(ez_inf_timer > 30) {
ez_inf_timer -= 30;
}
clearInterval(inf_load);
inf_load = setInterval(load_il_track, 500);
}).setIframeClickEvents(4).on("iframeClickEvent", ez_awesome_click);
}
});
if(ez_inf_timer > 55) {clearInterval(inf_load);}
}
function getAdUnitFromElement(item, sourceid) {
if(typeof _ezim_d === "undefined") {
return "";
}
if(sourceid == 4) {
for(key in _ezim_d) {
if(key.indexOf("inline-1") != -1) {
return key;
}
}
}
else if(sourceid == 37 || sourceid == 41) {
// check if this is a native ad
widgetwrapparent = item.parents("span.ezoic-ad");
if(widgetwrapparent.size()) {
var adid = widgetwrapparent[0].className.replace("ezoic-ad", "").trim();
// look for native ad
for(var key in _ezim_d) {
if(key.indexOf(adid) != -1) {
return key;
}
}
}
}
else {
for(key in _ezim_d) {
if(item[0].id.indexOf(key) != -1) {
return key;
}
}
}
return "";
}
function ez_awesome_click(event, two_click_indicator, stat_source_id) {
// Get data to post
var $ele = $ezJQuery(this),
ad_unit = getAdUnitFromElement($ele, stat_source_id),
width = Math.round($ele.width()),
height = Math.round($ele.height()),
params_obj = (ad_unit != "" ? _ezim_d[ad_unit] : {position_id: 0, sub_position_id: 0, full_id: "0"});
if(two_click_indicator == 0) {
// Save to sqs
document.cookie = "ezoawesome="+stat_source_id+"; path=/;";
$ezJQuery.ajax({
type: "post",
url: "/utilcave_com/awesome.php",
data: {
url: window.location.href,
width: width,
height: height,
did: did,
sourceid: stat_source_id,
uid: ezouid,
template: ezoTemplate
}
});
}
// check if clicks have been recorded for this element -- only save one two click and up to 10 normal clicks
var navs_recorded = 0, two_click_recorded = false;
if(two_click_indicator == 1) {
two_click_recorded = $ele.data("two_click_recorded") ? true : false;
if(two_click_recorded) {
return;
}
$ele.data({two_click_recorded: true});
}
else if(two_click_indicator == 0) {
navs_recorded = $ele.data("navigations_recorded")
if(!navs_recorded) {
navs_recorded = 0
}
else if(navs_recorded > 10) {
return;
}
$ele.data({navigations_recorded: navs_recorded + 1});
}
$ezJQuery.ajax({type: "post", url: "/ezoic_awesome/", data: {
url: window.location.href,
width: width,
height: height,
did: did,
sourceid: stat_source_id,
uid: ezouid,
ff: ezoFormfactor,
tid: _ezaq.template_id,
apid: params_obj.position_id,
sapid: params_obj.sub_position_id,
iuid: params_obj.full_id,
creative: (typeof params_obj.creative_id !== 'undefined' ? params_obj.creative_id : ""),
template: ezoTemplate,
twoclick: two_click_indicator
}});
}
(function($) {
// functionality for handling iframe click events
var current_frame = null,
last_current_frame = null,
active_frame = null,
last_active_element = null,
document_has_focus = false,
window_has_focus = false,
all_frames = $(),
two_click_event = false,
loop_rate = 100,
click_timeout = 800,
old_browser = typeof document.hasFocus === "undefined";
$(window).on('blur', function() {
window_has_focus = false;
if(current_frame !== null && !$(current_frame).is("iframe")) {
$(current_frame).trigger("iframeClickEvent", [0].concat($(current_frame).data("iframeclickaddtnldata")));
}
else if(last_active_element !== document.activeElement) {
last_active_element = document.activeElement;
windowBlur();
}
}).focus(function() {
window_has_focus = true;
active_frame = null;
});
// Loop to detect when window or document lose focus
function customEventsLoop() {
var doc_now_has_focus = document.hasFocus() && !document.hidden;
if(last_active_element !== document.activeElement) {
if(!window_has_focus) {
windowBlur();
}
last_active_element = document.activeElement;
document_has_focus = true; // If the active element switched, we know the document was momentarily focused on
}
if(document_has_focus && !doc_now_has_focus) {
documentBlur();
}
document_has_focus = doc_now_has_focus;
last_current_frame = current_frame;
setTimeout(customEventsLoop, loop_rate);
}
$(window).load(function() {
if(!old_browser) {
setTimeout(customEventsLoop, loop_rate);
}
});
function windowBlur() {
// Fixed window blur for when an iframe is focused on
// console.log("window blur");
if(!all_frames.is(document.activeElement)) {
active_frame = null;
return;
}
active_frame = document.activeElement;
$(active_frame).trigger("iframeClickEvent", [0].concat($(active_frame).data("iframeclickaddtnldata")))
.data({iframeclicktime: +new Date()});
(function(two_click_frame) {
two_click_event = setTimeout(function() {
$(active_frame).trigger("iframeClickEvent", [1].concat($(active_frame).data("iframeclickaddtnldata")));
}, click_timeout);
})(active_frame)
}
function documentBlur() {
// Fixed document blur for when the page loses focus
// console.log("document blur");
if(two_click_event) {
clearTimeout(two_click_event);
}
}
$(window).on('beforeunload', function(event) {
if(window_has_focus) {
$(window).trigger("blur");
}
if(two_click_event) {
clearTimeout(two_click_event);
}
if(active_frame !== null && current_frame === active_frame && 800 + $(active_frame).data("iframeclicktime") < +new Date()) {
$(active_frame).trigger("iframeClickEvent", [2].concat($(active_frame).data("iframeclickaddtnldata")));
}
});
$.fn.setIframeClickEvents = function(additional_data) {
all_frames = all_frames.add(this);
return this.data({iframeclickaddtnldata: additional_data})
.mouseover(function() {
current_frame = this;
}).mouseout(function() {
current_frame = null;
});
};
})($ezJQuery);
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
}
if(typeof $ezJQuery != 'undefined' && typeof(__JASS) !== 'undefined') {
(function(){var t=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},e=[].slice;!function(t,e){return"function"==typeof define&&define.amd?define("waypoints",["jquery"],function(){return e($ezJQuery,t)}):e($ezJQuery,t)}(window,function(n,r){var i,o,l,s,a,c,u,f,h,d,p,y,v,w,g,m;return i=n(r),f=t.call(r,"ontouchstart")>=0,s={horizontal:{},vertical:{}},a=1,u={},c="waypoints-context-id",p="resize.waypoints",y="scroll.waypoints",v=1,w="waypoints-waypoint-ids",g="waypoint",m="waypoints",o=function(){function t(t){var e=this;this.$element=t,this.element=t[0],this.didResize=!1,this.didScroll=!1,this.id="context"+a++,this.oldScroll={x:t.scrollLeft(),y:t.scrollTop()},this.waypoints={horizontal:{},vertical:{}},this.element[c]=this.id,u[this.id]=this,t.bind(y,function(){var t;return e.didScroll||f?void 0:(e.didScroll=!0,t=function(){return e.doScroll(),e.didScroll=!1},r.setTimeout(t,n[m].settings.scrollThrottle))}),t.bind(p,function(){var t;return e.didResize?void 0:(e.didResize=!0,t=function(){return n[m]("refresh"),e.didResize=!1},r.setTimeout(t,n[m].settings.resizeThrottle))})}return t.prototype.doScroll=function(){var t,e=this;return t={horizontal:{newScroll:this.$element.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.$element.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}},!f||t.vertical.oldScroll&&t.vertical.newScroll||n[m]("refresh"),n.each(t,function(t,r){var i,o,l;return l=[],o=r.newScroll>r.oldScroll,i=o?r.forward:r.backward,n.each(e.waypoints[t],function(t,e){var n,i;return r.oldScroll<(n=e.offset)&&n<=r.newScroll?l.push(e):r.newScroll<(i=e.offset)&&i<=r.oldScroll?l.push(e):void 0}),l.sort(function(t,e){return t.offset-e.offset}),o||l.reverse(),n.each(l,function(t,e){return e.options.continuous||t===l.length-1?e.trigger([i]):void 0})}),this.oldScroll={x:t.horizontal.newScroll,y:t.vertical.newScroll}},t.prototype.refresh=function(){var t,e,r,i=this;return r=n.isWindow(this.element),e=this.$element.offset(),this.doScroll(),t={horizontal:{contextOffset:r?0:e.left,contextScroll:r?0:this.oldScroll.x,contextDimension:this.$element.width(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:r?0:e.top,contextScroll:r?0:this.oldScroll.y,contextDimension:r?n[m]("viewportHeight"):this.$element.height(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}},n.each(t,function(t,e){return n.each(i.waypoints[t],function(t,r){var i,o,l,s,a;return i=r.options.offset,l=r.offset,o=n.isWindow(r.element)?0:r.$element.offset()[e.offsetProp],n.isFunction(i)?i=i.apply(r.element):"string"==typeof i&&(i=parseFloat(i),r.options.offset.indexOf("%")>-1&&(i=Math.ceil(e.contextDimension*i/100))),r.offset=o-e.contextOffset+e.contextScroll-i,r.options.onlyOnScroll&&null!=l||!r.enabled?void 0:null!==l&&l<(s=e.oldScroll)&&s<=r.offset?r.trigger([e.backward]):null!==l&&l>(a=e.oldScroll)&&a>=r.offset?r.trigger([e.forward]):null===l&&e.oldScroll>=r.offset?r.trigger([e.forward]):void 0})})},t.prototype.checkEmpty=function(){return n.isEmptyObject(this.waypoints.horizontal)&&n.isEmptyObject(this.waypoints.vertical)?(this.$element.unbind([p,y].join(" ")),delete u[this.id]):void 0},t}(),l=function(){function t(t,e,r){var i,o;"bottom-in-view"===r.offset&&(r.offset=function(){var t;return t=n[m]("viewportHeight"),n.isWindow(e.element)||(t=e.$element.height()),t-n(this).outerHeight()}),this.$element=t,this.element=t[0],this.axis=r.horizontal?"horizontal":"vertical",this.callback=r.handler,this.context=e,this.enabled=r.enabled,this.id="waypoints"+v++,this.offset=null,this.options=r,e.waypoints[this.axis][this.id]=this,s[this.axis][this.id]=this,i=null!=(o=this.element[w])?o:[],i.push(this.id),this.element[w]=i}return t.prototype.trigger=function(t){return this.enabled?(null!=this.callback&&this.callback.apply(this.element,t),this.options.triggerOnce?this.destroy():void 0):void 0},t.prototype.disable=function(){return this.enabled=!1},t.prototype.enable=function(){return this.context.refresh(),this.enabled=!0},t.prototype.destroy=function(){return delete s[this.axis][this.id],delete this.context.waypoints[this.axis][this.id],this.context.checkEmpty()},t.getWaypointsByElement=function(t){var e,r;return(r=t[w])?(e=n.extend({},s.horizontal,s.vertical),n.map(r,function(t){return e[t]})):[]},t}(),d={init:function(t,e){var r;return e=n.extend({},n.fn[g].defaults,e),null==(r=e.handler)&&(e.handler=t),this.each(function(){var t,r,i,s;return t=n(this),i=null!=(s=e.context)?s:n.fn[g].defaults.context,n.isWindow(i)||(i=t.closest(i)),i=n(i),r=u[i[0][c]],r||(r=new o(i)),new l(t,r,e)}),n[m]("refresh"),this},disable:function(){return d._invoke.call(this,"disable")},enable:function(){return d._invoke.call(this,"enable")},destroy:function(){return d._invoke.call(this,"destroy")},prev:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){return e>0?t.push(n[e-1]):void 0})},next:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){return et.oldScroll.y})},left:function(t){return null==t&&(t=r),h._filter(t,"horizontal",function(t,e){return e.offset<=t.oldScroll.x})},right:function(t){return null==t&&(t=r),h._filter(t,"horizontal",function(t,e){return e.offset>t.oldScroll.x})},enable:function(){return h._invoke("enable")},disable:function(){return h._invoke("disable")},destroy:function(){return h._invoke("destroy")},extendFn:function(t,e){return d[t]=e},_invoke:function(t){var e;return e=n.extend({},s.vertical,s.horizontal),n.each(e,function(e,n){return n[t](),!0})},_filter:function(t,e,r){var i,o;return(i=u[n(t)[0][c]])?(o=[],n.each(i.waypoints[e],function(t,e){return r(i,e)?o.push(e):void 0}),o.sort(function(t,e){return t.offset-e.offset}),n.map(o,function(t){return t.element})):[]}},n[m]=function(){var t,n;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],h[n]?h[n].apply(null,t):h.aggregate.call(null,n)},n[m].settings={resizeThrottle:100,scrollThrottle:30},i.on("load.waypoints",function(){return n[m]("refresh")})})}).call(this),function(){!function(t,e){return"function"==typeof define&&define.amd?define(["jquery","waypoints"],e):e($ezJQuery)}(window,function(t){var e,n;return e={wrapper:'
',stuckClass:"stuck",direction:"down right"},n=function(t,e){var n;return t.wrap(e.wrapper),n=t.parent(),n.data("isWaypointStickyWrapper",!0)},t.waypoints("extendFn","sticky",function(r){var i,o,l;return o=t.extend({},t.fn.waypoint.defaults,e,r),i=n(this,o),l=o.handler,o.handler=function(e){var n,r;return n=t(this).children(":first"),r=-1!==o.direction.indexOf(e),n.toggleClass(o.stuckClass,r),i.height(r?n.outerHeight():""),null!=l?l.call(this,e):void 0},i.waypoint(o),this.data("stuckClass",o.stuckClass)}),t.waypoints("extendFn","unsticky",function(){var t;return t=this.parent(),t.data("isWaypointStickyWrapper")?(t.waypoint("destroy"),this.unwrap(),this.removeClass(this.data("stuckClass"))):this})})}.call(this);
var ezStickyHeightEl = $ezJQuery('#stylesheet_body');
var ezStickyCurrentHeight = ezStickyHeightEl.height();
var ezSidebarHeightEl = $ezJQuery('.ezSidebar');
var ezSidebarCurrentHeight = ezSidebarHeightEl.height();
var stickyElement = function (stickyAdPosition) {
var $stickyEl = $ezJQuery("#ez-sticky-ad-"+stickyAdPosition);
var $stopEl = $ezJQuery('.ezoic-sticky-cutoff');
var stickyElExtraOffset = ezGetTopPositionForAd($stickyEl);
$stopEl.waypoint(function (direction) {
if (direction == 'down') {
var footerOffset = $stopEl.offset();
$stickyEl.css({
position: 'absolute',
top: footerOffset.top - stickyElExtraOffset - $stickyEl.outerHeight()
});
} else if (direction == 'up') {
$stickyEl.attr('style', '');
}
}, { offset: function () { return $stickyEl.outerHeight(); }});
$stickyEl.waypoint('sticky', {
wrapper: '
',
stuckClass: 'ez-sticky-class',
offset: -1
});
};
var ezGetTopPositionForAd = function(el) {
var stickyElExtraTop = 0;
if (el.offsetParent()) {
el = el.offsetParent();
var maxLoops = 10;
var currentLoop = 1;
do {
stickyElExtraTop += el.offset().top;
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();
if (height != ezStickyCurrentHeight) {
ezStickyCurrentHeight = height;
changed = true;
}
if (sidebarHeight != ezSidebarCurrentHeight) {
ezSidebarCurrentHeight = sidebarHeight;
changed = true;
}
if (changed == true) {
$ezJQuery.waypoints('refresh');
}
};
__JASS.onWindowLoad(function() {
if (!!$ezJQuery('#ez-sticky-ad-1').length && !$ezJQuery('#ez-sticky-ad-1').is(':empty')) {
if ($ezJQuery(".ezoic-sticky-cutoff").offset().top > ($ezJQuery("#ez-sticky-ad-1").offset().top + $ezJQuery('#ez-sticky-ad-1').height())) {
stickyElement(1);
$ezJQuery(window).scroll(function() { ezCheckWayRefresh(); });
window.setInterval(function(){ ezCheckWayRefresh(); }, 5000);
}
}
});
}