-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.min.js
More file actions
1 lines (1 loc) · 1.53 KB
/
script.min.js
File metadata and controls
1 lines (1 loc) · 1.53 KB
1
function show(e){for(let e=0;e<pages.length;e++)document.getElementById(pages[e]).style.display="none";document.getElementById(e).style.display="block"}function showpage(e){e?(show(e),window.history.replaceState(null,null,"?page="+e)):urlParams.get("page")?show(urlParams.get("page")):show("home")}function switchtheme(){const e=rootStyle.getPropertyValue("--theme");if("dark"==e)for(var t of(setProp("theme","light"),document.cookie="theme=light; expires=2147483647;",setProp("background-1","#f7fff7"),setProp("background-2","#fffaf3"),setProp("foreground","#575279"),setProp("button","#eb6f92"),setProp("secondary","#eb6f92"),document.getElementsByClassName("svg")))t.setAttribute("fill","#1c1a1e");else if("light"==e)for(var t of(setProp("theme","dark"),document.cookie="theme=dark; expires=2147483647;",setProp("background-1","#191724"),setProp("background-2","#1f1d2e"),setProp("foreground","#e0def4"),setProp("button","#31748f"),setProp("secondary","#eb6f92"),document.getElementsByClassName("svg")))t.setAttribute("fill","#e0def4")}function setProp(e,t){root.style.setProperty("--"+e,t)}function getCookie(e){const t=`; ${document.cookie}`,o=t.split(`; ${e}=`);if(2===o.length)return o.pop().split(";").shift()}let root=document.documentElement,rootStyle=getComputedStyle(root);const urlParams=new URLSearchParams(window.location.search),pages=["home","socials","aboutme","stuffimade"];window.onload=function(){"light"==getCookie("theme")&&switchtheme(),document.getElementById("age").innerHTML=((Date.now()-11808792e5)/1e3/60/60/24/365.25).toFixed(4),showpage()};