window.addEventListener("scroll",function(){window.innerHeight+window.scrollY>=document.body.offsetHeight-1&&loadMoreData(),scrollMenuActive()});let lastLabels=document.querySelectorAll(".last .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 e=t.getAttribute("id");lastLabels.forEach(t=>{t.getAttribute("cid")===e?(t.classList.add("active"),document.getElementsByClassName("last")[0].scrollLeft=t.offsetLeft):t.classList.remove("active")}),document.querySelectorAll(".fast .label").forEach(t=>{t.getAttribute("cid")===cid?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(t.getAttribute("cid"))});t=document.querySelectorAll(".category_list");let l=[];t.forEach(t=>{l.push(t.getAttribute("id"))});t=findFirstNotInArray2(e,l);t?(sionname="factory_"+t,sessionStorage.getItem(sionname)?(document.getElementById("loadingTxt").insertAdjacentHTML("beforebegin",sessionStorage.getItem(sionname)),window.loadStatus=!1,document.getElementById("loadingTxt").style.display="none",getFastCatImg(),getFastItmImg(),getFastResImg()):getFetch("/factory/loadmore/"+t).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()})):document.getElementById("loadingTxt").style.display="none"}}function findFirstNotInArray2(t,e){for(var l=0;l<t.length;l++)if(!e.includes(t[l]))return t[l];return null}lastLabels.forEach(e=>{e.addEventListener("click",function(){var t=e.getAttribute("cid");document.querySelectorAll(".last .label.active").forEach(t=>{t.classList.remove("active")}),e.classList.add("active"),document.getElementById(t).style.display="block",document.getElementsByClassName("last")[0].scrollLeft=e.offsetLeft})}),document.querySelector(".last .label").classList.add("active");