Soft'N'Design Software
/
projects
/
trivabble.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3384a8c
)
only store values that differ from defaults
author
Laurent Mazet
<mazet@softndesign.org>
Tue, 20 Apr 2021 12:13:58 +0000
(14:13 +0200)
committer
Laurent Mazet
<mazet@softndesign.org>
Tue, 20 Apr 2021 12:13:58 +0000
(14:13 +0200)
public/trivabble.js
patch
|
blob
|
blame
|
history
diff --git
a/public/trivabble.js
b/public/trivabble.js
index 2057c09b5bff587daa06de4a4d5e715f92a15a25..65b8580f35deae523a0376b64f3fc108fa699f46 100644
(file)
--- a/
public/trivabble.js
+++ b/
public/trivabble.js
@@
-138,7
+138,13
@@
(type === "number") ||
(type === "object") ||
(type === "string")) {
- localStorage.setItem("trivabble" + key, value);
+ if (Object.prototype.hasOwnProperty.call(Conf, key) && (Conf[key] === value)) {
+ if (Object.prototype.hasOwnProperty.call(localStorage, "trivabble" + key)) {
+ delete localStorage["trivabble" + key];
+ }
+ } else {
+ localStorage.setItem("trivabble" + key, value);
+ }
} else {
console.error("Unsupported type");
}