MediaWiki:Timeless.js: Difference between revisions

From Ephinea PSO Wiki
(Created page with "→‎All JavaScript here will be loaded for users of the Timeless skin: function toggleDarkMode() { const darkMode = localStorage.getItem("darkMode"); if (darkMode !== "tru...")
 
No edit summary
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the Timeless skin */
/* All JavaScript here will be loaded for users of the Timeless skin */
$("#personal-inner").append('<button onClick="toggleDarkMode();" style="margin:.5rem!important;">Toggle Dark Mode</button>');
});


function toggleDarkMode() {
function toggleDarkMode() {

Revision as of 05:36, 17 November 2021

/* All JavaScript here will be loaded for users of the Timeless skin */

$("#personal-inner").append('<button onClick="toggleDarkMode();" style="margin:.5rem!important;">Toggle Dark Mode</button>');
});

function toggleDarkMode() {
	const darkMode = localStorage.getItem("darkMode");
	if (darkMode !== "true") {
	    localStorage.setItem("darkMode", true);
		document.body.classList.add("darkMode");
	} else {
	    localStorage.setItem("darkMode", false);
		document.body.classList.remove("darkMode");
	}
}