first commit! 🎉
Signed-off-by: ari melody <ari@arimelody.me>
This commit is contained in:
commit
27d6e4f011
97 changed files with 2957 additions and 0 deletions
44
public/script/accessibility.js
Normal file
44
public/script/accessibility.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
const accessibility = JSON.parse(localStorage.getItem("accessibility")) || {};
|
||||
|
||||
function toggle_accessibility_setting(name) {
|
||||
if (accessibility[name]) {
|
||||
delete accessibility[name];
|
||||
update_accessibility();
|
||||
return true;
|
||||
}
|
||||
accessibility[name] = true;
|
||||
update_accessibility();
|
||||
return true;
|
||||
}
|
||||
|
||||
function set_accessibility_setting(name, value) {
|
||||
accessibility[name] = value;
|
||||
update_accessibility();
|
||||
return true;
|
||||
}
|
||||
|
||||
function clear_accessibility_setting(name) {
|
||||
if (!accessibility[name]) return false;
|
||||
delete accessibility[name];
|
||||
update_accessibility();
|
||||
return true;
|
||||
}
|
||||
|
||||
function update_accessibility() {
|
||||
localStorage.setItem("accessibility", JSON.stringify(accessibility));
|
||||
}
|
||||
|
||||
if (accessibility) {
|
||||
if (accessibility.disable_crt) {
|
||||
document.querySelector('div#overlay').setAttribute("hidden", true);
|
||||
document.body.style.textShadow = "none";
|
||||
document.getElementById('toggle-crt').classList.add("disabled");
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("toggle-crt").addEventListener("click", () => {
|
||||
toggle_accessibility_setting("disable_crt");
|
||||
document.querySelector('div#overlay').toggleAttribute("hidden");
|
||||
document.getElementById('toggle-crt').className = accessibility.disable_crt ? "disabled" : "";
|
||||
});
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue