let page=1,types="",keywords="",getMoreStatus=!0,tags=document.querySelectorAll(".tags_list .tag"),fast=(tags.forEach(e=>{e.addEventListener("click",function(){page=1,types="video",keywords=e.textContent,getMoreStatus=!0,document.getElementById("keyword").value=keywords,document.getElementById("select_type").value=types,document.querySelectorAll(".data_list").forEach(e=>{e.remove()}),getSearchData(),clickHeadMenu("2")})}),document.querySelectorAll(".fast .label")),sform=(fast.forEach(e=>{e.addEventListener("click",function(){clickHeadMenu(e.getAttribute("cid"))})}),document.querySelector(".fast .label").click(),document.getElementById("serach_key"));function getSearchData(){window.loadStatus||(window.loadStatus=!0,getMoreStatus=!1,document.getElementById("loadingTxt").style.display="flex",getFetch(`/search/data/${page}/${types}/`+encodeURIComponent(keywords)).then(e=>{var t=atob(e.content),t=decodeURIComponent(t);document.getElementById("loadingTxt").insertAdjacentHTML("beforebegin",t),window.loadStatus=!1,document.getElementById("loadingTxt").style.display="none",getFastItmImg(),getFastResImg(),getFastItmTxt(),page=page,getMoreStatus=!(page>=e.page)}))}function clickHeadMenu(t){fast.forEach(e=>{e.classList.remove("active"),e.getAttribute("cid")===t&&e.classList.add("active")}),scrollPageTop(),document.querySelectorAll(".category_list").forEach(e=>{e.style.display="none",("1"===t&&e.getAttribute("type")||"2"===t&&!e.getAttribute("type"))&&(e.style.display="block")})}sform.addEventListener("submit",function(e){e.preventDefault();var e=sform.elements.type.value,t=sform.elements.keyword.value;t?(document.querySelectorAll(".data_list").forEach(e=>{e.remove()}),page=1,types=e,keywords=t,getSearchData()):alert("\u8bf7\u8f93\u5165\u641c\u7d22\u5173\u952e\u5b57")}),window.addEventListener("scroll",function(){var e=-1!=fast[1].className.indexOf("active");window.innerHeight+window.scrollY>=document.body.offsetHeight-1&&e&&getMoreStatus&&keywords&&(page++,getSearchData())});