window.addEventListener("scroll",function(){window.innerHeight+window.scrollY>=document.body.offsetHeight-1&&loadMoreData(),scrollMenuActive()});let fastLabels=document.querySelectorAll(".fast .label");function scrollMenuActive(){window.scrollY||window.pageYOffset;document.querySelectorAll(".content.category_list").forEach(function(t){var e=t.getBoundingClientRect();if(e.top<window.innerHeight-e.height){let o=t.getAttribute("id"),e=t.getAttribute("cid"),n=document.getElementById(e);n.querySelectorAll(".label").forEach(t=>{var e;t.getAttribute("id").substr(1)===o?(t.classList.add("active"),e=document.getElementById(t.getAttribute("id")).offsetLeft-n.offsetLeft,n.scrollLeft=e):t.classList.remove("active")}),document.querySelectorAll(".fast .label").forEach(t=>{t.getAttribute("cid")===e?t.click():t.classList.remove("active")})}})}function loadMoreData(){if(!window.loadStatus){document.getElementById("loadingTxt").style.display="flex",window.loadStatus=!0;var t=document.querySelectorAll(".last .label");let e=[];t.forEach(t=>{e.push({id:t.getAttribute("id").substr(1),pid:t.getAttribute("pid"),type:t.getAttribute("type")})});t=document.querySelectorAll(".category_list");let o=[];t.forEach(t=>{o.push(t.getAttribute("id"))});t=findFirstNotInArray2(e,o);t?(sionname="index_"+t.id,sessionStorage.getItem(sionname)?(document.getElementById("loadingTxt").insertAdjacentHTML("beforebegin",sessionStorage.getItem(sionname)),window.loadStatus=!1,document.getElementById("loadingTxt").style.display="none",getFastCatImg(),getFastItmImg(),getFastResImg(),getFastItmTxt()):getFetch(`/home/loadmore/${t.id}/${t.pid}/`+t.type).then(t=>{t=atob(t.content),t=decodeURIComponent(t);document.getElementById("loadingTxt").insertAdjacentHTML("beforebegin",t),window.loadStatus=!1,document.getElementById("loadingTxt").style.display="none",sessionStorage.setItem(sionname,t),getFastCatImg(),getFastItmImg(),getFastResImg(),getFastItmTxt()})):document.getElementById("loadingTxt").style.display="none"}}function findFirstNotInArray2(t,e){for(var o=0;o<t.length;o++)if(!e.includes(t[o].id))return t[o];return null}function getRandomElements(t,e){var o=t.slice();for(let t=o.length-1;0<t;t--){var n=Math.floor(Math.random()*(t+1));[o[t],o[n]]=[o[n],o[t]]}return o.slice(0,e)}function showNotice(){let o=document.querySelector(".pop_show_box .info .domain");var t=sessionStorage.getItem("nstatus");if(o&&!t){getRandomElements(o.getAttribute("domain").split(","),4).forEach(t=>{var e=document.createElement("a");e.textContent=t,e.href=`https://${t}/`,e.target="_blank",o.appendChild(e)});let e=document.querySelector(".pop_show_box");e.style.display="flex",document.querySelectorAll(".pop_show_box .closenot").forEach(t=>{t.addEventListener("click",function(){sessionStorage.setItem("nstatus",1),e.style.display="none"})})}}fastLabels.forEach(o=>{o.addEventListener("click",function(){var t=o.getAttribute("cid"),e=document.querySelectorAll(".last");document.querySelectorAll(".fast .label.active").forEach(t=>{t.classList.remove("active")}),o.classList.add("active"),e.forEach(t=>{t.style.display="none"}),document.getElementById(t).style.display="block",document.getElementsByClassName("fast")[0].scrollLeft=o.offsetLeft})}),document.querySelector(".fast .label").click(),showNotice();