diff --git a/dist/index.461e974e.js b/dist/index.46f407b9.js similarity index 59% rename from dist/index.461e974e.js rename to dist/index.46f407b9.js index 97fe795..a7559da 100644 --- a/dist/index.461e974e.js +++ b/dist/index.46f407b9.js @@ -38,24 +38,24 @@ let e,t,o,n,l,a,s,i,c,r,d,u,m,g;const h="https://x1337x.ws/sort-category-search/ id="tickBoxField"> ${d} - `),n=document.getElementById("tickBoxField")),e=document.getElementById("inputDialogContainer"),t=document.getElementById("inputDialogSubmitButton"),o=document.getElementById("inputDialogCancelButton"),l=document.getElementsByClassName("modalInputField"),document.body.style.overflow="hidden",l[0].focus(),r||(o.style.display="none");let g=new Promise((a,s)=>{e.style.opacity="1";let i=()=>{o.removeEventListener("click",i),e.remove(),document.body.style.overflow="auto",s(Error(null))},c=()=>{t.removeEventListener("click",c),d&&(n.removeEventListener("change",u[1]),n=n.checked);let o=[];for(let e of l)o.push(e.value),u&&e.removeEventListener("input",u);let s={inputValues:o,checkboxChecked:n};e.remove(),document.body.style.overflow="auto",console.log(s),a(s)};if(o.addEventListener("click",i),t.addEventListener("click",c),u[0])for(let e of l)e.addEventListener("input",u[0]);u[1]&&d&&n.addEventListener("change",u[1])});return m&&m(),g},getSubmitButton:()=>t,getCancelButton:()=>o,getInputFields:()=>l,getCheckboxField:e=>n};function I(e){try{return new URL(e),!0}catch(e){return!1}}const E=(e,t=!1)=>{let o=v.getSubmitButton(),n=v.getInputFields();for(let e of n)if(e.value.length)o.disabled=!1;else{o.disabled=!0;return}t&&(I(n[1].value)?o.disabled=!1:o.disabled=!0)};function B(e){document.documentElement.style.setProperty("--cross-display",e)}let L=JSON.parse(localStorage.getItem("saved_bookmarks"));function S(e,t,o){document.getElementsByClassName("flex-sub-container-horizontal")[0].appendChild(function(e,t,o){let n=document.createElement("span");n.textContent=t,n.className="custom_link_name";let l=document.createElement("div");l.className="cross",l.title="Modify bookmark details",l.setAttribute("tabindex","5");let a=document.createElement("a");return a.className="custom_bookmark clickable",a.setAttribute("href",e),a.setAttribute("id",o),a.setAttribute("tabindex","1"),a.appendChild(n),a.appendChild(l),a}(e,t,o));let n=document.getElementsByClassName("cross");n[n.length-1].addEventListener("click",D)}function C(e,t,o){L.push({link:e,name:t,id:o}),localStorage.setItem("saved_bookmarks",JSON.stringify(L))}function x(e){switch(e){case"show":B("block");break;case"hide":B("none")}}function T(e,t){let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),o.setAttribute("download",e),o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o)}function D(e){e.preventDefault(),e.stopPropagation();let t=e.target.parentNode,o=function(e){let t=L.filter(t=>e==t.id);return[t[0].id,t[0].name,t[0].link]}(t.id);v.show("Edit bookmark",null,["Name","Address"],"Save","Cancel","Delete this bookmark",[()=>E(e,!0),()=>{let e=v.getCheckboxField(),t=v.getSubmitButton(),o=v.getInputFields();if(e.checked){for(let e of(t.textContent="Delete",t.classList.add("deleteButton"),o))e.disabled=!0;t.disabled=!1}else if(!e.checked)for(let e of(t.textContent="Save",t.classList.remove("deleteButton"),o))e.disabled=!1}],()=>{v.getInputFields()[0].setAttribute("maxlength","4"),v.getInputFields()[0].value=o[1],v.getInputFields()[1].value=o[2]}).then(e=>{if(e.checkboxChecked){var o;o=t.id,L=L.filter(e=>o!=e.id),localStorage.setItem("saved_bookmarks",JSON.stringify(L)),t.style.display="none";return}t.href=e.inputValues[1].replaceAll(" ",""),t.firstChild.innerHTML=e.inputValues[0],function(e,t,o){let n=L.filter(t=>e==t.id);n[0].name=t,n[0].link=o,localStorage.setItem("saved_bookmarks",JSON.stringify(L))}(t.id,e.inputValues[0],e.inputValues[1].replaceAll(" ",""))}).catch(e=>console.log(e))}const $={"bg-img-drop":function(e){let t=document.getElementById("overlay");switch(e){case"hidden":t.style.backgroundColor="rgba(0, 0, 0, 1)";break;case"shown":t.style.backgroundColor="rgba(0, 0, 0, 0.375)"}},"bg-blur-drop":function(e){let t=document.getElementById("overlay");switch(e){case"off":t.style.backdropFilter="blur(0em)";break;case"on":var o;t.style.backdropFilter="blur(1em)",o="overlay",document.getElementById(o).style.backdropFilter="blur(0.9em)",setTimeout(()=>{document.getElementById(o).style.backdropFilter="blur(1em)"},1)}},"footer-display-drop":function(e){let t=document.getElementById("footer");switch(e){case"off":t.classList.add("hidden");break;case"on":t.classList.remove("hidden")}},"def-widget-drop":function(e){function t(e){switch(e){case"show":document.getElementById("update-customtext-btn").classList.remove("nested-close");break;case"hide":document.getElementById("update-customtext-btn").classList.add("nested-close")}}switch(e){case"casamia":t("hide"),ee("off"),N("Casa Mia");break;case"search":t("hide"),ee("off"),N("Search");break;case"clock":t("hide"),ee("on");break;case"custom":let o;ee("off"),t("show"),null==(o=localStorage.getItem("customWidgetText"))&&(localStorage.setItem("customWidgetText","Custom Text"),o=localStorage.getItem("customWidgetText"),M()),N(o)}},"greeting-display-drop":function(e){let t=document.getElementById("subtitle");switch(clearInterval(F),e){case"off":t.classList.add("collapsed");break;case"on":t.classList.remove("collapsed"),et(),F=setInterval(et,2e4)}},"def-widget-display-drop":function(e){let t=document.getElementById("main-heading-slider"),o=document.getElementById("left-arrow"),n=document.getElementById("right-arrow");function l(e){switch(e){case"show":document.getElementById("main-widget-children-container").classList.remove("nested-close");break;case"hide":document.getElementById("main-widget-children-container").classList.add("nested-close")}}switch(e){case"off":t.classList.add("hidden"),o.classList.add("hidden"),n.classList.add("hidden"),l("hide");break;case"on":t.classList.remove("hidden"),o.classList.remove("hidden"),n.classList.remove("hidden"),l("show")}},"def-search-engine-drop":function(e){function t(e){document.getElementById("search-btn-icon").className=e,localStorage.setItem("default-search-icon",e)}function o(e){switch(e){case"show":document.getElementById("update-customdomain-btn").classList.remove("nested-close");break;case"hide":document.getElementById("update-customdomain-btn").classList.add("nested-close")}}switch(e){case"google":o("hide"),O(p),t("fa-brands fa-google");break;case"bing":o("hide"),O(f),t("fa fa-magnifying-glass");break;case"duckduckgo":o("hide"),O(y),t("fa fa-magnifying-glass");break;case"custom":let n;o("show"),null==(n=localStorage.getItem("customDomain"))&&(localStorage.setItem("customDomain",p),n=localStorage.getItem("customDomain"),_()),O(n),t("fa fa-magnifying-glass")}},"searchbar-position-drop":function(e){let t=document.getElementById("searchbar"),o=document.getElementById("autofillContainer"),n=document.getElementById("wrap");switch(sessionStorage.setItem("searchbar-position-drop",e),e){case"top":t.style.order="0",o.style.order="1",o.style.bottom="0em",o.style.top="3.75em",n.style.margin="0 auto auto auto";break;case"bottom":t.style.order="1",o.style.order="0",o.style.bottom="3.75em",o.style.top="",n.style.margin="auto auto 0 auto";break;case"middle":t.style.order="0",o.style.order="1",o.style.bottom="0em",o.style.top="3.75em",n.style.margin="auto auto auto auto"}},"searchbar-color-theme-drop":function(e){let t=document.getElementById("searchContainer");switch(sessionStorage.setItem("searchbar-color-theme-drop",e),e){case"glass":t.classList.add("searchbox-style-glass"),t.classList.remove("searchbox-style-light"),t.classList.remove("searchbox-style-dark");break;case"light":t.classList.remove("searchbox-style-glass"),t.classList.add("searchbox-style-light"),t.classList.remove("searchbox-style-dark");break;case"dark":t.classList.remove("searchbox-style-glass"),t.classList.remove("searchbox-style-light"),t.classList.add("searchbox-style-dark")}},"focus-search-drop":function(e){sessionStorage.setItem("focus",e)},"search-display-drop":function(e){let t=document.getElementById("searchbar"),o=document.getElementById("search-display-children-container"),n=document.getElementById("def-search-engine-drop-container");function l(e){switch(e){case"show":o.classList.remove("nested-close"),n.classList.remove("nested-close");break;case"hide":o.classList.add("nested-close"),n.classList.add("nested-close")}}switch(e){case"off":t.classList.add("hidden"),l("hide");break;case"on":t.classList.remove("hidden"),l("show")}},"movies-search-display-drop":function(e){let t=document.getElementById("movies-search");switch(e){case"hidden":t.style.display="none";break;case"shown":t.style.display="flex"}},"tv-search-display-drop":function(e){let t=document.getElementById("tv-search");switch(e){case"hidden":t.style.display="none";break;case"shown":t.style.display="flex"}},"games-search-display-drop":function(e){let t=document.getElementById("games-search");switch(e){case"hidden":t.style.display="none";break;case"shown":t.style.display="flex"}},"ebooks-search-display-drop":function(e){let t=document.getElementById("ebooks-search");switch(e){case"hidden":t.style.display="none";break;case"shown":t.style.display="flex"}},"add-bookmark-display-drop":function(e){let t=document.getElementById("add_bookmark_button");switch(e){case"hidden":t.style.display="none";break;case"shown":t.style.display="flex"}}},A=document.getElementsByClassName("widget-slide");function N(e){for(let t of A)t.textContent=e}function M(){let e=localStorage.getItem("customWidgetText");v.show("Custom widget text","Enter text you want to set as the main widget.",["Custom text"],"Save","Cancel",null,[E,null],()=>{v.getInputFields()[0].value=e}).then(e=>{localStorage.setItem("customWidgetText",e.inputValues[0]),N(e.inputValues[0]),H()}).catch(e=>{console.error(e)})}function _(){let e=localStorage.getItem("customDomain");v.show("Custom widget text","Enter text you want to set as the main widget.",["Custom text"],"Save","Cancel",null,[E,null],()=>{v.getInputFields()[0].value=e}).then(e=>{localStorage.setItem("customDomain",e.inputValues[0]),O(e.inputValues[0]),V()}).catch(e=>{console.error(e)})}let F=null;function O(e){localStorage.setItem("default-search-url",e)}function j(){for(let e of Object.entries(JSON.parse(localStorage.getItem("advDropdownValues")))){let t=$[e[0]];t&&t(e[1])}P(),H(),V();let e=sessionStorage.getItem("input");e&&(document.getElementById("searchTerm").value=e)}function P(){document.getElementById("update-username-btn-preview").textContent=localStorage.getItem("userName")}function H(){document.getElementById("update-customtext-btn-preview").textContent=localStorage.getItem("customWidgetText")}function V(){document.getElementById("update-customdomain-btn-preview").textContent=localStorage.getItem("customDomain")}const J=`The command you have passed is invalid. + `),n=document.getElementById("tickBoxField")),e=document.getElementById("inputDialogContainer"),t=document.getElementById("inputDialogSubmitButton"),o=document.getElementById("inputDialogCancelButton"),l=document.getElementsByClassName("modalInputField"),document.body.style.overflow="hidden",l[0].focus(),r||(o.style.display="none");let g=new Promise((a,s)=>{e.style.opacity="1";let i=()=>{o.removeEventListener("click",i),e.remove(),document.body.style.overflow="auto",s(Error(null))},c=()=>{t.removeEventListener("click",c),d&&(n.removeEventListener("change",u[1]),n=n.checked);let o=[];for(let e of l)o.push(e.value),u&&e.removeEventListener("input",u);let s={inputValues:o,checkboxChecked:n};e.remove(),document.body.style.overflow="auto",console.log(s),a(s)};if(o.addEventListener("click",i),t.addEventListener("click",c),u[0])for(let e of l)e.addEventListener("input",u[0]);u[1]&&d&&n.addEventListener("change",u[1])});return m&&m(),g},getSubmitButton:()=>t,getCancelButton:()=>o,getInputFields:()=>l,getCheckboxField:e=>n};function I(e){try{return new URL(e),!0}catch(e){return!1}}const E=(e,t=!1)=>{let o=v.getSubmitButton(),n=v.getInputFields();for(let e of n)if(e.value.length)o.disabled=!1;else{o.disabled=!0;return}t&&(I(n[1].value)?o.disabled=!1:o.disabled=!0)};function B(e){document.documentElement.style.setProperty("--cross-display",e)}let L=JSON.parse(localStorage.getItem("saved_bookmarks"));function S(e,t,o){document.getElementsByClassName("flex-sub-container-horizontal")[0].appendChild(function(e,t,o){let n=document.createElement("span");n.textContent=t,n.className="custom_link_name";let l=document.createElement("div");l.className="cross",l.title="Modify bookmark details",l.setAttribute("tabindex","5");let a=document.createElement("a");return a.className="custom_bookmark clickable",a.setAttribute("href",e),a.setAttribute("id",o),a.setAttribute("tabindex","1"),a.appendChild(n),a.appendChild(l),a}(e,t,o));let n=document.getElementsByClassName("cross");n[n.length-1].addEventListener("click",D)}function x(e,t,o){L.push({link:e,name:t,id:o}),localStorage.setItem("saved_bookmarks",JSON.stringify(L))}function C(e){switch(e){case"show":B("block");break;case"hide":B("none")}}function T(e,t){let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),o.setAttribute("download",e),o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o)}function D(e){e.preventDefault(),e.stopPropagation();let t=e.target.parentNode,o=function(e){let t=L.filter(t=>e==t.id);return[t[0].id,t[0].name,t[0].link]}(t.id);v.show("Edit bookmark",null,["Name","Address"],"Save","Cancel","Delete this bookmark",[()=>E(e,!0),()=>{let e=v.getCheckboxField(),t=v.getSubmitButton(),o=v.getInputFields();if(e.checked){for(let e of(t.textContent="Delete",t.classList.add("deleteButton"),o))e.disabled=!0;t.disabled=!1}else if(!e.checked)for(let e of(t.textContent="Save",t.classList.remove("deleteButton"),o))e.disabled=!1}],()=>{v.getInputFields()[0].setAttribute("maxlength","4"),v.getInputFields()[0].value=o[1],v.getInputFields()[1].value=o[2]}).then(e=>{if(e.checkboxChecked){var o;o=t.id,L=L.filter(e=>o!=e.id),localStorage.setItem("saved_bookmarks",JSON.stringify(L)),t.style.display="none";return}t.href=e.inputValues[1].replaceAll(" ",""),t.firstChild.innerHTML=e.inputValues[0],function(e,t,o){let n=L.filter(t=>e==t.id);n[0].name=t,n[0].link=o,localStorage.setItem("saved_bookmarks",JSON.stringify(L))}(t.id,e.inputValues[0],e.inputValues[1].replaceAll(" ",""))}).catch(e=>console.log(e))}const $={"bg-img-drop":function(e){let t=document.getElementById("overlay");switch(e){case"hidden":t.style.backgroundColor="rgba(0, 0, 0, 1)";break;case"shown":t.style.backgroundColor="rgba(0, 0, 0, 0.375)"}},"bg-blur-drop":function(e){let t=document.getElementById("overlay");switch(e){case"off":t.style.backdropFilter="blur(0em)";break;case"on":var o;t.style.backdropFilter="blur(1em)",o="overlay",document.getElementById(o).style.backdropFilter="blur(0.9em)",setTimeout(()=>{document.getElementById(o).style.backdropFilter="blur(1em)"},1)}},"footer-display-drop":function(e){let t=document.getElementById("footer");switch(e){case"off":t.classList.add("hidden");break;case"on":t.classList.remove("hidden")}},"def-widget-drop":function(e){function t(e){switch(e){case"show":document.getElementById("update-customtext-btn").classList.remove("nested-close");break;case"hide":document.getElementById("update-customtext-btn").classList.add("nested-close")}}switch(e){case"casamia":t("hide"),ee("off"),A("Casa Mia");break;case"search":t("hide"),ee("off"),A("Search");break;case"clock":t("hide"),ee("on");break;case"custom":let o;ee("off"),t("show"),null==(o=localStorage.getItem("customWidgetText"))&&(localStorage.setItem("customWidgetText","Custom Text"),o=localStorage.getItem("customWidgetText"),_()),A(o)}},"greeting-display-drop":function(e){let t=document.getElementById("subtitle");switch(clearInterval(F),e){case"off":t.classList.add("collapsed");break;case"on":t.classList.remove("collapsed"),et(),F=setInterval(et,2e4)}},"def-widget-display-drop":function(e){let t=document.getElementById("main-heading-slider"),o=document.getElementById("left-arrow"),n=document.getElementById("right-arrow");function l(e){switch(e){case"show":document.getElementById("main-widget-children-container").classList.remove("nested-close");break;case"hide":document.getElementById("main-widget-children-container").classList.add("nested-close")}}switch(e){case"off":t.classList.add("hidden"),o.classList.add("hidden"),n.classList.add("hidden"),l("hide");break;case"on":t.classList.remove("hidden"),o.classList.remove("hidden"),n.classList.remove("hidden"),l("show")}},"def-search-engine-drop":function(e){function t(e){document.getElementById("search-btn-icon").className=e,localStorage.setItem("default-search-icon",e)}function o(e){switch(e){case"show":document.getElementById("update-customdomain-btn").classList.remove("nested-close");break;case"hide":document.getElementById("update-customdomain-btn").classList.add("nested-close")}}switch(e){case"google":o("hide"),O(p),t("fa-brands fa-google");break;case"bing":o("hide"),O(f),t("fa fa-magnifying-glass");break;case"duckduckgo":o("hide"),O(y),t("fa fa-magnifying-glass");break;case"custom":let n;o("show"),null==(n=localStorage.getItem("customDomain"))&&(localStorage.setItem("customDomain",p),n=localStorage.getItem("customDomain"),M()),O(n),t("fa fa-magnifying-glass")}},"searchbar-position-drop":function(e){let t=document.getElementById("searchbar"),o=document.getElementById("autofillContainer"),n=document.getElementById("wrap");switch(sessionStorage.setItem("searchbar-position-drop",e),e){case"top":t.style.order="0",o.style.order="1",o.style.bottom="0em",o.style.top="3.75em",n.style.margin="0 auto auto auto";break;case"bottom":t.style.order="1",o.style.order="0",o.style.bottom="3.75em",o.style.top="",n.style.margin="auto auto 0 auto";break;case"middle":t.style.order="0",o.style.order="1",o.style.bottom="0em",o.style.top="3.75em",n.style.margin="auto auto auto auto"}},"searchbar-color-theme-drop":function(e){let t=document.getElementById("searchContainer");switch(sessionStorage.setItem("searchbar-color-theme-drop",e),e){case"glass":t.classList.add("searchbox-style-glass"),t.classList.remove("searchbox-style-light"),t.classList.remove("searchbox-style-dark");break;case"light":t.classList.remove("searchbox-style-glass"),t.classList.add("searchbox-style-light"),t.classList.remove("searchbox-style-dark");break;case"dark":t.classList.remove("searchbox-style-glass"),t.classList.remove("searchbox-style-light"),t.classList.add("searchbox-style-dark")}},"focus-search-drop":function(e){sessionStorage.setItem("focus",e)},"search-display-drop":function(e){let t=document.getElementById("searchbar"),o=document.getElementById("search-display-children-container"),n=document.getElementById("def-search-engine-drop-container");function l(e){switch(e){case"show":o.classList.remove("nested-close"),n.classList.remove("nested-close");break;case"hide":o.classList.add("nested-close"),n.classList.add("nested-close")}}switch(e){case"off":t.classList.add("hidden"),l("hide");break;case"on":t.classList.remove("hidden"),l("show")}},"movies-search-display-drop":function(e){let t=document.getElementById("movies-search");switch(e){case"hidden":t.style.display="none";break;case"shown":t.style.display="flex"}},"tv-search-display-drop":function(e){let t=document.getElementById("tv-search");switch(e){case"hidden":t.style.display="none";break;case"shown":t.style.display="flex"}},"games-search-display-drop":function(e){let t=document.getElementById("games-search");switch(e){case"hidden":t.style.display="none";break;case"shown":t.style.display="flex"}},"ebooks-search-display-drop":function(e){let t=document.getElementById("ebooks-search");switch(e){case"hidden":t.style.display="none";break;case"shown":t.style.display="flex"}},"add-bookmark-display-drop":function(e){let t=document.getElementById("add_bookmark_button");switch(e){case"hidden":t.style.display="none";break;case"shown":t.style.display="flex"}}},N=document.getElementsByClassName("widget-slide");function A(e){for(let t of N)t.textContent=e}function _(){let e=localStorage.getItem("customWidgetText");v.show("Custom widget text","Enter text you want to set as the main widget.",["Custom text"],"Save","Cancel",null,[E,null],()=>{v.getInputFields()[0].value=e}).then(e=>{localStorage.setItem("customWidgetText",e.inputValues[0]),A(e.inputValues[0]),V()}).catch(e=>{console.error(e)})}function M(){let e=localStorage.getItem("customDomain");v.show("Custom widget text","Enter text you want to set as the main widget.",["Custom text"],"Save","Cancel",null,[E,null],()=>{v.getInputFields()[0].value=e}).then(e=>{localStorage.setItem("customDomain",e.inputValues[0]),O(e.inputValues[0]),H()}).catch(e=>{console.error(e)})}let F=null;function O(e){localStorage.setItem("default-search-url",e)}function j(){for(let e of Object.entries(JSON.parse(localStorage.getItem("advDropdownValues")))){let t=$[e[0]];t&&t(e[1])}P(),V(),H();let e=sessionStorage.getItem("input");e&&(document.getElementById("searchTerm").value=e)}function P(){document.getElementById("update-username-btn-preview").textContent=localStorage.getItem("userName")}function V(){document.getElementById("update-customtext-btn-preview").textContent=localStorage.getItem("customWidgetText")}function H(){document.getElementById("update-customdomain-btn-preview").textContent=localStorage.getItem("customDomain")}const R=`The command you have passed is invalid. Type --help to read the documentation. -`,W=`This will reset bookmarks. +`,q=`This will reset bookmarks. Make sure you have a backup to import later on. -Are you sure ?`,q=`This will reset everything. +Are you sure ?`,J=`This will reset everything. There is no going back. -Are you sure?`;function U(e){return 1==e.length&&(e="0"+e),e}const R={show:(e=null,t=null,o=["Submit A","Submit B"],n="Ok",l=[null,null],r=[],d=null)=>{(a=document.getElementById("alertDialogContainer"))&&a.remove(),e=e?`