‘).insertBefore(‘.dialog-off-canvas-main-canvas’);

*/

jQuery(”).insertBefore(‘.dialog-off-canvas-main-canvas’);

/*
jQuery(‘

Hide Ad

‘).insertBefore(‘.dialog-off-canvas-main-canvas’);
*/

try {
if (jQuery(‘.gi5-mobile-float’).css(‘display’) !== ‘none’) {

stuckClass =”stucksocial”;

} else {
stuckClass =”stuck”;
}
}catch(e){

stuckClass =”stuck”;
}

}

function listenFromBC(evt) {

if(evt.data === “ad2046ready”) {

if (!readyFlag) {
readyFlag = true;

console.log(‘user close flag ‘+ userClosedFlag);

if (!userClosedFlag) {

console.log(‘init video’);

initVideo(firstRun);
}

} else {

}
}

if(evt.data === “ad2046reset”) {

console.log(evt.data);

readyFlag = false;
firstRun = false;

}

if(evt.data === “ad2046muted”) {

muteFlag = true;

}

if(evt.data === “ad2046unmuted”) {

muteFlag = false;

}

if(evt.data === “ad2046error”) {

jQuery(‘#pulldownad’).remove();
jQuery(‘#pulldownad-clone’).remove();
jQuery(‘#ad-slide-tab’).remove();

}

}

function initVideo(firstrun){

jQuery(‘.expanded-menu-button’).on(‘click’,function(){

if (jQuery(‘#ad-slide-tab’).text().search(/open/i) > -1) {

if (jQuery(window).scrollTop() 1150? parseInt(1150 * .5625):parseInt(window.innerWidth * .5625);

if (calcHeight > jQuery(window).height()-jQuery(‘#navbar’).outerHeight()-50) {

calcHeight = jQuery(window).height()-jQuery(‘#navbar’).outerHeight()-50;

}

if (jQuery(window).height() -1) {

console.log(‘send command to pause video’);

jQuery(‘#pulldownad’).find(‘iframe’)[0].contentWindow.postMessage(“bcPauseAd2046”, “*”);

jQuery(‘#pulldownad’).animate({‘height’:’0′},{duration: 700});

jQuery(this).text(‘Open Advertisement’);

userClosedFlag=true;

} else {

userClosedFlag=false;

var calcHeight = window.innerWidth > 1150? parseInt(1150 * .5625):parseInt(window.innerWidth * .5625);

if (calcHeight > jQuery(window).height()-jQuery(‘#navbar’).outerHeight()-50) {

calcHeight = jQuery(window).height()-jQuery(‘#navbar’).outerHeight()-50;

}
if (jQuery(window).height() 30 && jQuery(‘#ad-slide-tab’).text().search(/close/i) == -1) {

//if (jQuery(‘.top-bar’).css(‘position’) == “relative”) {

jQuery(‘.top-bar’).css(‘position’,”);
//}

} else if (scrollPos 0 && elementFromTop 0) {

jQuery(‘#pulldownad-clone’).remove();
jQuery(‘#pulldownad’).removeClass(stuckClass);

jQuery(‘#pulldownad .ad-close-btn’).hide();

var calcHeight = window.innerWidth > 1150? parseInt(1150 * .5625):parseInt(window.innerWidth * .5625);

if (calcHeight > jQuery(window).height()-jQuery(‘#navbar’).outerHeight()-50) {

calcHeight = jQuery(window).height()-jQuery(‘#navbar’).outerHeight()-50;

}

if (jQuery(window).height() -1 && userClosedFlag===false && initFlag) {

jQuery(‘#pulldownad’).find(‘iframe’)[0].contentWindow.postMessage(“bcPlayAdClick2046”, “*”);
}

}

} else if (jQuery(window).height() > jQuery(‘#pulldownad’).height()-scrollPos) {

if (floatMobile || floatDesktop) {
if (jQuery(‘#ad-slide-tab’).text().search(/close/i) > -1 && userClosedFlag===false && initFlag) {

jQuery(‘.top-bar’).css(‘position’,”);

if (jQuery(‘#pulldownad-clone’).length == 0) {
var adClone = jQuery(‘#pulldownad’).clone();

jQuery(adClone).attr(‘id’,’pulldownad-clone’);

jQuery(adClone).insertBefore(‘#pulldownad’);

jQuery(‘#pulldownad’).addClass(stuckClass);

jQuery(‘#pulldownad’).css(‘width’, ”);

jQuery(‘#pulldownad .ad-close-btn’).show();

jQuery(‘#pulldownad’).css(‘height’,”);

}
}
} else {

jQuery(‘#pulldownad’).find(‘iframe’)[0].contentWindow.postMessage(“bcPauseAd2046”, “*”);

}

}

lockFlag = false;

},200);

}
}
});

if (!isMobileDevice()) {
jQuery(window).on(‘resize’, function() {

try {
if (jQuery(‘.gi5-mobile-float’).css(‘display’) !== ‘none’) {

jQuery(‘#pulldownad’).removeClass(stuckClass);

stuckClass =”stucksocial”;

jQuery(‘#pulldownad’).addClass(stuckClass);

} else {

jQuery(‘#pulldownad’).removeClass(stuckClass);

stuckClass =”stuck”;

jQuery(‘#pulldownad’).addClass(stuckClass);
}
}catch(e){

jQuery(‘#pulldownad’).removeClass(stuckClass);

stuckClass =”stuck”;

jQuery(‘#pulldownad’).addClass(stuckClass);

}

var calcHeight = window.innerWidth > 1150? parseInt(1150 * .5625):parseInt(window.innerWidth * .5625);

if (calcHeight > jQuery(window).height()-jQuery(‘#navbar’).outerHeight()-50) {

calcHeight = jQuery(window).height()-jQuery(‘#navbar’).outerHeight()-50;

}

if (jQuery(‘#pulldownad’).hasClass(stuckClass) == false && jQuery(‘#ad-slide-tab’).text().search(/close/i) > -1) {

jQuery(‘#pulldownad’).css(‘height’,calcHeight);

if (jQuery(window).height() 10) {

window.clearInterval(playTimer);
}

},200);

}else {

playTimer = window.setInterval(function(){
try {
jQuery(‘#pulldownad’).find(‘iframe’)[0].contentWindow.postMessage(“bcPlayAdFirstRunUnmute2046”, “*”);
}catch(e){

}
playCounter++

if (playCounter > 10) {

window.clearInterval(playTimer);
}

},500);

}

}
}



Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here