',n.innerHTML=o,document.body.appendChild(n),e.refreshReportCount(),Draggable.set($.id("atHeader"))},e.onVisibilityChange=function(){var t;t=e,document[e.hidden]?(clearInterval(t.autoRefreshTimeout),t.autoRefreshTimeout=null):(t.refreshReportCount(),t.autoRefreshTimeout=setInterval(t.refreshReportCount,t.autoRefreshDelay))},e.refreshReportCount=function(n){var o,i;if(!0!==n&&(i=localStorage.getItem("4chan-cache-rc"))&&(i=JSON.parse(i)).ts>Date.now()-e.cacheTTL)return $.id("at-total").textContent=i.data[0],$.id("at-illegal").textContent=i.data[1],$.id("at-msg-cnt").style.display=i.data[2]?"block":"",void($.id("at-msg").textContent=i.data[2]||0);(o=new XMLHttpRequest).open("GET","https://"+t.reportsSubDomain+".4chan.org/H429f6uIsUqU.php",!0),o.withCredentials=!0,o.onload=function(){var e,t,n,o;if(200==this.status){try{t=JSON.parse(this.responseText)}catch(i){return void console.log(i)}if("success"!==t.status)return void console.log(t.message);o=(n=t.data).msg||0,$.id("at-msg-cnt").style.display=o?"block":"",$.id("at-msg").textContent=o,$.id("at-total").textContent=n.total,$.id("at-illegal").textContent=n.illegal,e={ts:Date.now(),data:[n.total,n.illegal,o]},e=JSON.stringify(e),localStorage.setItem("4chan-cache-rc",e),document.dispatchEvent(new CustomEvent("4chanATUpdated"))}else this.onerror()},o.onerror=function(){console.log("Error while refreshing the report count (Status: "+this.status+").")},o.onloadend=function(){$.id("atRefresh").src=Main.icons.refresh},$.id("atRefresh").src=Main.icons.rotate,o.send(null)},e.resetMsgCount=function(){var e;$.id("at-msg").textContent=0,(e=localStorage.getItem("4chan-cache-rc"))&&((e=JSON.parse(e)).data[2]=0,e=JSON.stringify(e),localStorage.setItem("4chan-cache-rc",e))};var t={nextChunkIndex:0,nextChunk:null,chunkSize:100,reportsSubDomain:"reports"};t.initIconsCatalog=function(){var e,t,n;if(Main.icons={up:"arrow_up.png",down:"arrow_down.png",right:"arrow_right.png",download:"arrow_down2.png",refresh:"refresh.png",cross:"cross.png",gis:"gis.png",iqdb:"iqdb.png",minus:"post_expand_minus.png",plus:"post_expand_plus.png",rotate:"post_expand_rotate.gif",quote:"quote.png",report:"report.png",notwatched:"watch_thread_off.png",watched:"watch_thread_on.png",help:"question.png"},t={yotsuba_new:"futaba/",futaba_new:"futaba/",yotsuba_b_new:"burichan/",burichan_new:"burichan/",tomorrow:"tomorrow/",photon:"photon/"},n="//s.4cdn.org/image/",window.devicePixelRatio>=2)for(e in Main.icons)Main.icons[e]=Main.icons[e].replace(".","@2x.");n+="buttons/"+t[Main.stylesheet];for(e in Main.icons)Main.icons[e]=n+Main.icons[e]},t.apiUrlFilter=function(e){return e+"?"+Math.round(Date.now()/1e3/3)},t.openDeletePrompt=function(e){var n,o;n='
Delete Post No.'+(e=e.getAttribute("data-id"))+'
',(o=document.createElement("div")).className="UIPanel",o.id="delete-prompt",o.innerHTML=n,o.addEventListener("click",t.closeDeletePrompt,!1),document.body.appendChild(o),$.id("delete-prompt-inner").firstElementChild.focus()},t.closeDeletePrompt=function(e){var n;e&&"delete-prompt"!=e.target.id||(n=$.id("delete-prompt"))&&(n.removeEventListener("click",t.closeDeletePrompt,!1),document.body.removeChild(n))},t.deletePost=function(e,n){var o,i,a,s,r,d,l,c;o=e.getAttribute("data-id"),c=$.id("t"+o),a=new FormData,r="https://sys."+$L.d(Main.board)+"/"+Main.board+"/post",d=window.thread_archived?"arcdel":"usrdel",n&&("Delete Image No.",a.append("onlyimgdel","on")),a.append(o,"delete"),a.append("mode",d),a.append("pwd","janitorise"),(l=$.id("delete-prompt-inner")).textContent="Deleting...",(i=new XMLHttpRequest).open("POST",r),i.withCredentials=!0,i.onload=function(){if(e.src=Main.icons.cross,200==this.status)if(-1!=this.responseText.indexOf("Updating")){if(n)(s=$.id("f"+o)).innerHTML='';else{if(o==Main.tid)return void(location.href="//boards."+$L.d(Main.board)+"/"+Main.board+"/");c?((s=c.parentNode).removeChild(c.nextElementSibling),s.removeChild(c)):(s=$.id("pc"+o)).parentNode.removeChild(s)}t.closeDeletePrompt()}else l.textContent="Error: Post might have already been deleted, or is a sticky.";else l.textContent="Error: Wrong status while deleting No."+o+" (Status: "+this.status+")."},i.onerror=function(){l.textContent="Error: Error while deleting No."+o+" (Status: "+this.status+")."},i.send(a)},t.openBanReqWindow=function(e){var t;t=e.getAttribute("data-id"),window.open("https://sys."+$L.d(Main.board)+"/"+Main.board+"/admin?mode=admin&admin=banreq&id="+t,"_blank","scrollBars=yes,resizable=no,toolbar=no,menubar=no,location=no,directories=no,width=400,height=245")},t.openBanReqFrame=function(e){var n;this.banReqCnt&&this.close(),n=e.getAttribute("data-id"),this.banReqCnt=document.createElement("div"),this.banReqCnt.id="banReq",this.banReqCnt.className="extPanel reply",this.banReqCnt.setAttribute("data-trackpos","banReq-position"),Config["banReq-position"]?this.banReqCnt.style.cssText=Config["banReq-position"]:(this.banReqCnt.style.right="0px",this.banReqCnt.style.top="50px"),this.banReqCnt.innerHTML='
Ban Request No.'+n+'
',document.body.appendChild(this.banReqCnt),window.addEventListener("message",t.onMessage,!1),document.addEventListener("keydown",t.onKeyDown,!1),$.id("banReqClose").addEventListener("click",t.closeBanReqFrame,!1),Draggable.set($.id("banReqHeader"))},t.closeBanReqFrame=function(){window.removeEventListener("message",t.onMessage,!1),document.removeEventListener("keydown",t.onKeyDown,!1),Draggable.unset($.id("banReqHeader")),$.id("banReqClose").removeEventListener("click",t.closeBanReqFrame,!1),document.body.removeChild(t.banReqCnt),t.banReqCnt=null},t.processMessage=function(e){return e?{cmd:(e=e.split("-"))[0],type:e[1],id:e.slice(2).join("-")}:{}},t.onKeyDown=function(e){27!=e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||t.closeBanReqFrame()},t.onMessage=function(e){var n;e.origin==="https://sys."+$L.d(Main.board)&&"ban"===(n=t.processMessage(e.data)).type&&("done"!==n.cmd&&"cancel"!==n.cmd||t.closeBanReqFrame())},t.onClick=function(n){var o,i;if((o=n.target)!=document&&(i=o.getAttribute("data-cmd")))switch(i){case"at-refresh":e.refreshReportCount(!0);break;case"delete-post":case"delete-image":t.deletePost(o,"delete-image"===i);break;case"open-delete-prompt":t.openDeletePrompt(o);break;case"close-delete-prompt":t.closeDeletePrompt();break;case"open-banreq-prompt":Config.inlinePopups?t.openBanReqFrame(o):t.openBanReqWindow(o);break;case"at-msg":e.resetMsgCount();break;case"toggle-file-spoiler":t.setFileSpoiler(o);break;case"prompt-spoiler":confirm("Toggle spoiler?")&&t.setFileSpoiler(o);break;case"boardlist-open":t.openBoardList();break;case"boardlist-close":t.closeBoardList();break;case"boardlist-save":t.saveBoardList(),t.closeBoardList()}},t.onScroll=function(){for(var e;t.nextChunk.offsetTop=t.postCount)return t.parseRange(t.nextChunkIndex,t.postCount),window.removeEventListener("scroll",t.onScroll,!1),!1;t.parseRange(t.nextChunkIndex,e)}return!0},t.parseRange=function(e,n){var o,i,a;for(a=document.getElementById("t"+Main.tid).getElementsByClassName("postInfo"),o=e;o',window.spoilers&&(el=$.id("fT"+n))&&(o+=''),window.thread_archived||(o+=''),(i=document.createElement("div")).className="extControls",i.innerHTML=o,a=e.getElementsByClassName("postMenuBtn")[0],e.insertBefore(i,a)},t.displayJCount=function(e,t,n,o){var i;$.addClass(e,"j-newposts"),$.addClass(t,"j-newposts"),e.setAttribute("data-no",n),t.setAttribute("data-no",n),e.textContent=t.textContent="j +"+o,i=o+" new post"+(o>1?"s":""),Main.addTooltip(e,i,"j-tooltip"),Main.addTooltip(t,i,"j-tooltip-bot")},t.refreshJCount=function(){var e,n,o,i;n=$.id("j-link"),o=$.id("j-link-bot"),n&&o&&(n=n.firstElementChild,o=o.firstElementChild,(e=localStorage.getItem("4chan-j-count"))&&(e=JSON.parse(e)),!e||Date.now()-e.time>=1e4?((i=new XMLHttpRequest).open("GET","https://sys.4chan.org/j/1mcQTXbjW5WO.php?&"+Date.now()),i.withCredentials=!0,i.onloadend=function(){var i,a,s;200==this.status||304==this.status?(i=JSON.parse(this.responseText),e&&"j"!=Main.board?i.no>e.no&&(s=i.no-e.no,t.displayJCount(n,o,i.no,s),a={time:Date.now(),no:e.no,delta:s}):a={time:Date.now(),no:i.no},a&&localStorage.setItem("4chan-j-count",JSON.stringify(a))):console.log("Error: Could not load /j/ post count (Status: "+this.status+").")},i.send(null)):e.delta&&t.displayJCount(n,o,e.no,e.delta))},t.clearJCount=function(){var e,t,n,o;n=$.id("j-tooltip"),o=$.id("j-tooltip-bot"),n&&(t=this.getAttribute("data-no"),e={time:Date.now(),no:t},localStorage.setItem("4chan-j-count",JSON.stringify(e)),n.parentNode.removeChild(n),o.parentNode.removeChild(o),setTimeout(function(){var e=$.cls("j-newposts");e[0]&&(e[0].textContent="j",$.removeClass(e[0],"j-newposts"),e[0].textContent="j",$.removeClass(e[0],"j-newposts"))},10))},t.icons={ban:"ban.png",spoiler:"s.png"},t.initIcons=function(){var e,n;if(n="//s.4cdn.org/image/buttons/"+{yotsuba_new:"futaba/",futaba_new:"futaba/",yotsuba_b_new:"burichan/",burichan_new:"burichan/",tomorrow:"tomorrow/",photon:"photon/"}[Main.stylesheet],window.devicePixelRatio>=2)for(e in t.icons)t.icons[e]=t.icons[e].replace(".","@2x.");for(e in t.icons)t.icons[e]=n+t.icons[e]},t.initNavLinks=function(){var e,n,o;n=$.id("navtopright"),o=$.id("navbotright"),(e=document.createElement("span")).id="j-link",e.innerHTML='[j]',e.firstElementChild.addEventListener("mouseup",t.clearJCount,!1),n.parentNode.insertBefore(e,n),(e=e.cloneNode(!0)).id="j-link-bot",e.firstElementChild.addEventListener("mouseup",t.clearJCount,!1),o.parentNode.insertBefore(e,o),t.refreshJCount()},t.openBoardList=function(){var e;$.id("boardList")||((e=document.createElement("div")).id="boardList",e.className="UIPanel",e.setAttribute("data-cmd","boardlist-close"),e.innerHTML='