diff options
Diffstat (limited to 'settings.js')
-rw-r--r-- | settings.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/settings.js b/settings.js index a82281d..84a078c 100644 --- a/settings.js +++ b/settings.js @@ -1,3 +1,5 @@ +const mod_message_default = "Mod Note: Retimed (Start Frame: ${SF}, End Frame: ${EF}, FPS: ${FPS}, Total Time: ${TT})"; + /* Set all the settings any time someone loads a page */ function set_settings() { @@ -10,8 +12,12 @@ function set_settings() function settings_init() { document.getElementById("page_theme").checked = (localStorage.getItem("theme") === "dark"); - document.getElementById("page_titles").checked = (localStorage.getItem("remove_titles") === "true"); - document.getElementById("page_text").checked = (localStorage.getItem("remove_text") === "true"); + document.getElementById("page_titles").checked = (localStorage.getItem("remove_titles") + === "true"); + document.getElementById("page_text").checked = (localStorage.getItem("remove_text") + === "true"); + const mod_message = localStorage.getItem("custom_mod_message"); + document.getElementById("custom_mod_message").value = mod_message ? mod_message : mod_message_default; } /* Change the users preferred theme. */ @@ -72,6 +78,17 @@ function remove_text() localStorage.setItem("remove_text", checked.toString()); } +/* Set a custom mod message */ +function set_mod_message(event) +{ + if (event.target.value.replace(/\s/g, "")) + localStorage.setItem("custom_mod_message", event.target.value); + else { + event.target.value = mod_message_default; + localStorage.setItem("custom_mod_message", mod_message_default); + } +} + /* Conform to the users preferences */ if (window.location.href.endsWith("settings.html")) settings_init(); |