MCPcopy Index your code
hub / github.com/openspeedtest/Speed-Test / createCookie

Function createCookie

assets/js/darkmode.js:5–5  ·  view source on GitHub ↗
(a,c,b)

Source from the content-addressed store, hash-verified

3window.matchMedia("(prefers-color-scheme: dark)").matches&&""===getCookieValue("mode")&&setSkin("dark")}
4function setSkin(a){"dark"===a&&(dayModeMob.style.display="none",nightModeMob.style.display="inline-block",dayMode.style.display="none",nightMode.style.display="inline-block",darkStyle=document.getElementById("darkmode"),null==darkStyle&&(document.head.innerHTML+='<link id="darkmode" rel="stylesheet" href="assets/css/darkmode.css" type="text/css"/>',createCookie("mode","dark")));"light"===a&&(nightModeMob.style.display="none",dayModeMob.style.display="inline-block",nightMode.style.display="none",
5dayMode.style.display="inline-block",(darkStyle=document.getElementById("darkmode"))&&darkStyle.parentNode.removeChild(darkStyle),createCookie("mode","light"))}function toggleSkin(){(darkStyle=document.getElementById("darkmode"))?setSkin("light"):setSkin("dark")}function createCookie(a,c,b){if(b){var d=new Date;d.setTime(d.getTime()+864E5*b);b="; expires="+d.toGMTString()}else b="";document.cookie=a+"="+c+b+"; path=/"}
6function getCookieValue(a,c){return(c=document.cookie.match("(^|;)\\s*"+a+"\\s*=\\s*([^;]+)"))?c.pop():""};

Callers 1

setSkinFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected