[ad_1]
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
let S = document.createElement('script'); S.src = "https://securepubads.g.doubleclick.net/tag/js/gpt.js"; S.async = true; document.head.appendChild(S);
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l="+l:"';j.async=true;j.src="https://www.googletagmanager.com/gtm.js?id="+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer',muGtmId);
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
var sidebar = document.querySelector('.sticky-sidebar'); if(sidebar){ $tresholdContainer = document.querySelector('.main-content-stream'), $mainContent = document.querySelector('.main-content-stream .main-column'), iTopSpacing = 57, // height of shrinked top menu iBottomSpacing = 40; // spacing to bottom of page
console.log(sidebar); var sidebarReset = function () { sidebar.classList.remove('sidebar--fixed'); sidebar.removeAttribute('style'); };
var sidebarFixed = function (top, bottom, width) { sidebar.classList.add('sidebar--fixed'); sidebar.style.top=top; sidebar.style.bottom=bottom; sidebar.style.width=width; } // TODO: we need to add debounce window.addEventListener('scroll', function() { if( !sidebar.classList.contains(':visible') ) {return false;}
var iOffsetTop = sidebar.scrollTop, iHeaderHeight = $tresholdContainer.offset().top, iSidebarHeight = sidebar.offsetHeight, iWindowHeight = document.querySelector(window).offsetHeight, iSidebarWidth = $tresholdContainer.width() - $mainContent.outerWidth - 50;
if( iSidebarHeight + iBottomSpacing + iTopSpacing < iWindowHeight ){
var topTreshold = iHeaderHeight - iOffsetTop;
if( topTreshold <= iTopSpacing ){
sidebarFixed(iTopSpacing, 'auto', iSidebarWidth);
} else {
sidebarReset();
}
} else {
var bottomTreshold = iHeaderHeight + iSidebarHeight + iBottomSpacing - iWindowHeight;
if( bottomTreshold < iOffsetTop ){
sidebarFixed('auto', iBottomSpacing, iSidebarWidth);
} else {
sidebarReset();
}
}
});
}
window.addEventListener('resize', function(event){
window.scrollTo(window.scrollX, window.scrollY - 1);
window.scrollTo(window.scrollX, window.scrollY + 1);
});
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '922014154625678');
fbq('track', 'PageView');
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
// Load adagio
if (window.neodata_fmt_type) {
var _neodata = _neodata || {},
adsObj = {},
inStreamAdType;
_neodata.adagioTag = _neodata.adagioTag || [];
switch(neodata_fmt_type){
case "fmt_verita_mobile_asyncr":
inStreamAdType = "rectangle-in-post";
break;
case "fmt_verita_tablet_asyncr":
inStreamAdType = "leaderboard-post";
break;
default:
inStreamAdType = "leaderboard-between";
break;
}
(function () {
var adIndex = 1;
var loadAdagio = function () {
(function (d, t) {
var g = d.createElement
s = d.getElementsByTagName
g.src = ('https:' == document.location.protocol ? 'https://js-ssl.neodatagroup.com' : 'http://js91.adagionet.com') + '/uploads/js/opq.js';
g.async = true;
s.parentNode.insertBefore(g, s);
})(document, "scr" + "ipt");
};
var insertAdContainers = function () {
var postSelector = ".content__main .laverita-post";
var posts = document.querySelectorAll(postSelector);
var frequencyFunction = function (i) {
return ((i % 3) === 0);
};
// Iterate over all the posts.
for (let i = 0; i < posts.length; i += 1) {
var post = posts[i];
// Starting from after the second post, insert an ad every four posts.
var frequency = frequencyFunction(i);
// Make sure we're not injecting two ads next to each other.
var isPrevSiblingAd = post.nextElementSibling && post.nextElementSibling.classList.contains('adagioad');
if (frequency && !isPrevSiblingAd) {
let newEl = document.createElement("div");
newEl.classList.add("adagioad");
newEl.id = "adagioad-stream-"+adIndex;
newEl.classList.add(newEl.id);
newEl.dataset.index = adIndex++;
newEl.setAttribute('data-type', inStreamAdType);
posts[i].parentNode.insertBefore(newEl, posts[i].nextSibling);
}
}
setupAds();
};
var setupAds = function () {
var adsArray = [],
adEls = document.getElementsByClassName('adagioad'),
adsAdded = 0,
elId,
elType;
for (var i=0; i
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
var runnerEvents = __RUNNER_PUBLIC__.events; var runnerRootID = __RUNNER_PUBLIC__.root; var start = 0;
document.addEventListener('rebelmouse.urlChange', callback) function callback(){ console.log("onNewarticle event") window.dataLayer.push({'event': 'onNewarticle'}); }
var qsdiv = document.createElement('div'); qsdiv.setAttribute('class', 'main widget__show-more:not(.correlati-proc)'); if(document.querySelector('.main') != null) { document.querySelector('.main').appendChild(qsdiv); qsdiv.addEventListener("click",function(){ qsdiv.classList.add("correlati-proc"); qsdiv.insertAdjacentHTML('beforebegin','
'); window.dataLayer.push({'event': 'onOpenarticle'}); console.log("onOpenarticle event") }); }
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
videofunc = function(elem) { if (!elem.classList.contains("active")) { var vid = "vid-" + new Date().getTime(), video_url = elem.attr('data-src'), isS3 = video_url.indexOf("s3.amazonaws.com") > -1, techOrder = isS3 ? '["html5"]' : '["youtube"]', sourceType = isS3 ? '"video/mp4"' : '"video/youtube"', player; var siteUrl = window.location.hostname; var pageUrl = document.location; var description = encodeURIComponent(pageUrl); var refPageUrl = document.referrer; var correlatorVal = Date.now(); elem.toggleClass("active"); elem.html(''); player = videojs(vid, {}, function() { !device.isiOS && elem.play(); }); player.ima({ id: vid, adTagUrl: 'https://pubads.g.doubleclick.net/gampad/ads?iu=/150134580/laverita-Preroll&description_url=" + description + "&site=" + siteUrl + "&url=pageUrl&ref=" + refPageUrl + "&env=vp&impl=s&correlator=" + correlatorVal + "&tfcd=0&npa=0&gdfp_req=1&output=vast&sz=640x480&unviewed_position_start=1' }); }
}
REBELMOUSE_STDLIB.createElementChangeListener('.post-video', event=>{ event.addEventListener("click", function(){videofunc(event)})} );
});
[ad_2]