whisper.cat/weboasis/js/script.min.js

2 lines
93 KiB
JavaScript
Raw Normal View History

2023-10-05 23:28:32 +11:00
let globalResetBackground,linkMenu,userSettings,monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames=["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"],CookiePrefix="weboasis_",cmdPrefix="!",ssi=0,color="#aaeb8d",canvasBg="matrix",searchSources=[["g","https://www.google.com/search?q={Q}"," Google"],["d","https://duckduckgo.com/?q={Q}"," DuckDuckGo"],["b","https://search.brave.com/search?q={Q}"," Brave"],["y","https://yandex.com/search/?text={Q}"," Yandex"],["s","https://www.startpage.com/do/search?query={Q}"," StartPage"],["p","https://engine.presearch.org/search?q={Q}"," Presearch"],["x","https://anon.sx/?q={Q}"," SearX"],["m","https://www.mojeek.com/search?q={Q}"," Mojeek"],["e","https://metager.org/meta/meta.ger3?eingabe={Q}"," Metager"],["q","https://www.qwant.com/?q={Q}&t=web","Qwant"],["w","https://www.wolframalpha.com/input/?i={Q}"," Wolfram"],["f","https://boardreader.com/s/{Q}.html"," Forums"],["u","https://piped.kavin.rocks/results?search_query={Q}"," YouTube"],["t","https://bitsearch.to/search?q={Q}"," Torrents"],["a","https://alternativeto.net/browse/search?q={Q}"," Alternative"],["o","https://ahmia.fi/search/?q={Q}"," Onion/TOR"]],lockNav=!1,svgReddit="<svg style=\"width:24px;height:24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M24 11.779c0-1.459-1.192-2.645-2.657-2.645-.715 0-1.363.286-1.84.746-1.81-1.191-4.259-1.949-6.971-2.046l1.483-4.669 4.016.941-.006.058c0 1.193.975 2.163 2.174 2.163 1.198 0 2.172-.97 2.172-2.163s-.975-2.164-2.172-2.164c-.92 0-1.704.574-2.021 1.379l-4.329-1.015c-.189-.046-.381.063-.44.249l-1.654 5.207c-2.838.034-5.409.798-7.3 2.025-.474-.438-1.103-.712-1.799-.712-1.465 0-2.656 1.187-2.656 2.646 0 .97.533 1.811 1.317 2.271-.052.282-.086.567-.086.857 0 3.911 4.808 7.093 10.719 7.093s10.72-3.182 10.72-7.093c0-.274-.029-.544-.075-.81.832-.447 1.405-1.312 1.405-2.318zm-17.224 1.816c0-.868.71-1.575 1.582-1.575.872 0 1.581.707 1.581 1.575s-.709 1.574-1.581 1.574-1.582-.706-1.582-1.574zm9.061 4.669c-.797.793-2.048 1.179-3.824 1.179l-.013-.003-.013.003c-1.777 0-3.028-.386-3.824-1.179-.145-.144-.145-.379 0-.523.145-.145.381-.145.526 0 .65.647 1.729.961 3.298.961l.013.003.013-.003c1.569 0 2.648-.315 3.298-.962.145-.145.381-.144.526 0 .145.145.145.379 0 .524zm-.189-3.095c-.872 0-1.581-.706-1.581-1.574 0-.868.709-1.575 1.581-1.575s1.581.707 1.581 1.575-.709 1.574-1.581 1.574z\"/></svg>",svgCode="<svg style=\"width:24px;height:24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M24 10.935v2.131l-8 3.947v-2.23l5.64-2.783-5.64-2.79v-2.223l8 3.948zm-16 3.848l-5.64-2.783 5.64-2.79v-2.223l-8 3.948v2.131l8 3.947v-2.23zm7.047-10.783h-2.078l-4.011 16h2.073l4.016-16z\" /></svg>",svgNews="<svg style=\"width:24px;height:24px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M21 9.662c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0 2.031c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0 2.031c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0 2.031c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0-9.951c-2.402.204-5.068 1.024-7 1.745v1.933c1.804-.756 4.713-1.6 7-1.794v-1.884zm-18 2.843c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0 2.031c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0 2.031c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0 2.032c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0-7.054c2.287.194 5.196 1.038 7 1.794v-1.933c-1.932-.72-4.598-1.54-7-1.744v1.883zm9-2.724c-3.063-1.671-7.776-2.755-12-2.963v17c4.289.206 8.195 1.249 12 3 3.805-1.751 7.711-2.794 12-3v-17c-4.224.208-8.937 1.292-12 2.963zm-10-.791c4.264.496 6.86 1.467 9 2.545v12.702c-2.968-1.184-5.939-1.95-9-2.271v-12.976zm20 12.975c-3.061.321-6.032 1.088-9 2.271v-12.701c2.187-1.103 4.757-2.051 9-2.544v12.974z\" /></svg>",svgM
${r==t?"class=\"selected\"":""} >`+"!"+searchSources[t][0]+"</span>"+searchSources[t][2],s.classList.add("searchSources"),s.classList.add("list-item-animation"),s.classList.add("transition"),s.id=t,e.appendChild(s)}rootSearchHelp.appendChild(e);var o=document.querySelectorAll(".searchSources");Array.from(o).forEach(function(t){t.addEventListener("click",function(t){var e=t.target.id;ssi=e,searchInput.placeholder=t.target.textContent.substring(2),SetCookie("engine",e,31536000000),buildHelp()})})}}function buildHelp2(){rootSearchLinkHelp.innerHTML="";for(let e=0;10>e&e<allLinkSources.length;e++){var t=document.createElement("div");t.innerHTML=`<span><a target="_blank" href=${allLinkSources[e][1]}>${allLinkSources[e][0]}</a></span>`,t.classList.add("searchSources"),t.classList.add("list-item-animation"),t.classList.add("transition"),rootSearchLinkHelp.append(t)}}function handleSearchBarFocus(){addClass("mainContainer","input-active");let t=document.querySelectorAll(".searchSources"),e=t[t.length-1],s=parseInt(1e3*parseFloat(e.style.transitionDelay.replace("s","")));setTimeout(()=>{t=document.querySelectorAll("#generatedList .searchSources"),t.forEach(t=>{t.classList.add("no-delay")})},s),closeCustomLinksNav&&closeCustomLinksNav()}function handleSearchLinksFocus(){document.getElementById("mainContainer").style.display="none",addClass("mainContainer2","input-active");let t=document.querySelectorAll("#mainContainer2>#searchLinkHelp>#searchLinkMenu>.searchSources"),e=t[t.length-1],s=parseInt(1e3*parseFloat(e.style.transitionDelay.replace("s","")));setTimeout(()=>{t=document.querySelectorAll("#mainContainer2.input-active>#searchLinkHelp>#searchLinkMenu>p"),t.forEach(t=>{t.classList.add("no-delay")})},s),closeCustomLinksNav&&closeCustomLinksNav()}function handleSearchBarBlur(){removeClass("mainContainer","input-active");let t=document.querySelectorAll("#mainContainer>#searchHelp>#searchHelpMenu>li");t.forEach(t=>{t.classList.contains("no-delay")&&t.classList.remove("no-delay"),t.classList.remove("transition"),document.getElementById(t.id).offsetWidth=document.getElementById(t.id).offsetWidth,t.classList.add("transition")})}function handleSearchLinksBlur(){document.getElementById("mainContainer").style.display="block",removeClass("mainContainer2","input-active");let t=document.querySelectorAll("#mainContainer2>#searchHelp>#searchHelpMenu>li");t.forEach(t=>{t.classList.contains("no-delay")&&t.classList.remove("no-delay"),t.classList.remove("transition"),document.getElementById(t.id).offsetWidth=document.getElementById(t.id).offsetWidth,t.classList.add("transition")})}function calculateDelaySeconds(t){return Number.parseFloat(t*.05+.2).toFixed(2)}function buildMenu(){localStorage.getItem("menu-items")?(linkMenu=JSON.parse(localStorage.getItem("menu-items")),console.log("Loaded menu items from localStorage")):(linkMenu=defaultLinkMenu,localStorage.setItem("menu-items",JSON.stringify(defaultLinkMenu)),console.log("Menu items not set in localStorage. Loaded default and set."));let t="";for(let e=0,s=linkMenuOrder.length;e<s;e++){let s=linkMenuOrder[e],o=linkMenu[s];for(let e=0,i=o.length;e<i;e++)"-HEAD-"===o[e][2]?(t+="<li class=\"button-container expanding-down\"><div class=\"button accent-"+(""===o[e][1]?"white":o[e][1].toLowerCase())+"\"><label class=\"button-content\">"+o[e][0]+"</label><div class=\"button-expanded-content\" style=\"box-sizing: border-box;\">",t+="<ul id=\""+s+"MenuContainer\" class=\"menu-link container\">"):""===o[e][2]?t+="<li class='menu-link-item' data-index=\""+e+"\"><div class=\"remove-menu-item\">x</div> <div class=\"drag-handle\"> :: </div><a class=\"tooltip\"href=\""+o[e][1]+"\" target=\"_blank\"><label class=\"text12\">"+o[e][0]+"</label><span class=\"tooltipwrap\"><span class=\"tooltiptexthidden\">"+o[e][2]+"</span></span></a></li>":t+="<li class='menu-link-item' data-index=\""+e+"\"><div class=\"remove-menu-item\">x</div> <div class=\"drag-handle\"> :: </div><a class=\"tooltip\"href=\""+o[e][1]+"\" target=\"_blank\"><label class=\"text12\">"+o[e][0]+"</label><span class=\"tooltipwrap