MCPcopy Create free account
hub / github.com/0dayCTF/reverse-shell-generator / initTheme

Function initTheme

js/light-mode-switch.js:22–31  ·  view source on GitHub ↗

* Summary: function that adds or removes the attribute 'data-theme' depending if * the switch is 'on' or 'off'. * * Description: initTheme is a function that uses localStorage from JavaScript DOM, * to store the value of the HTML switch. If the switch was already switched to * 'on' it will set

()

Source from the content-addressed store, hash-verified

20 * @return {void}
21 */
22function initTheme() {
23 var currentTheme = localStorage.getItem("currentTheme");
24
25 if (currentTheme == null) {
26 document.body.removeAttribute("data-theme")
27 } else {
28 document.body.setAttribute("data-theme", currentTheme)
29 $("#theme-selector").val(currentTheme).change();
30 }
31}
32
33/**
34 * Summary: resetTheme checks if the switch is 'on' or 'off' and if it is toggled

Callers 1

Calls 1

$Function · 0.85

Tested by

no test coverage detected