Fix checkbox syncing and disrupt on reset

This commit is contained in:
somebody
2022-12-10 10:53:42 -06:00
parent 68217a766b
commit 72c9ff6763

View File

@@ -251,6 +251,7 @@ function disruptStoryState() {
function reset_story() { function reset_story() {
//console.log("Resetting story"); //console.log("Resetting story");
disruptStoryState();
clearTimeout(calc_token_usage_timeout); clearTimeout(calc_token_usage_timeout);
clearTimeout(game_text_scroll_timeout); clearTimeout(game_text_scroll_timeout);
clearTimeout(font_size_cookie_timout); clearTimeout(font_size_cookie_timout);
@@ -6834,6 +6835,7 @@ function imgGenRetry() {
class: "story", class: "story",
name: "commentary_enabled", name: "commentary_enabled",
func: function(commentaryEnabled) { func: function(commentaryEnabled) {
this.checked = commentaryEnabled;
if (commentaryEnabled) { if (commentaryEnabled) {
settingsContainer.classList.remove("disabled"); settingsContainer.classList.remove("disabled");
} else { } else {
@@ -6860,11 +6862,17 @@ for (const el of document.querySelectorAll("[sync-var]")) {
sync_to_server(this); sync_to_server(this);
}); });
const proxy = $el(`[sync-proxy-host="${varName}"]`); const proxy = $el(`[sync-proxy-host="${varName}"]`);
if (proxy) { if (proxy) {
el.addEventListener("input", function() { el.addEventListener("input", function() {
proxy.value = this.value; proxy.value = this.value;
}); });
el.addEventListener("sync", function() {
proxy.value = this.value;
});
} }
let slug = varName.replaceAll(".", "_"); let slug = varName.replaceAll(".", "_");