define(["nanobar"],(function(t){return{resData:{},container:document.querySelector("[app-inner]")||!1,title:document.querySelector(".main-tile-heading"),test:1,syncPageCount:0,syncPageMaxCount:5,onpopstate:function(){var t=location.href;this.goTo(t,"don't change current URL in browser")},documentClick:function(t,e){if(t&&"A"===t.nodeName&&this.sameOrigin(t.href)){var n=!t.hasAttribute("async-partial");this.noAdsReloading(t.href,n);var a=t.getAttribute("href");if(a.indexOf("javascript:")>=0)return App.executeJsCallback(a.replace("javascript:",""));if(!t.hasAttribute("download")&&"external"!==t.getAttribute("rel")&&!(t.target&&"_blank"===t.target||t.hash||"#"===a)){if(e.preventDefault(),e.stopPropagation(),t.target&&"_self"===t.target)return location.href=t.href;var o=t.getAttribute("async-partial");o?(this.partialHolder="async-container-"+o,this.changePartial(t.href)):this.goTo(t.href)}}},changeBrowserUrl:function(t){var e=void 0;if(t){if(!window.history||!window.history.pushState)return void(window.location.href=t);history.pushState(null,null,t),e=new CustomEvent("pushState"),window.dispatchEvent(e)}},embedHTML:function(t,e){if(t.indexOf("video_src")>0)return location.reload();if(!t)return document.location.reload();var n=document.querySelector("#broken-ajax-notification");if(n&&"block"===n.style.display&&(n.style.display="none"),e){var a=document.querySelector("["+e+"]");a&&(a.innerHTML=t)}else this.container.innerHTML=t;this.partialHolder=null},updateTitle:function(){this.resData&&this.resData.title&&(this.title.textContent=this.resData.title)},mergeContexts:function(){this.resData&&this.resData.addContext&&Z.extend(App.context,this.resData.addContext)},changePartial:function(t){t&&(1 in arguments||this.changeBrowserUrl(t),this.nanobar||this.initNanobar(),this.nanobar.go(60),App.beforeSwitchLocation(),Z.ajax({url:t+(t.indexOf("?")!==-1?"&":"?")+"partial=1",type:"get",headers:{"async-page":1},success:this.respond.bind(this,t)}))},goTo:function(t){var e=window;if(t){if(!e.history||!e.history.pushState||"function"!=typeof e.history.pushState)return location.href=t;1 in arguments||this.changeBrowserUrl(t),App.beforeSwitchLocation(),this.container.innerHTML="",this.nanobar||this.initNanobar();App.context.userId%10;this.nanobar.go(60),Z.ajax({url:t,type:"get",headers:{"async-page":1},success:this.respond.bind(this,t)})}},respond:function(t,e){if(e&&e.html||(App.track("invalid_response","desktop",t),document.location.href=t),e.hashes)return location.reload();this.resData=e,this.embedHTML(this.resData.html,this.partialHolder),this.updateTitle(),this.updateNavMenu(),this.mergeContexts(),App.context.adFrames=e.adFrames,App.executeJS(this.resData.action);var n=this.resData.action;document.body.querySelectorAll(".new iframe").forEach((function(t){t.contentWindow.postMessage(n,"*")})),this.trackPageView(document.location.pathname),this.nanobar.go(100),this.tileController(),this.pixelShow(),App.executeJsCallback(this.resData.jsCallback),this.updateNotificationCount(e.notificationsCount)},tileController:function(){var t=this;require(["tileController"],(function(e){e(t.resData.mainTileControll)}))},updateNavMenu:function(){var t=window.location.pathname;t=t.substring(t.lastIndexOf("/")+1);var e=document.querySelectorAll(".act-main-menu a");[].forEach.call(e,(function(e){var n=e.pathname;e.className=e.className.replace(" active",""),n=n.substring(n.lastIndexOf("/")+1),"/"===e.pathname&&"/"===window.location.pathname?e.className+=" active":n.indexOf(t)>=0&&"/"!==window.location.pathname&&t&&(e.className+=" active")}))},pixelShow:function(){this.resData&&this.resData.pixelCode&&App.insertPixel()},sameOrigin:function(t){var e=location.protocol+"//"+location.hostname;return t&&0===t.indexOf(e)},trackPageView:function(t){t.indexOf("/thread")>=0?t="/thread":t.indexOf("/u")>=0&&(t="/profile"),t="/desk"+t,App.trackPageView(t)},updateNotificationCount:function(t){"number"==typeof+t&&require(["notificationsCenter"],(function(e){e.updateTitle(t)}))},initNanobar:function(){this.nanobar=new t({bg:"#FF6363",target:document.getElementById("page-progress")})},noAdsReloading:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(App.context.isAdvertariumSplit&&!t.includes("premium")){this.container=document.querySelector("[app-inner] .container")||!1,this.isValidUrl(t)||(t=location.origin+"/"+t);var n=new URL(t);if(n.pathname.match(/\/u[0-9]+/))document.getElementsByClassName("desktop-bottom-new")[0].style.width="970px",document.getElementsByClassName("desktop-bottom-new")[0].style.display="block",document.querySelectorAll(".desktop-bottom-new div")[0].style.display="block",(n.href.match(/\/u[0-9]+$/)||e)&&(document.body.querySelector('div[data-placement="desktop_top"] iframe').contentWindow.postMessage("reload","*"),document.body.querySelector('div[data-placement="desktop_bottom"] iframe').contentWindow.postMessage("reload","*"),document.body.querySelector('div[data-placement="desktop_left"] iframe').contentWindow.postMessage("reload","*")),document.body.querySelector(".interstitital-ifr iframe").contentWindow.postMessage("reload","*");else{document.body.querySelectorAll(".u-row-photo").forEach((function(t){t.removeAttribute("target")}));var a=document.getElementsByClassName("new");Array.prototype.forEach.call(a,(function(t){t.style.display="block"})),document.getElementsByClassName("desktop-bottom-new")[0].style.setProperty("width","789px","important"),document.getElementsByClassName("container")[0].style.setProperty("width","789px","important"),document.body.querySelectorAll(".new iframe").forEach((function(t){null!==n.pathname.match(/\/thread[0-9]+/)&&e===!1||t.contentWindow.postMessage("reload","*")})),document.body.querySelector(".interstitital-ifr iframe").contentWindow.postMessage("reload","*")}}},isValidUrl:function(t){try{return new URL(t),!0}catch(e){return!1}}}})); //# sourceMappingURL=asyncPageLoad-d53bdf7914.min.js.map