diff --git a/.vscode/settings.json b/.vscode/settings.json index 88e7166..b33c711 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,4 +18,8 @@ "**/compiled.css": true, "**/*.min.js": true, }, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + } } \ No newline at end of file diff --git a/server/scripts/modules/utils/setting.mjs b/server/scripts/modules/utils/setting.mjs index 8dcea7b..bdfc0c2 100644 --- a/server/scripts/modules/utils/setting.mjs +++ b/server/scripts/modules/utils/setting.mjs @@ -1,3 +1,5 @@ +import { parseQueryString } from '../share.mjs'; + const SETTINGS_KEY = 'Settings'; class Setting { @@ -9,10 +11,17 @@ class Setting { this.myValue = defaultValue; this.type = type; // a default blank change function is provided - this.changeAction = changeAction ?? (() => {}); + this.changeAction = changeAction ?? (() => { }); + + // get value from url + const urlValue = parseQueryString()?.[`settings-${shortName}-checkbox`]; + let urlState; + if (urlValue !== undefined) { + urlState = urlValue === 'true'; + } // get existing value if present - const storedValue = this.getFromLocalStorage(); + const storedValue = urlState ?? this.getFromLocalStorage(); if (sticky && storedValue !== null) { this.myValue = storedValue; } diff --git a/ws4kp.code-workspace b/ws4kp.code-workspace index fdd0ba7..aed277c 100644 --- a/ws4kp.code-workspace +++ b/ws4kp.code-workspace @@ -53,6 +53,7 @@ }, "files.exclude": {}, "files.eol": "\n", + "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }