Compare commits

...

5 Commits

Author SHA1 Message Date
Matt Walsh
e87290ed5e 5.11.2 2024-04-19 21:10:52 -05:00
Matt Walsh
f4f3720793 fix stickiness for settings checkboxes close #39 2024-04-19 21:10:43 -05:00
Matt Walsh
535b1072d8 5.11.1 2024-04-19 21:06:01 -05:00
Matt Walsh
6d4ec8b958 parse settings from querystring 2024-04-19 21:05:52 -05:00
Matt Walsh
5d0f41f207 capture dist 2024-04-12 16:20:38 -05:00
8 changed files with 23 additions and 8 deletions

View File

@@ -18,4 +18,8 @@
"**/compiled.css": true,
"**/*.min.js": true,
},
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}

2
dist/index.html vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "ws4kp",
"version": "5.11.0",
"version": "5.11.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ws4kp",
"version": "5.11.0",
"version": "5.11.2",
"license": "MIT",
"devDependencies": {
"del": "^6.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "ws4kp",
"version": "5.11.0",
"version": "5.11.2",
"description": "Welcome to the WeatherStar 4000+ project page!",
"main": "index.js",
"scripts": {

View File

@@ -1,3 +1,5 @@
import { parseQueryString } from '../share.mjs';
const SETTINGS_KEY = 'Settings';
class Setting {
@@ -8,11 +10,19 @@ class Setting {
this.defaultValue = defaultValue;
this.myValue = defaultValue;
this.type = type;
this.sticky = sticky;
// 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;
}

View File

@@ -53,6 +53,7 @@
},
"files.exclude": {},
"files.eol": "\n",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}