Day: November 15, 2021

MSN

MSN {window.webWorkerMessages.push(e.data)},window.webWorkerErrors=[],window.webWorker.onerror=e=>{window.webWorkerErrors.push(e)},window.chrome){const e=this.getAudienceMode(this.clientSettings);let t=!1;const n=window.webWorker&&window.chrome&&window.chrome.ntpSettingsPrivate;n&&”function”==typeof n.getPref&&(n.getPref(“ntp.news_feed_display”,e=>{e&&e.value&&window.webWorker.postMessage({id:”FeedDisplaySetting”,type:”command”,payload:e.value})}),n.getPref(“ntp.layout_mode”,e=>{e&&e.value&&window.webWorker.postMessage({id:”LayoutModeSetting”,type:”command”,payload:e.value})}),”adult”===e&&(t=!0,n.getPref(“ntp.user_nurturing”,e=>{let t=!1;e&&e.value&&e.value.length&&(t=this.getSingleColRequest(e.value)),window.webWorker.postMessage({id:”RenderSingleColumn”,type:”command”,payload:t})}))),t||window.webWorker.postMessage({id:”RenderSingleColumn”,type:”command”,payload:!1}),”enterprise”===e&&this.clientSettings.browser&&”edgeChromium”===this.clientSettings.browser.browserType&&parseInt(this.clientSettings.browser.version)>=87&&this.getAccessToken().then(e=>{e&&window.webWorker.postMessage({id:”AuthToken”,type:”command”,payload:e})}),”adult”!==e&&”enterprise”!==e||this.sendPageConfiguration()}}buildWebWorkerUrl(e=null){return(this.bundle||””)+”#”+this.qsFromDocument()+this.qsFromCookies()+this.qsFromDataAttribute(e||this.clientSettings)+this.qsMisc()+this.qsFromUrl()+this.qsFromServiceWorker()}qs(e,t,n){return e?t+”=”+(n||e)+”&”:””}qsFromDocument(){return this.qs(document.getElementsByTagName(“html”)[0].getAttribute(“lang”),”lang”)+this.qs(encodeURIComponent(window.location.href),”adsReferer”)}qsFromServiceWorker(){if(!navigator.serviceWorker||!navigator.serviceWorker.controller)return””;const e=navigator.serviceWorker.controller;if(“activated”!==e.state||!e.scriptURL)return””;if(e.scriptURL){const t=new URL(e.scriptURL).searchParams.toString();return t?”&”+t+”&”:””}return””}qsFromCookies(){return this.qs(Object(o.b)(this.authCookieName),”aace”,”1″)+this.qs(Object(o.b)(“muid”),”muid”)+this.qs(Object(o.b)(this.childCookieName),”child”)+this.qs(Object(o.b)(“cbypass”),”cbypass”)+this.qs(this.cookieBannerConsentRequired().toString(),”ccRequired”)+this.qs(Object(o.b)(“ecasession”),”ecasession”)+this.qs(Object(o.b)(“TOptOut”),”browserOptOut”)}qsFromDataAttributeHelper(e,t){return e&&e.featureFlags&&e.featureFlags.wpoEnabled&&(t=this.appendWpoFlightsToInfo(e,t)),this.qs(e.pcsInfo&&e.pcsInfo.env||e.env,”env”)+this.qs(e.aid,”aid”)+this.qs(e.apptype,”apptype”)+this.qs(e.pagetype,”pagetype”)+this.qs(e.audienceMode,”audienceMode”)+this.qs(e.configIndexDocId,”configIndexDocId”)+this.qs(e.deviceFormFactor,”deviceFormFactor”)+this.qs(e.domain,”domain”)+this.qs(e.configRootUrl,”configRootUrl”)+this.qs(this.getHighestCbid(e.cbid,e.apptype),”cbid”)+this.qs(e.ocid,”ocid”)+this.qs(e.os,”os”)+this.qs(JSON.stringify(e.locale),”locale”)+this.qs(e.geo_lat,”lat”)+this.qs(e.geo_long,”long”)+(“dhp”===e.pagetype||”ntp”===e.pagetype?this.qs(Object(o.b)(this.WeaSpartanHomeLocCookie),this.WeaSpartanHomeLocCookie)+this.qs(Object(o.b)(this.WeaSpartanDetectLocSetting),this.WeaSpartanDetectLocSetting):this.qs(Object(o.b)(this.WeaHomeLocCookie),this.WeaHomeLocCookie)+this.qs(Object(o.b)(this.WeaDetectLocSetting),this.WeaDetectLocSetting))+this.qs(JSON.stringify(e.featureFlags),”featureFlags”)+this.qs(JSON.stringify(e.browser),”browser”)+this.qs(JSON.stringify(e.servicesEndpoints),”servicesEndpoints”)+this.qs(e.bundleInfo&&e.bundleInfo.v||””,”buildVersion”)+this.buildArtifactHashes(e)+this.qs(t,”dataInfo”)}appendWpoFlightsToInfo(e,t){const n=this.getWpoFlightsFromLocalStorage(e);if(n&&n.length){const e=”;”,o=t.split(e);for(let e=0;ee.id)}}catch(e){console.warn(`Error getting wpo flights from ls for ${o} Error:${e}`)}return null}buildArtifactHashes(e){let t;try{const{locale:n={},bundleInfo:o={},audienceMode:s,pagetype:r,apptype:a}=e,{hash:c,configsHash:l,locConfigsHash:u}=o;if(!c||!l||!u)return””;t=this.qs(c,”bundleHash”)+this.qs(l,”configHash”)+this.qs(u,”locHash”);const d=`config_hash_${s}_${n.language}_${n.market}_${r}_${a}`,g=Object(i.a)().getItem(d);if(g){const{bundleHash:e,configHash:n,locHash:o}=JSON.parse(g)||{};e&&n&&o&&(t+=this.qs(e,”lastBundleHash”)+this.qs(n,”lastConfigHash”)+this.qs(o,”lastLocHash”))}return t}catch(e){console.error(“Error getting config hashes from ls: “+e)}return t}getHighestCbid(e,t){try{const n=Object(i.a)(),o=parseInt(e),s=parseInt(JSON.parse(n.getItem(“cbid_”+(t||””))));let r;if(o&&!isNaN(o)&&s&&!isNaN(s)&&(r=o>s?o:s),r=r||o||s,r)return window._cbid=r.toString()}catch(e){console.log(“Error getting highest CBID”+e)}}getAudienceMode(e){Object(i.a)();const t=Object(o.a)(this.authCookieName),n=Object(o.a)(this.childCookieName),{child:s}=t&&JSON.parse(t)||{};return t&&(1===s||n)?”kids”:”enterprise”===e.audienceMode&&e.IsCnDomain&&e.currentFlights.includes(“prg-china-aad”)?”adult”:e.audienceMode||”adult”}sendPageConfiguration(){const e=this.clientSettings.pagetype;if(e){const t=o.a&&”function”==typeof o.a&&Object(o.a)(“pglt-edgeChromium-“+e);if(t)return void window.webWorker.postMessage({id:”PageConfiguration”,type:”command”,payload:t})}window.webWorker.postMessage({id:”PageConfiguration”,type:”command”,payload:!1})}qsFromDataAttribute(e){let t,n;const o=Object(i.a)();if(o){const i=JSON.parse(o.getItem(“shd_”+e.pagetype)||null);i&&i.clientSettings&&i.info&&(t=Object.assign(Object.assign({},i.clientSettings),{bundleInfo:e.bundleInfo}),n=i.info)}return(!t||!n||e.pageGenTime>=t.pageGenTime)&&(t=e,n=this.domInfo),t.audienceMode=this.getAudienceMode(t),this.qsFromDataAttributeHelper(t,n)}qsFromUrl(){const e=location.search;return e&&e.length?e.substring(1,e.length):””}getAccessToken(){return …

MSN Read More »