User:Seddon/SeddonDarkMode.js

if (localStorage.DarkMode === 'True') { $("body").addClass('darkmode'); }

$( document ).ready(function  {    if (localStorage.getItem("DarkMode") === null) {        localStorage.setItem('DarkMode', 'False');    }    var userlistid = document.getElementById('pt-userpage');            if (localStorage.DarkMode === 'True') {            userlistid.insertAdjacentHTML('beforebegin','Dark Mode  ');    } else {          userlistid.insertAdjacentHTML('beforebegin','Dark Mode   ');    }    $('#darkmodeswitch').click( function { if (localStorage.getItem('DarkMode') === 'False') { localStorage.setItem('DarkMode', 'True'); $("body").addClass('darkmode'); } else { localStorage.setItem('DarkMode', 'False'); $("body").removeClass('darkmode');} });   $('.darkmodeslider').click( function { if (localStorage.getItem('DarkMode') === 'False') { localStorage.setItem('DarkMode', 'True'); } else { localStorage.setItem('DarkMode', 'False'); $("body").removeClass('darkmode'); }   }); });