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