(function() { var preEngineFunc={ preEngineJS: function (loaderParams) {var pageBody=getElementAttributeValueBySelector('body','class');var bodyNoAds=!1;if(pageBody){if(pageBody.includes('noad')){loaderParams.e.sc.ms=0;bodyNoAds=!0}} function addPageCSS(rule){var head=document.head||document.getElementsByTagName('head')[0],style=document.createElement('style'),rules=document.createTextNode(rule);style.type='text/css';if(style.styleSheet) style.styleSheet.cssText=rules.nodeValue;else style.appendChild(rules);head.appendChild(style)} function getFilteredCompatibleSizesfromBrowsiSpot(attributeValue,compatibleSizes){if(attributeValue){var sizes=JSON.parse(attributeValue);return compatibleSizes.filter(function(compatibleSize){return sizes.find(function(size){return size.w===compatibleSize.w&&size.h===compatibleSize.h})})}else{return compatibleSizes}} function getElementAttributeValue(element,attribute){var attributeValue=element.getAttribute(attribute);if(!attributeValue){return null} return attributeValue.toLowerCase()} function getElementAttributeValueBySelector(selector,attribute){var selectorResult=document.querySelector(selector);if(!selectorResult){return null} return getElementAttributeValue(selectorResult,attribute)} function getFilteredCompatibleSizes(arraySizes,compatibleSizes){var sizes=arraySizes.map(function(size){return(size&&size.length===2)?{w:size[0],h:size[1]}:''});var result=[];if(sizes.length){result=compatibleSizes.filter(function(compatibleSize){return sizes.find(function(size){return size.w===compatibleSize.w&&size.h===compatibleSize.h})})}else{result=compatibleSizes} if(sizes.find(function(s){return s.w===300&&s.h===600})){result.push({adSizeType:"narrow",h:600,minSizeForWrapping:1,optionalEmbeddings:["break"],selectedEmbedding:"break",w:300})} return result} function sortByDomLocation(elements){return elements.sort(function(a,b){if(a===b) return 0;if(a.compareDocumentPosition(b)&Node.DOCUMENT_POSITION_PRECEDING){return 1} return-1})} function buildYieldFunction(prefix,counterStart){return function(){var next=counterStart;return function(){return prefix+next++}}()} var positionsStack={RIGHT:buildYieldFunction('RIGHT',11),LEADER_BOARD:buildYieldFunction('LEADER_BOARD',1),PROMO:buildYieldFunction('PROMO',1),PREMIUM_BANNER:buildYieldFunction('PREMIUM_BANNER',1),PREMIUM_DISPLAY:buildYieldFunction('PREMIUM_DISPLAY',1),AUTO_INCREASE:buildYieldFunction('AUTO_INCREASE',1)};function replaceAscendingKeys(elements){elements=sortByDomLocation(elements);for(var i=0;i div[class*="scGrid"]'));if(sectionSpots.length>1){if(!hasFixedChilds(sectionSpots[0])){sectionSpots=sectionSpots.slice(1)}} var sectionsSAfromGMG=sectionSpots.filter(function(el,index){if(index===0){return!hasFixedChilds(el)} if(index>0){return!hasFixedChilds(el)&&!hasFixedChilds(sectionSpots[index-1])}}).filter(function(el){return el.clientHeight>50});var shouldSaveAsSpot=!0;var oddSectionSpots=sectionsSAfromGMG.filter(function(el,index){if(shouldSaveAsSpot||(index>0&§ionsSAfromGMG[index-1].getBoundingClientRect().height>600)){shouldSaveAsSpot=!1;return!0} shouldSaveAsSpot=!0;return!1});var spotsList=[{type:'publisher',selector:'div.gmgAd'}];if(!bodyNoAds){spotsList.push({type:'browsi',elements:oddSectionSpots,sizes:'[{"w": 728, "h":90},{"w": 0, "h":0}]',pos:'AUTO_INCREASE',style:'grid-column'});spotsList.push({type:'browsiRailHomeSections',selector:'main.flexible > aside > div.sticky',pos:'RIGHT'})} addFixedSpots(spotsList)} function getPageTargetings(){var result=[];var pageTags=getElementAttributeValueBySelector('meta[property="article:tag"]','content');if(pageTags){pageTags=pageTags.replace(/[^\w\s\,]/gi,'').split(',')} var pageCoid=getElementAttributeValueBySelector('meta[name="coid"]','value');var pageType=getElementAttributeValueBySelector('meta[name="type"]','value');if(pageTags){result.push({k:"tags",v:pageTags})} if(pageCoid){result.push({k:"coid",v:pageCoid})} if(pageType){result.push({k:"type",v:pageType})} result.push({k:"view",v:window.matchMedia("(max-width: 1200)").matches?"desktop":["desktop","wide"]});return result} function removeMargins(spot){spot.browsiAd.wrapper.style.removeProperty('margin-top');spot.browsiAd.wrapper.style.removeProperty('margin-bottom')} function removeWrappingAdStyling(spot){spot.browsiAd.wrapper.style.removeProperty('margin-top');spot.browsiAd.wrapper.style.removeProperty('margin-bottom');spot.browsiAd.wrapper.style.removeProperty('padding');spot.browsiAd.wrapper.style.removeProperty('height')} loaderParams.externalFlowHandler={engineInitiator:function(loaderParams,start){function checkReaduState(){if(document.readyState==='complete'){document.removeEventListener('readystatechange',checkReaduState);clearTimeout(grahamTimeout);findFixedSpots();start()}} document.addEventListener("readystatechange",checkReaduState);checkReaduState();var grahamTimeout=setTimeout(function(){document.removeEventListener('readystatechange',checkReaduState);findFixedSpots();start()},20000)},preDemand:function(spots){spots.filter(function(spot){return spot.type==='dynamic'}).forEach(function(spot){return spot.ref.setAttribute('data-generated-key','AUTO_INCREASE')});var spotrefs=spots.map(function(spot){return spot.ref});replaceAscendingKeys(spotrefs)},preFetch:function(spot,provider,response){if(provider.providerName==="header_bidding"||provider.providerName==="dfp"){response.kv=(response.kv||[]).concat(getPageTargetings());response.kv.push({k:"pos",v:spot.ref.getAttribute('data-generated-key')});var dfpConfig=spot.providerName==="header_bidding"?response.c.d:response.c;var classValue=getElementAttributeValue(spot.ref.parentElement,'class');if(classValue&&classValue.indexOf('gmgad')>-1){response.ri=null} if(spot.type==='fixed'){if(spot.ref.tagName==='BROWSISPOT'){if(spot.ref.parentElement.hasAttribute('data-gmgAd')){var data=JSON.parse(spot.ref.parentElement.getAttribute('data-gmgad'));dfpConfig.au=data.unitname.replace(/\s+/g,'_');spot.compatibleSizes=getFilteredCompatibleSizes(data.desktop_size,spot.compatibleSizes);if(spot.compatibleSizes.length===0){console.log('[browsi]: sizes do not match placement',spot.ref.parentElement)}}else{if(spot.ref.getAttribute('style').indexOf('grid-column')!==-1){var siblingClass=getElementAttributeValue(spot.ref.nextElementSibling,'class');var gridStyle=(siblingClass&&siblingClass.indexOf('full-width')!==-1)?' {grid-column: 1 / 7;}':' {grid-column: 1 / 5;}';addPageCSS('div[id^="browsi_adWrapper_ai_'+spot.adIndex+'_"]'+gridStyle)} if(spot.ref.hasAttribute('data-generated-key')){dfpConfig.au=getAdUnit();spot.compatibleSizes=getFilteredCompatibleSizesfromBrowsiSpot(spot.ref.getAttribute('sizes'),spot.compatibleSizes)}}}}else{dfpConfig.au=getAdUnit()}}},postFetch:function(spot,response){if(spot.ref.tagName==='BROWSISPOT'){spot.ref.style=""} var classValue=getElementAttributeValue(spot.ref.parentElement,'class');var wrapSpot=!1;if(['right','left'].includes(spot.selectedSize.selectedEmbedding)){wrapSpot=!0;var wrapSpotCssFloat=spot.browsiAd.wrapper.style.getPropertyValue('float');var wrapSpotCssmarginRight=spot.browsiAd.wrapper.style.getPropertyValue('margin-right');var wrapSpotCssmarginLeft=spot.browsiAd.wrapper.style.getPropertyValue('margin-left')} if(classValue){if(classValue.indexOf('gmgad')===-1){spot.browsiAd.wrapper.setAttribute("class","gmgAdBrowsi");spot.browsiAd.wrapper.style="";if(wrapSpot&&wrapSpotCssFloat&&wrapSpotCssmarginLeft&&wrapSpotCssmarginRight){spot.browsiAd.wrapper.style.setProperty('float',wrapSpotCssFloat);spot.browsiAd.wrapper.style.setProperty('margin-right',wrapSpotCssmarginRight);spot.browsiAd.wrapper.style.setProperty('margin-left',wrapSpotCssmarginLeft)}else{}}else{spot.browsiAd.wrapper.style=""}}else{spot.browsiAd.wrapper.setAttribute("class","gmgAdBrowsi");spot.browsiAd.wrapper.style="";if(wrapSpot&&wrapSpotCssFloat&&wrapSpotCssmarginLeft&&wrapSpotCssmarginRight){spot.browsiAd.wrapper.style.setProperty('float',wrapSpotCssFloat);spot.browsiAd.wrapper.style.setProperty('margin-right',wrapSpotCssmarginRight);spot.browsiAd.wrapper.style.setProperty('margin-left',wrapSpotCssmarginLeft)}else{spot.browsiAd.wrapper.style.setProperty('text-align','center')}}}}}}; window["__browsiLoadFunc"](window["__browsiLoadObject"], preEngineFunc); })();