var accessibleToggle = document.getElementById('accessibleToggle'); let currentAccessibilityState = localStorage.getItem('accessible'); var documentBackground = document.body.style.backgroundColor; function yesAccessible() { accessibleToggle.innerHTML = "Regular View"; document.location.hash = "force:no"; document.body.style.background = "white"; localStorage.setItem('accessible', 'true'); } function noAccessible() { accessibleToggle.innerHTML = "Accessible Mode"; document.body.style.background = documentBackground; localStorage.setItem('accessible', 'false'); } accessibleToggle.addEventListener('click', function () { document.body.classList.toggle('accessible'); if (document.body.classList.contains('accessible')) { yesAccessible(); } else { noAccessible(); } }); if(currentAccessibilityState === 'true') { document.body.classList.add('accessible'); yesAccessible(); }