-
Notifications
You must be signed in to change notification settings - Fork 0
/
tab.min.js
1 lines (1 loc) · 2.41 KB
/
tab.min.js
1
async function getRoute(url){var markos;return await fetch(url+".html").then((function(response){return response.text()})).then((function(html){return html})).catch((function(err){console.warn("Something went wrong.",err)}))}async function openRoute(Page,elmnt){for(tablinks=document.getElementsByClassName("tablink"),i=0;i<tablinks.length;i++)tablinks[i].style.backgroundColor="",tablinks[i].style.color="rgb(255 255 255 / 79%)";elmnt.style.backgroundColor="#5656f6a3",elmnt.style.color="rgb(255 255 255/200%)",elmnt.style.borderRadius="4px",document.documentElement.clientWidth<750&&(document.getElementById("mySidenav").style.opacity="0",document.getElementById("mySidenav").style.width="0");var pageContent=await getRoute(Page);document.getElementById("view").innerHTML=pageContent}function tabhide(tj){tj.style.display="none"}function tabShow(jj){document.getElementById(jj).style.opacity="100%"}function hide(pg){elmt.style.opacity="0%"}function openNav(){document.getElementById("mySidenav").style.width="70vw",document.getElementById("mySidenav").style.opacity="1"}function closeNav(){console.warn("nav closed"),document.getElementById("mySidenav").style.opacity="0",document.getElementById("mySidenav").style.width="0"}function resetbody(){document.body.style.opacity="100%"}async function checkSize(){document.documentElement.clientWidth>900?(document.body.style.opacity="0%",document.getElementById("mySidenav").style.width="22vw",document.getElementById("mySidenav").style.opacity="1",await setTimeout(resetbody,400)):document.documentElement.clientWidth<920&&(document.getElementById("mySidenav").style.width="0",document.getElementById("mySidenav").style.opacity="0")}function registerService(){"serviceWorker"in navigator&&navigator.serviceWorker.register("serviceworker.js")}function updateOnlineStatus(){document.getElementById("offlineA").style.display="none",navigator.onLine||(document.getElementById("offlineA").style.display="flex")}document.getElementById("defaultOpen").click(),addEventListener("resize",checkSize),onload=event=>{registerService(),navigator.onLine||(document.getElementById("offlineA").style.display="flex"),checkSize()},window.addEventListener("online",updateOnlineStatus),window.addEventListener("offline",updateOnlineStatus),window.addEventListener("DOMContentLoaded",()=>{let displayMode="browser tab";window.matchMedia("(display-mode: standalone)").matches&&(document.getElementById("installMobile").style.display="none")});