From 29a279e70d467ac65d3c11e0310e6814d357342f Mon Sep 17 00:00:00 2001 From: lscambo13 Date: Wed, 3 Apr 2024 23:47:18 +0530 Subject: [PATCH] Publish Build --- dist/index.1d0e7217.js | 149 ---------------------------------------- dist/index.9977f672.js | 150 +++++++++++++++++++++++++++++++++++++++++ dist/index.html | 2 +- 3 files changed, 151 insertions(+), 150 deletions(-) delete mode 100644 dist/index.1d0e7217.js create mode 100644 dist/index.9977f672.js diff --git a/dist/index.1d0e7217.js b/dist/index.1d0e7217.js deleted file mode 100644 index e6be193..0000000 --- a/dist/index.1d0e7217.js +++ /dev/null @@ -1,149 +0,0 @@ -let e,t,o,n,l,a,s,i,c,r,d,u,m,g;const p="https://x1337x.ws/sort-category-search/",h="https://www.google.com/search?q=",f="https://www.bing.com/search?q=",y="https://duckduckgo.com/?q=",b='["--help","--dl","--clock","--countdown"]',w="./assets/wallpapers/",k={"bg-img-drop":"shown","bg-blur-drop":"off","footer-display-drop":"on","def-widget-drop":"casamia","greeting-display-drop":"on","def-widget-display-drop":"on","def-search-engine-drop":"google","searchbar-position-drop":"middle","searchbar-color-theme-drop":"glass","focus-search-drop":"off","search-display-drop":"on","movies-search-display-drop":"shown","tv-search-display-drop":"shown","games-search-display-drop":"shown","ebooks-search-display-drop":"shown","downloader-button-display-drop":"shown","add-bookmark-display-drop":"shown","bookmark-labels-display-drop":"shown"},v={show:(a=null,s=null,i=["Input A","Input B"],c="Submit",r="Cancel",d=null,u=[onInput=null,onChange=null],m=null)=>{(e=document.getElementById("inputDialogContainer"))&&e.remove(),document.activeElement.blur(),a=a?`

${a}

`:"",s=s?` -

${s}

- `:"",document.body.insertAdjacentHTML("afterbegin",` -
-
- `),i.forEach(e=>{let t=e.replaceAll(" ","-").toLowerCase();t=`MODAL-INPUT-${t}`,document.getElementById("inputDialogButtonsBar").insertAdjacentHTML("beforebegin",` - - - `)}),d&&(document.getElementById("inputDialogButtonsBar").insertAdjacentHTML("beforebegin",` - - `),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 S=JSON.parse(localStorage.getItem("saved_bookmarks"));function L(e,t,o){document.getElementsByClassName("flex-sub-container-horizontal")[0].appendChild(function(e,t,o){let n=document.createElement("span");n.textContent=t.substring(0,3).toUpperCase(),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("div");a.className="loading";let s=document.createElement("a");s.className="custom_bookmark bookmark-icon clickable",s.setAttribute("href",e),s.setAttribute("id",o),s.setAttribute("tabindex","1"),s.appendChild(n),s.appendChild(a),s.appendChild(l);let i=document.createElement("span");i.className="bookmark-title",i.textContent=t,"hidden"===sessionStorage.getItem("labels")&&i.classList.add("hidden");let c=document.createElement("div");return c.className="bookmark-container",c.appendChild(s),c.appendChild(i),c}(e,t,o));let n=document.getElementsByClassName("cross");n[n.length-1].addEventListener("click",T)}function x(e,t,o){S.push({link:e,name:t,id:o}),localStorage.setItem("saved_bookmarks",JSON.stringify(S))}function C(e){switch(e){case"show":B("block");break;case"hide":B("none")}}function D(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 T(e){e.preventDefault(),e.stopPropagation();let t=e.target.parentNode,o=function(e){let t=S.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].value=o[1],v.getInputFields()[1].value=o[2]}).then(e=>{if(e.checkboxChecked){var o;o=t.id,S=S.filter(e=>o!=e.id),localStorage.setItem("saved_bookmarks",JSON.stringify(S)),t.parentNode.style.display="none";return}t.href=e.inputValues[1].replaceAll(" ",""),t.firstChild.innerHTML=e.inputValues[0].substring(0,3),t.nextSibling.innerHTML=e.inputValues[0],function(e,t,o){let n=S.filter(t=>e==t.id);n[0].name=t,n[0].link=o,localStorage.setItem("saved_bookmarks",JSON.stringify(S))}(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.5)"}},"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"),M()),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(h),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",h),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"}},"downloader-button-display-drop":function(e){let t=document.getElementById("downloader-button");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"}},"bookmark-labels-display-drop":function(e){let t=document.getElementsByClassName("bookmark-title");switch(sessionStorage.setItem("labels",e),e){case"hidden":for(let e of t)e.classList.add("hidden");break;case"shown":for(let e of t)e.classList.remove("hidden")}}},N=document.getElementsByClassName("widget-slide");function A(e){for(let t of N)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]),A(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 q=`The command you have passed is invalid. - -Type --help to read the documentation. -`,U=`This will reset bookmarks. -Make sure you have a backup to import later on. - - -Are you sure ?`,J=`This will reset everything. -There is no going back. - -Are you sure?`;function R(e){return 1==e.length&&(e="0"+e),e}const W={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?`

${e}

`:"",t=t?` -

${t}

- `:"",document.body.insertAdjacentHTML("afterbegin",` -
- -
- `),o&&o.forEach(e=>{let t=e.replaceAll(" ","-").toLowerCase();t=`ALERT-BUTTON-${t}`,document.getElementById("alertDialogButtonsBar").insertAdjacentHTML("afterbegin",` - - `)}),l[0]&&(document.getElementById("alertDialogButtonsBar").insertAdjacentHTML("beforebegin",` - - `),i=document.getElementById("tickBoxField")),a=document.getElementById("alertDialogContainer"),s=document.getElementById("alertDialogCancelButton"),c=document.getElementsByClassName("alertDialogSubmitButton"),document.body.style.overflow="hidden",s.focus();let u=new Promise((e,t)=>{a.style.alignItems="center",a.style.opacity="1";let o=()=>{s.removeEventListener("click",o),l[0]&&(i.removeEventListener("change",l[1]),i=i.checked),r&&r.forEach((e,t)=>{c[t].removeEventListener("click",e)}),a.remove(),document.body.style.overflow="auto",e(i)};s.addEventListener("click",o),r&&r.forEach((e,t)=>{c[t].addEventListener("click",e)}),l[0]&&i.addEventListener("change",l[1])});return d&&d(),u},getCancelButton:()=>s,getSubmitButtons:()=>c,getCheckboxField:()=>i},Y=(e,t)=>{W.show(e,t,null,"Ok",[null,null],null,null).then(e=>console.log(e)).catch(e=>console.error(e))};function z(e,t){let o=document.getElementById("gradient_overlay"),n=document.getElementById("wallpapers"),l=localStorage.getItem("glow");null!=t&&"1"!=l&&(o.style.opacity=t),null!=e&&(n.style.background=`linear-gradient(to top, rgb(${e}), 50%, #fbd3e900)`,o.style.background=`linear-gradient(to top, rgb(${e}), 50%, #fbd3e900)`)}let G=[];function Q(e,t){r=e,document.getElementById("overlay").style.backdropFilter="blur(1em)";let o=new Image;o.src=w+e,o.onload=e=>{K(r),localStorage.setItem("wallpaper",r),j()},z(t),function(e){let t=document.getElementsByClassName("has-shadow");for(let o=0;o(function(e){let t=document.getElementsByClassName(e),o=new Date,n=o.getHours(),l=e=>0==e?(n.toString(),n="12","AM"):e>0&&e<12?(n=R(n.toString()),"AM"):12==e?(n="12","PM"):e>12?((n-=12).toString(),n=R(n),"PM"):void 0,a=R(o.getMinutes().toString()),s=R(o.getSeconds().toString());l=l(n);let i=":";for(let e=0;e:':':',t[e].innerHTML=`${n}${i}${a} ${function(e){let t=localStorage.getItem("selected-widget-style");return"widget-2"==t||"widget-7"==t||"widget-5"==t?e.toLowerCase():e}(l.toString())}`})("widget-slide"),1e3)}}function et(){let e=document.getElementById("subtitle"),t=localStorage.getItem("userName"),o=new Date().getHours(),n=e=>e<12?`Good Morning, ${t}`:e>=12&&e<=18?`Good Afternoon, ${t}`:e>=18?`Good Evening, ${t}`:void 0;n=n(o),e.innerText=n}function eo(e,t=""){let o;e?(e.stopPropagation(),o=e.target.files[0].text()):o=t,o.then(function(t){let o=JSON.parse(t);if(!o[0]?.id){console.log(o),Y("Failed","The backup does not seem to be valid."),e.target.value=null;return}let n=[];for(let e of S)n.push(e.id);for(let e of o)n.includes(e.id)&&(function(e){let t=Date.now(),o=t+1;for(;teo(null,e.text()))}function ed(e){let t=document.getElementsByClassName("arrows");switch(e){case"show":for(let e=0;el&&(o=l),console.log(o),n.scrollLeft=o):-1==t&&((o=s-i)<0&&(o=0),console.log(o),n.scrollLeft=o)}const em=document.getElementById("notifyContainer"),eg={show:(e,t="5000",o=null)=>{let n=Date.now();(m=document.getElementById(`notifyModal-${n}`))&&m.parentNode.remove(),em.insertAdjacentHTML("afterbegin",` -
-
-

- ${e} -

-
-
- -
- `);let l=document.getElementById(`notifyLoader-${n}`);m=document.getElementById(`notifyModal-${n}`),o&&m.addEventListner("click",o);let a=e=>{o&&m.removeEventListner("click",o),u.removeEventListener("click",a),e.target.parentNode.remove()};(u=document.getElementById(`notifyDialogCancelButton-${n}`)).addEventListener("click",a),setTimeout(()=>{let e=u;setTimeout(()=>{e.click()},t),l.style.transition=t+"ms",m.style.opacity="1",m.style.marginTop="2em",l.style.width="0%"},50)}},ep=document.getElementById("advanced-settings-modal-background-overlay"),eh=document.getElementById("wrap"),ef=document.getElementById("downloadContainer"),ey=document.getElementById("progress-bar"),eb=(e,t)=>` - - `,ew=(e,t)=>{let o=new Set;t[0].forEach(e=>{e<720?o.add("SD"):e<1080?o.add("HD"):e<1440?o.add("FHD"):e<2160?o.add("QHD"):e<4320?o.add("UHD"):e>=4320&&o.add("UHD+")});let n=` - - `;return o.forEach(t=>{n=eb(e,t)+n}),n},ek=e=>{let t="";return Object.keys(e).forEach(o=>{let n;e[o].stream.length&&(n="bestVideoOnly"===o?`${e[o].info}P MUTED`:"NA"===e[o].info?"AUDIO":`${e[o].info}P`)&&(t+=eb(e[o].stream,n))}),t},ev=(e,t,o,n)=>{let l=ek(t),a=ew("#",n);ef.insertAdjacentHTML("beforeend",` -
- -
- ${e} -
-
- FREE -
- ${l} -
-
-
- PRO -
- ${a} -
-
-
- `)},eI=()=>{for(let e of document.querySelectorAll(".downloadItemContainer"))e.remove()},eE=()=>{ey.classList.remove("hidden"),ef.classList.add("hidden"),ef.removeEventListener("click",eE),eI(),document.title=document.title.replace("Downloader","Search"),history.pushState({loc:"home"},"","?home"),document.body.classList.remove("justifySpaceBetween"),eh.style.display="block",ep.style.display="none"},eB=(e,t=null)=>{if(!t){let e=ea().value;if(I(e))t=e;else{eg.show("You need to enter a website link first");return}}history.pushState({loc:"downloader"},"","?downloader"),document.title=document.title.replace("Search","Downloader"),document.body.classList.add("justifySpaceBetween"),eh.style.display="none",ey.classList.remove("hidden"),ep.style.display="block",window.scrollTo(0,0),document.querySelector("#searchBarFocusMode").click(),ef.classList.remove("hidden"),es("downloadContainer-close-btn","click",eE),fetch(`https://casamia.cambo.in/api/getInfo/?url=${t}`).then(e=>{if(200!==e.status){e.json().then(t=>{t[0]?.err?Y(`Error ${e.status} ${e.statusText}`,t[0].err):Y(`Unknown Error ${e.status} ${e.statusText}`,t.stderr),eE()});return}e.json().then(e=>{console.log(e),e.forEach(e=>{if(ey.classList.add("hidden"),!e.resolutions.length){Y("Something went wrong",e.err),eE();return}ev(e.title,e.streams,e.thumbnail,e.resolutions),console.log(e.source,e.err)})})}).catch(e=>{Y("Fatal Error",e),eE()})};function eS(e){return!!e.startsWith("--")}function eL(e,t){let o=t.substr(4);(o=o.split(",")).forEach(t=>{if(null==window.open(`${e}${t}`,"_blank")){Y("Information","Allow pop-ups for this feature to work properly.");return}})}const ex="You must enter a search query to continue.",eC=document.querySelector(".autofillContainer"),eD=document.querySelector("#searchBarFocusMode");let eT="",e$=[];window.googleSuggestions=e=>{e$=[];let t=ea().value;e$=e[1],t&&(eO(t,e$),e_(t))};const eN=e=>{""!==eT&&document.body.removeChild(eT),(eT=document.createElement("script")).src=`https://suggestqueries.google.com/complete/search?client=firefox&callback=googleSuggestions&q=${e}`,document.body.appendChild(eT)},eA=e=>{let t=document.getElementById("search-btn-icon"),o=localStorage.getItem("default-search-icon");if(I(e)){t.className="fa fa-globe";return}if(eS(e)){t.className="fa fa-terminal";return}t.className=o},eM=()=>{eD.style.opacity="0",eC.style.paddingBlock="0em",eC.style.height="0px",setTimeout(()=>{eD.style.display="none"},200)},e_=e=>{let t=document.querySelectorAll(".autofillItem"),o=document.getElementById("searchbar");e.length&&(eD.style.display="block",setTimeout(()=>{if(t.length){let e=t[0].getBoundingClientRect(),n=e.height*t.length+1.5*e.height;eC.style.height=`${n}px`,eC.style.paddingBlockStart="0em",o.scrollIntoView()}eD.style.opacity="1",document.getElementById("downloadContainer").classList.contains("hidden")||eM()},1))},eF=()=>{document.querySelectorAll(".autofillItem").forEach(e=>{e.remove()})},eO=(e,t)=>{let o=JSON.parse(localStorage.getItem("autocompleteDatabase"));function n(e){ea().value=e.target.innerText;let t=new InputEvent("input");ea().dispatchEvent(t),ea().focus()}o||localStorage.setItem("autocompleteDatabase",b),(o=>{if(eF(),!e)return;let n=sessionStorage.getItem("searchbar-color-theme-drop");"bottom"==sessionStorage.getItem("searchbar-position-drop")?eC.style.flexDirection="column-reverse":eC.style.flexDirection="column";let l=0;for(let e of o){if(6==l)break;eC.insertAdjacentHTML("beforeend",` - - - - - `);let t=document.getElementsByClassName("autofillItemText");t[t.length-1].innerText=e,t[t.length-1].title=e,l++}for(let e of t){if(10==l)break;eC.insertAdjacentHTML("beforeend",` - - ${e} - - `),l++}})(o.filter(t=>{if(t.toLowerCase()!=e.toLowerCase())return t.toLowerCase().includes(e.toLowerCase())})),document.querySelectorAll(".autofillItem").forEach(e=>{e.addEventListener("click",n),e.addEventListener("keydown",ec)}),document.querySelectorAll(".autofillItemRem").forEach(e=>{e.addEventListener("click",eP)})},ej=e=>{let t=JSON.parse(localStorage.getItem("autocompleteDatabase")),o=new Set(t);o.add(e);let n=Array.from(o);localStorage.setItem("autocompleteDatabase",JSON.stringify(n))},eP=e=>{let t=e.target.parentNode.children[0].innerText,o=JSON.parse(localStorage.getItem("autocompleteDatabase")),n=new Set(o);console.log(n.delete(t));let l=Array.from(n);localStorage.setItem("autocompleteDatabase",JSON.stringify(l))};let eH=null;function eV(){eH&&eH.classList.toggle("loader"),eH=null}function eq(){let e=localStorage.getItem("userName");if(e){v.show("Update your name","Maximum length allowed is 17 characters.",["Change name to"],"Update","Cancel",null,[E,null],()=>{v.getInputFields()[0].setAttribute("maxlength",17),v.getInputFields()[0].value=e}).then(t=>{e=t.inputValues[0],localStorage.setItem("userName",e),P(),et()}).catch(e=>{console.error(e)});return}if(!e){let t=v.show("Welcome to Casa Mia",`Hi! We are so excited to see you here. - Please fill out the following details before moving forward. `,["Your name"],"Proceed",null,null,[E,null],()=>{v.getInputFields()[0].setAttribute("maxlength",17)});return t.then(t=>{e=t.inputValues[0],localStorage.setItem("userName",e),localStorage.setItem("onBoarding","1")}).catch(e=>{console.error(e)}),t}}function eU(){let e=document.getElementsByTagName("select"),t={};for(let o of e)t[o.id]=o.value;localStorage.setItem("advDropdownValues",JSON.stringify(t)),j()}function eJ(e){document.documentElement.style.setProperty("--blur-one-em",`blur(${e}em)`),document.documentElement.style.setProperty("--blur-one-px",`blur(${e}px)`)}let eR=!1;function eW(){let e=new Date;11==e.getMonth()&&e.getDate()>17&&32>e.getDate()&&function(){let e=document.getElementById("canvasFar"),t=e.getContext("2d"),o=window.innerWidth,n=window.innerHeight;e.width=o,e.height=n;let l=[];for(let e=0;e<50;e++)l.push({x:Math.random()*o,y:Math.random()*n,r:4*Math.random()+1,d:50*Math.random()});t.fillStyle="rgba(255, 255, 255, 0.5)",e.style.display="block",eR=!1,window.requestAnimationFrame(function e(){t.clearRect(0,0,o,n),t.beginPath();for(let e=0;e<50;e++){let o=l[e];t.moveTo(o.x,o.y),t.arc(o.x,o.y,o.r,0,2*Math.PI,!0)}t.fill(),function(){for(let e=0;e<50;e++){let t=l[e];t.y+=Math.cos(t.d)+1+t.r/10,(t.x>o+5||t.x<-5||t.y>n)&&e%3>0&&(l[e]={x:Math.random()*o,y:-10,r:t.r,d:t.d})}}(),eR||window.requestAnimationFrame(e)})}()}const eY=()=>{let e=new Date().getFullYear(),t=document.getElementById("copyright-text");t.title=`\u00A9 ${e} lscambo13`,t.innerText=`\u00A9 ${e} lscambo13`},ez=document.getElementById("wallpapers"),eG=document.getElementById("wrap"),eQ=document.getElementById("toggle-labs-btn"),eK=document.getElementById("advanced-settings-modal"),eX=document.getElementById("advanced-settings-modal-background-overlay");let eZ=!1,e0=!1;const e1=e=>{switch(eV(),e){case"close":document.title=document.title.replace("Backgrounds","Search"),history.pushState({loc:"home"},"","?home"),ez.classList.remove("animation_slide_up"),setTimeout(()=>eQ.classList.remove("advanced-settings-button-right"),350),ez.classList.add("animation_slide_down"),eG.classList.remove("animation2_slide_up"),eG.classList.add("animation2_slide_down"),clearTimeout(g),C("hide"),ed("hide"),z(null,0),setTimeout(()=>eJ(1),400),e0=!1;break;case"open":ez.style.display="flex",eJ(0),ez.classList.remove("animation_slide_down"),ez.classList.add("animation_slide_up"),eG.classList.remove("animation2_slide_down","startup_slide_down"),eG.classList.add("animation2_slide_up"),setTimeout(()=>{eQ.classList.add("advanced-settings-button-right"),function(){let e=document.getElementsByClassName("highlighted")[0];setTimeout(()=>{e&&e.scrollIntoView({inline:"center"})},10)}()},350),z(null,1),g=setTimeout(()=>C("show"),450),ed("show"),document.title=document.title.replace("Search","Backgrounds"),history.pushState({loc:"backgrounds"},"","?backgrounds"),e0=!0}};function e5(){e1("close"),history.pushState({loc:"settings"},"","?settings"),setTimeout(()=>eJ(0),420),document.title=document.title.replace("Search","Settings"),document.body.classList.add("justifySpaceBetween"),eG.style.display="none",eK.style.display="block",eX.style.display="block",eZ=!0}function e2(){document.title=document.title.replace("Settings","Search"),history.pushState({loc:"home"},"","?home"),document.body.classList.remove("justifySpaceBetween"),eG.style.display="block",eK.style.display="none",eX.style.display="none",setTimeout(()=>eJ(1),100),eZ=!1}window.createNewBookmark=()=>{let e=` - You may only use upto four letters as the bookmark name.`;v.show("Add new bookmark",e,["Bookmark name","Link to website"],"Save",void 0,null,[()=>E(null,!0),null],()=>{v.getInputFields()[0].setAttribute("placeholder","e.g. YT");let e=v.getInputFields()[1];e.setAttribute("placeholder","e.g. youtube.com"),e.value="https://",navigator.clipboard.readText().then(t=>{I(t)&&(e.value=t.replaceAll(" ",""))}).catch(e=>{console.log(e)})}).then(e=>{let t=Date.now(),o=e.inputValues[0],n=e.inputValues[1].replaceAll(" ","");n.startsWith("http")||(n=`https://${n}`),L(n,o,t),x(n,o,t)}).catch(e=>console.log(e))},window.changeWallpaper=e=>{var t;e.stopPropagation();let o=e.target.title;o||(o=e.target.childNodes[1].title);let n=(t=o,[G.filter(e=>e.title==t)[0].file,G.filter(e=>e.title==t)[0].color[1]]);Q(n[0],n[1]),X()},es("export-bookmarks-btn","click",function(e){e.stopPropagation();let t=localStorage.saved_bookmarks,o=new Date;D(`casamia-bookmarks-only-${o.getFullYear()}-${o.getMonth()+1}-${o.getDate()}.json`,t)}),es("import-bookmarks-btn","change",eo),es("export-backup-btn","click",function(e){e.stopPropagation();let t=JSON.stringify({...localStorage}),o=new Date;D(`casamia-full-backup-${o.getFullYear()}-${o.getMonth()+1}-${o.getDate()}.json`,t)}),es("import-backup-btn","change",function(e,t=""){let o;e?(e.stopPropagation(),o=e.target.files[0].text()):o=t,o.then(function(t){let o=JSON.parse(t);if(o.onBoarding){let e=Object.keys(o);e.forEach((t,n)=>{localStorage.setItem(t,o[e[n]])}),window.location.reload()}else console.log(o),Y("Failed","The backup does not seem to be valid."),e.target.value=null})}),es("download-wallpaper-btn","click",function(){let e=document.createElement("a"),t=function(e,t){let o=e.split(".");return o[o.length-1]="png",o.join(".")}(r,0);e.setAttribute("href","./assets/wallpapers-hi-res/"+t),e.setAttribute("download",t),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)}),es("toggle-favicons-btn","click",function(e){let t=document.getElementsByClassName("custom_bookmark"),o=document.getElementsByClassName("custom_link_name");for(let e=0;e{!function(e){document.getElementById(e).classList.toggle("nested-close")}("deep-search-nested");let t=document.getElementById("deep-search-btn-arrow");t.classList.toggle("fa-angle-down"),t.classList.toggle("fa-angle-up")}),es("update-customdomain-btn","click",_),es("fetch-bookmarks-btn","click",er),es("reset-bookmarks-btn","click",en),es("reset-all-btn","click",el),es("modal-close-btn","click",e2),es("toggle-labs-btn","click",e5),es("search-btn","click",function(){let e=ea().value;if(""!=e){if(ej(e),I(e)&&!e.includes(" ")){window.open(e,"_self");return}if(eS(e))!function(e){let t=e.toLowerCase();t=(t=t.split("--").join("")).split(" ");let o=e.split("--").join("").split(" ");switch(t[0]){case"help":window.open("/pages/help/index.html","_self");break;case"reset":"bookmarks"==t[1]?en():"history"==t[1]?(localStorage.setItem("autocompleteDatabase",b),window.location.reload()):"all"==t[1]?el():Y("Error",q);break;case"fetch":"default"==t[1]?er():Y("Error",q);break;case"dl":t[1]?eB(null,o[1]):Y("Failed","Enter a valid YT address");break;case"clock":window.open("./pages/clock","_self");break;case"count":window.open("./pages/countdown","_self");break;case"g":eL(h,e);break;case"b":eL(f,e);break;case"d":eL(y,e);break;default:Y("Error",q)}}(e);else{let t;e=encodeURIComponent(e);let o=(null==(t=localStorage.getItem("default-search-url"))&&(localStorage.setItem("default-search-url",h),t=localStorage.getItem("default-search-url")),t+e);window.open(o,"_self")}}else eg.show(ex)}),es("movies-search","click",function(){let e=ea().value;if(""!=e){let t=p+(e=encodeURIComponent(e))+"/Movies/time/desc/1/";window.open(t)}else eg.show(ex)}),es("tv-search","click",function(){let e=ea().value;if(""!=e){let t=p+(e=encodeURIComponent(e))+"/TV/size/desc/1/";window.open(t)}else eg.show(ex)}),es("games-search","click",function(){let e=ea().value;if(""!=e){let t=p+(e=encodeURIComponent(e))+"/Games/time/desc/1/";window.open(t)}else eg.show(ex)}),es("ebooks-search","click",function(){let e=ea().value;if(""!=e){let t=p+(e=encodeURIComponent(e))+"/Other/seeders/desc/1/";window.open(t)}else eg.show(ex)}),es("downloader-button","click",eB),es("searchTerm","input",function(e){let t=sessionStorage.getItem("input"),o=e.target.value;if(sessionStorage.setItem("input",o),eA(o),!o){eF(),setTimeout(()=>{eM()},1);return}e_(o),o!=t&&eN(o)}),es("searchTerm","click",()=>{let e=new InputEvent("input");ea().dispatchEvent(e)}),es("searchBarFocusMode","click",eM),es("searchTerm","keypress",function(e){"Enter"==e.key&&document.querySelector("#search-btn").click()}),es("fetch-bookmarks-btn","click",er),es("left-arrow","click",e=>{e.stopPropagation(),eu("widget-slide",-1)}),es("right-arrow","click",e=>{e.stopPropagation(),eu("widget-slide",1)}),window.addEventListener("resize",()=>{j(),eW()}),window.addEventListener("blur",()=>{eV()}),window.addEventListener("appinstalled",e=>{console.log("installed")}),onload=e=>{document.getElementById("main-heading-slider").classList.remove("nowrap")},es("settings_button","click",e=>{e0?e1("close",e):e0||e1("open",e)});const e3=()=>{let e;let t=document.body,o=()=>{clearInterval(e),e=null},n=t=>{["gradient_overlay","wrap","bookmarks","autofillContainer","flex-main-container-vertical","subtitle","footer"].includes(t.target.id)&&(e=setInterval(()=>{e0?e1("close"):e0||e1("open"),o()},e0?1:250))};return t.addEventListener("mousedown",n),t.addEventListener("mouseup",o),t.addEventListener("mouseout",o),t.addEventListener("touchstart",n),t.addEventListener("touchend",o),t.addEventListener("touchcancel",o),()=>{t.removeEventListener("mousedown",n),t.removeEventListener("mouseup",o),t.removeEventListener("mouseout",o),t.removeEventListener("touchstart",n),t.removeEventListener("touchend",o),t.removeEventListener("touchcancel",o),console.log("un-focus",e)}},e4=()=>{window.addEventListener("popstate",e=>{e0?e1("close"):eZ?e2():e0||eZ||(history.go(-1),console.log("cant go back anymore",-history.length-1))});let e=window.location.href;(e=e.split("/?")[1])?"settings"==e?e5():"backgrounds"==e&&e1("open"):history.pushState({loc:"home"},"","?home")},e7=()=>{let e;let t=document.getElementById("btn-install");j(),function(){if(null==S){S=[];return}for(let e of S)L(e.link,e.name,e.id)}(),function(){for(let e of Object.entries(JSON.parse(localStorage.getItem("advDropdownValues")))){let t=document.getElementById(e[0]);t&&(t.value=e[1])}}(),eG.style.opacity=1,fetch(w+"wallpapers_list.json").then(e=>{e.text().then(e=>{G=JSON.parse(e),r=localStorage.getItem("wallpaper"),d=G.filter(e=>e.file==r)[0].color[1],Q(r,d),function(){let e=document.getElementById("wallpapers");for(let t of G){let o=t.file;o=o.split(".").join("-thumb.");let n=document.createElement("div");n.className="thumb-group",n.setAttribute("onclick","changeWallpaper(event)"),n.setAttribute("onkeypress","click_to_enter(event)"),n.setAttribute("tabindex","3");let l=document.createElement("div");l.innerHTML=t.title,l.className="thumb-title",n.appendChild(l);let a=document.createElement("img");a.src=w+o,a.className="thumbnail",a.title=t.title,a.setAttribute("draggable","false"),n.appendChild(a),e.appendChild(n)}}(),X()})}).catch(e=>{console.log(e),window.open("./pages/error","_self")}),X(),e3(),ei("clickable","keypress",ec),ei("bookmark-container","click",e=>{let t=e.target.closest(".bookmark-container").querySelector("a");if(t.href){var o;window.open(t.href,"_self"),eV(),eH=o=t.querySelector(".loading"),o.classList.toggle("loader")}}),function(e,t,o){let n=document.getElementsByTagName(e);for(let e=0;e{e.prompt(),e.userChoice.then(t=>{"accepted"===t.outcome&&console.log("user accepted prompt"),e=null})}),window.addEventListener("beforeinstallprompt",o=>{o.preventDefault(),e=o,t.style.display="block"}),"1"==document.getElementById("searchbar").style.order&&window.scrollTo(0,document.body.scrollHeight),"on"==sessionStorage.getItem("focus")&&(document.getElementById("searchTerm").focus(),document.getElementById("searchTerm").click()),function(e){fetch("https://api.github.com/repos/lscambo13/casamia/commits/HEAD").then(t=>{t.json().then(t=>{let o=new Date(t.commit.committer.date).toISOString();o=(o=o.slice(0,o.length-5)).replaceAll("T","-").replaceAll(":","").replaceAll("-","."),document.getElementById(e).innerHTML=`Version ${o}`}).catch(e=>{console.error("getLastUpdated",e)})}).catch(e=>{console.error("getLastUpdated",e)})}("version-preview"),eW(),document.getElementById(localStorage.getItem("selected-widget-style")).scrollIntoView({behavior:"instant"}),setTimeout(()=>{!function(e){let t=document.getElementsByClassName(e),o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&localStorage.setItem("selected-widget-style",e.target.id)})},{rootMargin:"0px",threshold:.5});for(let e of t)o.observe(e)}("widget-slide")},500),e4()};document.addEventListener("DOMContentLoaded",()=>{eY(),"1"==localStorage.getItem("onBoarding")?(e7(),console.log("Already onboard.")):(console.log("Onboarding..."),(function(){let e=eq();return localStorage.setItem("onBoarding","0"),localStorage.setItem("advDropdownValues",JSON.stringify(k)),localStorage.setItem("wallpaper","085.webp"),localStorage.setItem("autocompleteDatabase",b),localStorage.setItem("selected-widget-style","widget-1"),e})().then(()=>{window.matchMedia("(hover: none)").matches&&setTimeout(()=>{Y("Information","Press and hold on empty area to open settings.")},5e3),e7(),console.log("Onboarding complete.")}))},{once:!0}); -//# sourceMappingURL=index.1d0e7217.js.map diff --git a/dist/index.9977f672.js b/dist/index.9977f672.js new file mode 100644 index 0000000..5a10fc7 --- /dev/null +++ b/dist/index.9977f672.js @@ -0,0 +1,150 @@ +let e,t,o,n,l,a,s,i,c,r,d,u,m,g,p;const h="https://x1337x.ws/sort-category-search/",f="https://www.google.com/search?q=",y="https://www.bing.com/search?q=",b="https://duckduckgo.com/?q=",w='["--help","--dl","--clock","--countdown"]',k="./assets/wallpapers/",v={"bg-img-drop":"shown","bg-blur-drop":"off","footer-display-drop":"on","def-widget-drop":"casamia","greeting-display-drop":"on","def-widget-display-drop":"on","def-search-engine-drop":"google","searchbar-position-drop":"middle","searchbar-color-theme-drop":"glass","focus-search-drop":"off","search-display-drop":"on","movies-search-display-drop":"shown","tv-search-display-drop":"shown","games-search-display-drop":"shown","ebooks-search-display-drop":"shown","downloader-button-display-drop":"shown","add-bookmark-display-drop":"shown","bookmark-labels-display-drop":"shown"};e="https://casamia.cambo.in/api";const I={show:(e=null,s=null,i=["Input A","Input B"],c="Submit",r="Cancel",d=null,u=[onInput=null,onChange=null],m=null)=>{(t=document.getElementById("inputDialogContainer"))&&t.remove(),document.activeElement.blur(),e=e?`

${e}

`:"",s=s?` +

${s}

+ `:"",document.body.insertAdjacentHTML("afterbegin",` +
+ + ${e} + ${s} +
+ + +
+ +
+ `),i.forEach(e=>{let t=e.replaceAll(" ","-").toLowerCase();t=`MODAL-INPUT-${t}`,document.getElementById("inputDialogButtonsBar").insertAdjacentHTML("beforebegin",` + + + `)}),d&&(document.getElementById("inputDialogButtonsBar").insertAdjacentHTML("beforebegin",` + + `),l=document.getElementById("tickBoxField")),t=document.getElementById("inputDialogContainer"),o=document.getElementById("inputDialogSubmitButton"),n=document.getElementById("inputDialogCancelButton"),a=document.getElementsByClassName("modalInputField"),document.body.style.overflow="hidden",a[0].focus(),r||(n.style.display="none");let g=new Promise((e,s)=>{t.style.opacity="1";let i=()=>{n.removeEventListener("click",i),t.remove(),document.body.style.overflow="auto",s(Error(null))},c=()=>{o.removeEventListener("click",c),d&&(l.removeEventListener("change",u[1]),l=l.checked);let n=[];for(let e of a)n.push(e.value),u&&e.removeEventListener("input",u);let s={inputValues:n,checkboxChecked:l};t.remove(),document.body.style.overflow="auto",console.log(s),e(s)};if(n.addEventListener("click",i),o.addEventListener("click",c),u[0])for(let e of a)e.addEventListener("input",u[0]);u[1]&&d&&l.addEventListener("change",u[1])});return m&&m(),g},getSubmitButton:()=>o,getCancelButton:()=>n,getInputFields:()=>a,getCheckboxField:e=>l};function E(e){try{return new URL(e),!0}catch(e){return!1}}const B=(e,t=!1)=>{let o=I.getSubmitButton(),n=I.getInputFields();for(let e of n)if(e.value.length)o.disabled=!1;else{o.disabled=!0;return}t&&(E(n[1].value)?o.disabled=!1:o.disabled=!0)};function S(e){document.documentElement.style.setProperty("--cross-display",e)}let L=JSON.parse(localStorage.getItem("saved_bookmarks"));function x(e,t,o){document.getElementsByClassName("flex-sub-container-horizontal")[0].appendChild(function(e,t,o){let n=document.createElement("span");n.textContent=t.substring(0,3).toUpperCase(),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("div");a.className="loading";let s=document.createElement("a");s.className="custom_bookmark bookmark-icon clickable",s.setAttribute("href",e),s.setAttribute("id",o),s.setAttribute("tabindex","1"),s.appendChild(n),s.appendChild(a),s.appendChild(l);let i=document.createElement("span");i.className="bookmark-title",i.textContent=t,"hidden"===sessionStorage.getItem("labels")&&i.classList.add("hidden");let c=document.createElement("div");return c.className="bookmark-container",c.appendChild(s),c.appendChild(i),c}(e,t,o));let n=document.getElementsByClassName("cross");n[n.length-1].addEventListener("click",$)}function C(e,t,o){L.push({link:e,name:t,id:o}),localStorage.setItem("saved_bookmarks",JSON.stringify(L))}function D(e){switch(e){case"show":S("block");break;case"hide":S("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 $(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);I.show("Edit bookmark",null,["Name","Address"],"Save","Cancel","Delete this bookmark",[()=>B(e,!0),()=>{let e=I.getCheckboxField(),t=I.getSubmitButton(),o=I.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}],()=>{I.getInputFields()[0].value=o[1],I.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.parentNode.style.display="none";return}t.href=e.inputValues[1].replaceAll(" ",""),t.firstChild.innerHTML=e.inputValues[0].substring(0,3),t.nextSibling.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 N={"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.5)"}},"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"),et("off"),M("Casa Mia");break;case"search":t("hide"),et("off"),M("Search");break;case"clock":t("hide"),et("on");break;case"custom":let o;et("off"),t("show"),null==(o=localStorage.getItem("customWidgetText"))&&(localStorage.setItem("customWidgetText","Custom Text"),o=localStorage.getItem("customWidgetText"),_()),M(o)}},"greeting-display-drop":function(e){let t=document.getElementById("subtitle");switch(clearInterval(O),e){case"off":t.classList.add("collapsed");break;case"on":t.classList.remove("collapsed"),eo(),O=setInterval(eo,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"),j(f),t("fa-brands fa-google");break;case"bing":o("hide"),j(y),t("fa fa-magnifying-glass");break;case"duckduckgo":o("hide"),j(b),t("fa fa-magnifying-glass");break;case"custom":let n;o("show"),null==(n=localStorage.getItem("customDomain"))&&(localStorage.setItem("customDomain",f),n=localStorage.getItem("customDomain"),F()),j(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"}},"downloader-button-display-drop":function(e){let t=document.getElementById("downloader-button");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"}},"bookmark-labels-display-drop":function(e){let t=document.getElementsByClassName("bookmark-title");switch(sessionStorage.setItem("labels",e),e){case"hidden":for(let e of t)e.classList.add("hidden");break;case"shown":for(let e of t)e.classList.remove("hidden")}}},A=document.getElementsByClassName("widget-slide");function M(e){for(let t of A)t.textContent=e}function _(){let e=localStorage.getItem("customWidgetText");I.show("Custom widget text","Enter text you want to set as the main widget.",["Custom text"],"Save","Cancel",null,[B,null],()=>{I.getInputFields()[0].value=e}).then(e=>{localStorage.setItem("customWidgetText",e.inputValues[0]),M(e.inputValues[0]),V()}).catch(e=>{console.error(e)})}function F(){let e=localStorage.getItem("customDomain");I.show("Custom widget text","Enter text you want to set as the main widget.",["Custom text"],"Save","Cancel",null,[B,null],()=>{I.getInputFields()[0].value=e}).then(e=>{localStorage.setItem("customDomain",e.inputValues[0]),j(e.inputValues[0]),U()}).catch(e=>{console.error(e)})}let O=null;function j(e){localStorage.setItem("default-search-url",e)}function P(){for(let e of Object.entries(JSON.parse(localStorage.getItem("advDropdownValues")))){let t=N[e[0]];t&&t(e[1])}H(),V(),U();let e=sessionStorage.getItem("input");e&&(document.getElementById("searchTerm").value=e)}function H(){document.getElementById("update-username-btn-preview").textContent=localStorage.getItem("userName")}function V(){document.getElementById("update-customtext-btn-preview").textContent=localStorage.getItem("customWidgetText")}function U(){document.getElementById("update-customdomain-btn-preview").textContent=localStorage.getItem("customDomain")}const q=`The command you have passed is invalid. + +Type --help to read the documentation. +`,R=`This will reset bookmarks. +Make sure you have a backup to import later on. + + +Are you sure ?`,J=`This will reset everything. +There is no going back. + +Are you sure?`;function W(e){return 1==e.length&&(e="0"+e),e}const Y={show:(e=null,t=null,o=["Submit A","Submit B"],n="Ok",l=[null,null],a=[],d=null)=>{(s=document.getElementById("alertDialogContainer"))&&s.remove(),e=e?`

${e}

`:"",t=t?` +

${t}

+ `:"",document.body.insertAdjacentHTML("afterbegin",` +
+ +
+ `),o&&o.forEach(e=>{let t=e.replaceAll(" ","-").toLowerCase();t=`ALERT-BUTTON-${t}`,document.getElementById("alertDialogButtonsBar").insertAdjacentHTML("afterbegin",` + + `)}),l[0]&&(document.getElementById("alertDialogButtonsBar").insertAdjacentHTML("beforebegin",` + + `),c=document.getElementById("tickBoxField")),s=document.getElementById("alertDialogContainer"),i=document.getElementById("alertDialogCancelButton"),r=document.getElementsByClassName("alertDialogSubmitButton"),document.body.style.overflow="hidden",i.focus();let u=new Promise((e,t)=>{s.style.alignItems="center",s.style.opacity="1";let o=()=>{i.removeEventListener("click",o),l[0]&&(c.removeEventListener("change",l[1]),c=c.checked),a&&a.forEach((e,t)=>{r[t].removeEventListener("click",e)}),s.remove(),document.body.style.overflow="auto",e(c)};i.addEventListener("click",o),a&&a.forEach((e,t)=>{r[t].addEventListener("click",e)}),l[0]&&c.addEventListener("change",l[1])});return d&&d(),u},getCancelButton:()=>i,getSubmitButtons:()=>r,getCheckboxField:()=>c},z=(e,t)=>{Y.show(e,t,null,"Ok",[null,null],null,null).then(e=>console.log(e)).catch(e=>console.error(e))};function G(e,t){let o=document.getElementById("gradient_overlay"),n=document.getElementById("wallpapers"),l=localStorage.getItem("glow");null!=t&&"1"!=l&&(o.style.opacity=t),null!=e&&(n.style.background=`linear-gradient(to top, rgb(${e}), 50%, #fbd3e900)`,o.style.background=`linear-gradient(to top, rgb(${e}), 50%, #fbd3e900)`)}let Q=[];function K(e,t){d=e,document.getElementById("overlay").style.backdropFilter="blur(1em)";let o=new Image;o.src=k+e,o.onload=e=>{X(d),localStorage.setItem("wallpaper",d),P()},G(t),function(e){let t=document.getElementsByClassName("has-shadow");for(let o=0;o(function(e){let t=document.getElementsByClassName(e),o=new Date,n=o.getHours(),l=e=>0==e?(n.toString(),n="12","AM"):e>0&&e<12?(n=W(n.toString()),"AM"):12==e?(n="12","PM"):e>12?((n-=12).toString(),n=W(n),"PM"):void 0,a=W(o.getMinutes().toString()),s=W(o.getSeconds().toString());l=l(n);let i=":";for(let e=0;e:':':',t[e].innerHTML=`${n}${i}${a} ${function(e){let t=localStorage.getItem("selected-widget-style");return"widget-2"==t||"widget-7"==t||"widget-5"==t?e.toLowerCase():e}(l.toString())}`})("widget-slide"),1e3)}}function eo(){let e=document.getElementById("subtitle"),t=localStorage.getItem("userName"),o=new Date().getHours(),n=e=>e<12?`Good Morning, ${t}`:e>=12&&e<=18?`Good Afternoon, ${t}`:e>=18?`Good Evening, ${t}`:void 0;n=n(o),e.innerText=n}function en(e,t=""){let o;e?(e.stopPropagation(),o=e.target.files[0].text()):o=t,o.then(function(t){let o=JSON.parse(t);if(!o[0]?.id){console.log(o),z("Failed","The backup does not seem to be valid."),e.target.value=null;return}let n=[];for(let e of L)n.push(e.id);for(let e of o)n.includes(e.id)&&(function(e){let t=Date.now(),o=t+1;for(;ten(null,e.text()))}function eu(e){let t=document.getElementsByClassName("arrows");switch(e){case"show":for(let e=0;el&&(o=l),console.log(o),n.scrollLeft=o):-1==t&&((o=s-i)<0&&(o=0),console.log(o),n.scrollLeft=o)}const eg=document.getElementById("notifyContainer"),ep={show:(e,t="5000",o=null)=>{let n=Date.now();(g=document.getElementById(`notifyModal-${n}`))&&g.parentNode.remove(),eg.insertAdjacentHTML("afterbegin",` +
+
+

+ ${e} +

+
+
+ +
+ `);let l=document.getElementById(`notifyLoader-${n}`);g=document.getElementById(`notifyModal-${n}`),o&&g.addEventListner("click",o);let a=e=>{o&&g.removeEventListner("click",o),m.removeEventListener("click",a),e.target.parentNode.remove()};(m=document.getElementById(`notifyDialogCancelButton-${n}`)).addEventListener("click",a),setTimeout(()=>{let e=m;setTimeout(()=>{e.click()},t),l.style.transition=t+"ms",g.style.opacity="1",g.style.marginTop="2em",l.style.width="0%"},50)}},eh=document.getElementById("advanced-settings-modal-background-overlay"),ef=document.getElementById("wrap"),ey=document.getElementById("downloadContainer"),eb=document.getElementById("progress-bar"),ew=(t,o,n,l)=>{let a=encodeURIComponent(l),s=o;return"NA"===o?s="AUDIO":parseInt(o)&&(s=`${o}P`),` + + `},ek=(e,t,o,n)=>{let l=new Set;t[0].forEach(e=>{e<720?l.add("SD"):e<1080?l.add("HD"):e<1440?l.add("FHD"):e<2160?l.add("QHD"):e<4320?l.add("UHD"):e>=4320&&l.add("UHD+")});let a=` + + `;return l.forEach(t=>{a=ew(e,t,o,n)+a}),a},ev=(e,t,o)=>{let n="";return Object.keys(e).forEach(l=>{e[l].stream.length&&("bestVideoOnly"===l?`${e[l].info}P MUTED`:"NA"===e[l].info?"AUDIO":`${e[l].info}P`)&&(n+=ew(e[l].stream,e[l].info,t,o))}),n},eI=(e,t,o,n,l)=>{let a=ev(t,l,e),s=ek("#",n,l,e);ey.insertAdjacentHTML("beforeend",` +
+ +
+ ${e} +
+
+ FREE +
+ ${a} +
+
+
+ PRO +
+ ${s} +
+
+
+ `)},eE=()=>{for(let e of document.querySelectorAll(".downloadItemContainer"))e.remove()},eB=()=>{eb.classList.remove("hidden"),ey.classList.add("hidden"),ey.removeEventListener("click",eB),eE(),document.title=document.title.replace("Downloader","Search"),history.pushState({loc:"home"},"","?home"),document.body.classList.remove("justifySpaceBetween"),ef.style.display="block",eh.style.display="none"},eS=(t,o=null)=>{if(!o){let e=es().value;if(E(e))o=e;else{ep.show("You need to enter a website link first");return}}history.pushState({loc:"downloader"},"","?downloader"),document.title=document.title.replace("Search","Downloader"),document.body.classList.add("justifySpaceBetween"),ef.style.display="none",eb.classList.remove("hidden"),eh.style.display="block",window.scrollTo(0,0),document.querySelector("#searchBarFocusMode").click(),ey.classList.remove("hidden"),ei("downloadContainer-close-btn","click",eB),fetch(`${e}/getInfo/?url=${o}`).then(e=>{if(200!==e.status){e.json().then(t=>{t[0]?.err?z(`Error ${e.status} ${e.statusText}`,t[0].err):z(`Unknown Error ${e.status} ${e.statusText}`,t.stderr),eB()});return}e.json().then(e=>{console.log(e),e.forEach(e=>{if(eb.classList.add("hidden"),!e.resolutions.length){z("Something went wrong",e.err),eB();return}eI(e.title,e.streams,e.thumbnail,e.resolutions,e.source),console.log(e.source,e.err)})})}).catch(e=>{z("Fatal Error",e),eB()})};function eL(e){return!!e.startsWith("--")}function ex(e,t){let o=t.substr(4);(o=o.split(",")).forEach(t=>{if(null==window.open(`${e}${t}`,"_blank")){z("Information","Allow pop-ups for this feature to work properly.");return}})}const eC="You must enter a search query to continue.",eD=document.querySelector(".autofillContainer"),eT=document.querySelector("#searchBarFocusMode");let e$="",eN=[];window.googleSuggestions=e=>{eN=[];let t=es().value;eN=e[1],t&&(ej(t,eN),eF(t))};const eA=e=>{""!==e$&&document.body.removeChild(e$),(e$=document.createElement("script")).src=`https://suggestqueries.google.com/complete/search?client=firefox&callback=googleSuggestions&q=${e}`,document.body.appendChild(e$)},eM=e=>{let t=document.getElementById("search-btn-icon"),o=localStorage.getItem("default-search-icon");if(E(e)){t.className="fa fa-globe";return}if(eL(e)){t.className="fa fa-terminal";return}t.className=o},e_=()=>{eT.style.opacity="0",eD.style.paddingBlock="0em",eD.style.height="0px",setTimeout(()=>{eT.style.display="none"},200)},eF=e=>{let t=document.querySelectorAll(".autofillItem"),o=document.getElementById("searchbar");e.length&&(eT.style.display="block",setTimeout(()=>{if(t.length){let e=t[0].getBoundingClientRect(),n=e.height*t.length+1.5*e.height;eD.style.height=`${n}px`,eD.style.paddingBlockStart="0em",o.scrollIntoView()}eT.style.opacity="1",document.getElementById("downloadContainer").classList.contains("hidden")||e_()},1))},eO=()=>{document.querySelectorAll(".autofillItem").forEach(e=>{e.remove()})},ej=(e,t)=>{let o=JSON.parse(localStorage.getItem("autocompleteDatabase"));function n(e){es().value=e.target.innerText;let t=new InputEvent("input");es().dispatchEvent(t),es().focus()}o||localStorage.setItem("autocompleteDatabase",w),(o=>{if(eO(),!e)return;let n=sessionStorage.getItem("searchbar-color-theme-drop");"bottom"==sessionStorage.getItem("searchbar-position-drop")?eD.style.flexDirection="column-reverse":eD.style.flexDirection="column";let l=0;for(let e of o){if(6==l)break;eD.insertAdjacentHTML("beforeend",` + + + + + `);let t=document.getElementsByClassName("autofillItemText");t[t.length-1].innerText=e,t[t.length-1].title=e,l++}for(let e of t){if(10==l)break;eD.insertAdjacentHTML("beforeend",` + + ${e} + + `),l++}})(o.filter(t=>{if(t.toLowerCase()!=e.toLowerCase())return t.toLowerCase().includes(e.toLowerCase())})),document.querySelectorAll(".autofillItem").forEach(e=>{e.addEventListener("click",n),e.addEventListener("keydown",er)}),document.querySelectorAll(".autofillItemRem").forEach(e=>{e.addEventListener("click",eH)})},eP=e=>{let t=JSON.parse(localStorage.getItem("autocompleteDatabase")),o=new Set(t);o.add(e);let n=Array.from(o);localStorage.setItem("autocompleteDatabase",JSON.stringify(n))},eH=e=>{let t=e.target.parentNode.children[0].innerText,o=JSON.parse(localStorage.getItem("autocompleteDatabase")),n=new Set(o);console.log(n.delete(t));let l=Array.from(n);localStorage.setItem("autocompleteDatabase",JSON.stringify(l))};let eV=null;function eU(){eV&&eV.classList.toggle("loader"),eV=null}function eq(){let e=localStorage.getItem("userName");if(e){I.show("Update your name","Maximum length allowed is 17 characters.",["Change name to"],"Update","Cancel",null,[B,null],()=>{I.getInputFields()[0].setAttribute("maxlength",17),I.getInputFields()[0].value=e}).then(t=>{e=t.inputValues[0],localStorage.setItem("userName",e),H(),eo()}).catch(e=>{console.error(e)});return}if(!e){let t=I.show("Welcome to Casa Mia",`Hi! We are so excited to see you here. + Please fill out the following details before moving forward. `,["Your name"],"Proceed",null,null,[B,null],()=>{I.getInputFields()[0].setAttribute("maxlength",17)});return t.then(t=>{e=t.inputValues[0],localStorage.setItem("userName",e),localStorage.setItem("onBoarding","1")}).catch(e=>{console.error(e)}),t}}function eR(){let e=document.getElementsByTagName("select"),t={};for(let o of e)t[o.id]=o.value;localStorage.setItem("advDropdownValues",JSON.stringify(t)),P()}function eJ(e){document.documentElement.style.setProperty("--blur-one-em",`blur(${e}em)`),document.documentElement.style.setProperty("--blur-one-px",`blur(${e}px)`)}let eW=!1;function eY(){let e=new Date;11==e.getMonth()&&e.getDate()>17&&32>e.getDate()&&function(){let e=document.getElementById("canvasFar"),t=e.getContext("2d"),o=window.innerWidth,n=window.innerHeight;e.width=o,e.height=n;let l=[];for(let e=0;e<50;e++)l.push({x:Math.random()*o,y:Math.random()*n,r:4*Math.random()+1,d:50*Math.random()});t.fillStyle="rgba(255, 255, 255, 0.5)",e.style.display="block",eW=!1,window.requestAnimationFrame(function e(){t.clearRect(0,0,o,n),t.beginPath();for(let e=0;e<50;e++){let o=l[e];t.moveTo(o.x,o.y),t.arc(o.x,o.y,o.r,0,2*Math.PI,!0)}t.fill(),function(){for(let e=0;e<50;e++){let t=l[e];t.y+=Math.cos(t.d)+1+t.r/10,(t.x>o+5||t.x<-5||t.y>n)&&e%3>0&&(l[e]={x:Math.random()*o,y:-10,r:t.r,d:t.d})}}(),eW||window.requestAnimationFrame(e)})}()}const ez=()=>{let e=new Date().getFullYear(),t=document.getElementById("copyright-text");t.title=`\u00A9 ${e} lscambo13`,t.innerText=`\u00A9 ${e} lscambo13`},eG=document.getElementById("wallpapers"),eQ=document.getElementById("wrap"),eK=document.getElementById("toggle-labs-btn"),eX=document.getElementById("advanced-settings-modal"),eZ=document.getElementById("advanced-settings-modal-background-overlay");let e0=!1,e1=!1;const e5=e=>{switch(eU(),e){case"close":document.title=document.title.replace("Backgrounds","Search"),history.pushState({loc:"home"},"","?home"),eG.classList.remove("animation_slide_up"),setTimeout(()=>eK.classList.remove("advanced-settings-button-right"),350),eG.classList.add("animation_slide_down"),eQ.classList.remove("animation2_slide_up"),eQ.classList.add("animation2_slide_down"),clearTimeout(p),D("hide"),eu("hide"),G(null,0),setTimeout(()=>eJ(1),400),e1=!1;break;case"open":eG.style.display="flex",eJ(0),eG.classList.remove("animation_slide_down"),eG.classList.add("animation_slide_up"),eQ.classList.remove("animation2_slide_down","startup_slide_down"),eQ.classList.add("animation2_slide_up"),setTimeout(()=>{eK.classList.add("advanced-settings-button-right"),function(){let e=document.getElementsByClassName("highlighted")[0];setTimeout(()=>{e&&e.scrollIntoView({inline:"center"})},10)}()},350),G(null,1),p=setTimeout(()=>D("show"),450),eu("show"),document.title=document.title.replace("Search","Backgrounds"),history.pushState({loc:"backgrounds"},"","?backgrounds"),e1=!0}};function e2(){e5("close"),history.pushState({loc:"settings"},"","?settings"),setTimeout(()=>eJ(0),420),document.title=document.title.replace("Search","Settings"),document.body.classList.add("justifySpaceBetween"),eQ.style.display="none",eX.style.display="block",eZ.style.display="block",e0=!0}function e3(){document.title=document.title.replace("Settings","Search"),history.pushState({loc:"home"},"","?home"),document.body.classList.remove("justifySpaceBetween"),eQ.style.display="block",eX.style.display="none",eZ.style.display="none",setTimeout(()=>eJ(1),100),e0=!1}window.createNewBookmark=()=>{let e=` + You may only use upto four letters as the bookmark name.`;I.show("Add new bookmark",e,["Bookmark name","Link to website"],"Save",void 0,null,[()=>B(null,!0),null],()=>{I.getInputFields()[0].setAttribute("placeholder","e.g. YT");let e=I.getInputFields()[1];e.setAttribute("placeholder","e.g. youtube.com"),e.value="https://",navigator.clipboard.readText().then(t=>{E(t)&&(e.value=t.replaceAll(" ",""))}).catch(e=>{console.log(e)})}).then(e=>{let t=Date.now(),o=e.inputValues[0],n=e.inputValues[1].replaceAll(" ","");n.startsWith("http")||(n=`https://${n}`),x(n,o,t),C(n,o,t)}).catch(e=>console.log(e))},window.changeWallpaper=e=>{var t;e.stopPropagation();let o=e.target.title;o||(o=e.target.childNodes[1].title);let n=(t=o,[Q.filter(e=>e.title==t)[0].file,Q.filter(e=>e.title==t)[0].color[1]]);K(n[0],n[1]),Z()},ei("export-bookmarks-btn","click",function(e){e.stopPropagation();let t=localStorage.saved_bookmarks,o=new Date;T(`casamia-bookmarks-only-${o.getFullYear()}-${o.getMonth()+1}-${o.getDate()}.json`,t)}),ei("import-bookmarks-btn","change",en),ei("export-backup-btn","click",function(e){e.stopPropagation();let t=JSON.stringify({...localStorage}),o=new Date;T(`casamia-full-backup-${o.getFullYear()}-${o.getMonth()+1}-${o.getDate()}.json`,t)}),ei("import-backup-btn","change",function(e,t=""){let o;e?(e.stopPropagation(),o=e.target.files[0].text()):o=t,o.then(function(t){let o=JSON.parse(t);if(o.onBoarding){let e=Object.keys(o);e.forEach((t,n)=>{localStorage.setItem(t,o[e[n]])}),window.location.reload()}else console.log(o),z("Failed","The backup does not seem to be valid."),e.target.value=null})}),ei("download-wallpaper-btn","click",function(){let e=document.createElement("a"),t=function(e,t){let o=e.split(".");return o[o.length-1]="png",o.join(".")}(d,0);e.setAttribute("href","./assets/wallpapers-hi-res/"+t),e.setAttribute("download",t),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)}),ei("toggle-favicons-btn","click",function(e){let t=document.getElementsByClassName("custom_bookmark"),o=document.getElementsByClassName("custom_link_name");for(let e=0;e{!function(e){document.getElementById(e).classList.toggle("nested-close")}("deep-search-nested");let t=document.getElementById("deep-search-btn-arrow");t.classList.toggle("fa-angle-down"),t.classList.toggle("fa-angle-up")}),ei("update-customdomain-btn","click",F),ei("fetch-bookmarks-btn","click",ed),ei("reset-bookmarks-btn","click",el),ei("reset-all-btn","click",ea),ei("modal-close-btn","click",e3),ei("toggle-labs-btn","click",e2),ei("search-btn","click",function(){let e=es().value;if(""!=e){if(eP(e),E(e)&&!e.includes(" ")){window.open(e,"_self");return}if(eL(e))!function(e){let t=e.toLowerCase();t=(t=t.split("--").join("")).split(" ");let o=e.split("--").join("").split(" ");switch(t[0]){case"help":window.open("/pages/help/index.html","_self");break;case"reset":"bookmarks"==t[1]?el():"history"==t[1]?(localStorage.setItem("autocompleteDatabase",w),window.location.reload()):"all"==t[1]?ea():z("Error",q);break;case"fetch":"default"==t[1]?ed():z("Error",q);break;case"dl":t[1]?eS(null,o[1]):z("Failed","Enter a valid YT address");break;case"clock":window.open("./pages/clock","_self");break;case"count":window.open("./pages/countdown","_self");break;case"g":ex(f,e);break;case"b":ex(y,e);break;case"d":ex(b,e);break;default:z("Error",q)}}(e);else{let t;e=encodeURIComponent(e);let o=(null==(t=localStorage.getItem("default-search-url"))&&(localStorage.setItem("default-search-url",f),t=localStorage.getItem("default-search-url")),t+e);window.open(o,"_self")}}else ep.show(eC)}),ei("movies-search","click",function(){let e=es().value;if(""!=e){let t=h+(e=encodeURIComponent(e))+"/Movies/time/desc/1/";window.open(t)}else ep.show(eC)}),ei("tv-search","click",function(){let e=es().value;if(""!=e){let t=h+(e=encodeURIComponent(e))+"/TV/size/desc/1/";window.open(t)}else ep.show(eC)}),ei("games-search","click",function(){let e=es().value;if(""!=e){let t=h+(e=encodeURIComponent(e))+"/Games/time/desc/1/";window.open(t)}else ep.show(eC)}),ei("ebooks-search","click",function(){let e=es().value;if(""!=e){let t=h+(e=encodeURIComponent(e))+"/Other/seeders/desc/1/";window.open(t)}else ep.show(eC)}),ei("downloader-button","click",eS),ei("searchTerm","input",function(e){let t=sessionStorage.getItem("input"),o=e.target.value;if(sessionStorage.setItem("input",o),eM(o),!o){eO(),setTimeout(()=>{e_()},1);return}eF(o),o!=t&&eA(o)}),ei("searchTerm","click",()=>{let e=new InputEvent("input");es().dispatchEvent(e)}),ei("searchBarFocusMode","click",e_),ei("searchTerm","keypress",function(e){"Enter"==e.key&&document.querySelector("#search-btn").click()}),ei("fetch-bookmarks-btn","click",ed),ei("left-arrow","click",e=>{e.stopPropagation(),em("widget-slide",-1)}),ei("right-arrow","click",e=>{e.stopPropagation(),em("widget-slide",1)}),window.addEventListener("resize",()=>{P(),eY()}),window.addEventListener("blur",()=>{eU()}),window.addEventListener("appinstalled",e=>{console.log("installed")}),onload=e=>{document.getElementById("main-heading-slider").classList.remove("nowrap")},ei("settings_button","click",e=>{e1?e5("close",e):e1||e5("open",e)});const e4=()=>{let e;let t=document.body,o=()=>{clearInterval(e),e=null},n=t=>{["gradient_overlay","wrap","bookmarks","autofillContainer","flex-main-container-vertical","subtitle","footer"].includes(t.target.id)&&(e=setInterval(()=>{e1?e5("close"):e1||e5("open"),o()},e1?1:250))};return t.addEventListener("mousedown",n),t.addEventListener("mouseup",o),t.addEventListener("mouseout",o),t.addEventListener("touchstart",n),t.addEventListener("touchend",o),t.addEventListener("touchcancel",o),()=>{t.removeEventListener("mousedown",n),t.removeEventListener("mouseup",o),t.removeEventListener("mouseout",o),t.removeEventListener("touchstart",n),t.removeEventListener("touchend",o),t.removeEventListener("touchcancel",o),console.log("un-focus",e)}},e7=()=>{window.addEventListener("popstate",e=>{e1?e5("close"):e0?e3():e1||e0||(history.go(-1),console.log("cant go back anymore",-history.length-1))});let e=window.location.href;(e=e.split("/?")[1])?"settings"==e?e2():"backgrounds"==e&&e5("open"):history.pushState({loc:"home"},"","?home")},e8=()=>{let e;let t=document.getElementById("btn-install");P(),function(){if(null==L){L=[];return}for(let e of L)x(e.link,e.name,e.id)}(),function(){for(let e of Object.entries(JSON.parse(localStorage.getItem("advDropdownValues")))){let t=document.getElementById(e[0]);t&&(t.value=e[1])}}(),eQ.style.opacity=1,fetch(k+"wallpapers_list.json").then(e=>{e.text().then(e=>{Q=JSON.parse(e),d=localStorage.getItem("wallpaper"),u=Q.filter(e=>e.file==d)[0].color[1],K(d,u),function(){let e=document.getElementById("wallpapers");for(let t of Q){let o=t.file;o=o.split(".").join("-thumb.");let n=document.createElement("div");n.className="thumb-group",n.setAttribute("onclick","changeWallpaper(event)"),n.setAttribute("onkeypress","click_to_enter(event)"),n.setAttribute("tabindex","3");let l=document.createElement("div");l.innerHTML=t.title,l.className="thumb-title",n.appendChild(l);let a=document.createElement("img");a.src=k+o,a.className="thumbnail",a.title=t.title,a.setAttribute("draggable","false"),n.appendChild(a),e.appendChild(n)}}(),Z()})}).catch(e=>{console.log(e),window.open("./pages/error","_self")}),Z(),e4(),ec("clickable","keypress",er),ec("bookmark-container","click",e=>{let t=e.target.closest(".bookmark-container").querySelector("a");if(t.href){var o;window.open(t.href,"_self"),eU(),eV=o=t.querySelector(".loading"),o.classList.toggle("loader")}}),function(e,t,o){let n=document.getElementsByTagName(e);for(let e=0;e{e.prompt(),e.userChoice.then(t=>{"accepted"===t.outcome&&console.log("user accepted prompt"),e=null})}),window.addEventListener("beforeinstallprompt",o=>{o.preventDefault(),e=o,t.style.display="block"}),"1"==document.getElementById("searchbar").style.order&&window.scrollTo(0,document.body.scrollHeight),"on"==sessionStorage.getItem("focus")&&(document.getElementById("searchTerm").focus(),document.getElementById("searchTerm").click()),function(e){fetch("https://api.github.com/repos/lscambo13/casamia/commits/HEAD").then(t=>{t.json().then(t=>{let o=new Date(t.commit.committer.date).toISOString();o=(o=o.slice(0,o.length-5)).replaceAll("T","-").replaceAll(":","").replaceAll("-","."),document.getElementById(e).innerHTML=`Version ${o}`}).catch(e=>{console.error("getLastUpdated",e)})}).catch(e=>{console.error("getLastUpdated",e)})}("version-preview"),eY(),document.getElementById(localStorage.getItem("selected-widget-style")).scrollIntoView({behavior:"instant"}),setTimeout(()=>{!function(e){let t=document.getElementsByClassName(e),o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&localStorage.setItem("selected-widget-style",e.target.id)})},{rootMargin:"0px",threshold:.5});for(let e of t)o.observe(e)}("widget-slide")},500),e7()};document.addEventListener("DOMContentLoaded",()=>{ez(),"1"==localStorage.getItem("onBoarding")?(e8(),console.log("Already onboard.")):(console.log("Onboarding..."),(function(){let e=eq();return localStorage.setItem("onBoarding","0"),localStorage.setItem("advDropdownValues",JSON.stringify(v)),localStorage.setItem("wallpaper","085.webp"),localStorage.setItem("autocompleteDatabase",w),localStorage.setItem("selected-widget-style","widget-1"),e})().then(()=>{window.matchMedia("(hover: none)").matches&&setTimeout(()=>{z("Information","Press and hold on empty area to open settings.")},5e3),e8(),console.log("Onboarding complete.")}))},{once:!0}); +//# sourceMappingURL=index.9977f672.js.map diff --git a/dist/index.html b/dist/index.html index d76363c..54accd9 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1 +1 @@ -Search • Casa Mia

Welcome

Welcome

Welcome

Welcome

Welcome

Welcome

Welcome

Please wait

Download
Add Bookmark
Settings


\ No newline at end of file +Search • Casa Mia

Welcome

Welcome

Welcome

Welcome

Welcome

Welcome

Welcome

Please wait

Download
Add Bookmark
Settings


\ No newline at end of file