parent
666a4f9244
commit
4cef9c30fd
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "doomsday",
|
||||
"version": "1.3.6",
|
||||
"version": "1.3.7",
|
||||
"description": "Test your mastery of Conway's Doomsday rule.",
|
||||
"author": "Felix W. Dekker",
|
||||
"browser": "dist/bundle.js",
|
||||
|
@ -16,11 +16,9 @@
|
|||
"deploy": "grunt deploy"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fwdekker/template": "^0.0.18",
|
||||
"js-cookie": "^2.2.1"
|
||||
"@fwdekker/template": "^0.0.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-cookie": "^2.2.6",
|
||||
"grunt": "^1.2.1",
|
||||
"grunt-cli": "^1.3.2",
|
||||
"grunt-contrib-clean": "^2.0.0",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {$, doAfterLoad, footer, header, nav} from "@fwdekker/template";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -152,7 +151,7 @@ class ValidatableInput {
|
|||
}
|
||||
|
||||
/**
|
||||
* A wrapper around a `<details>` element that persists the state in a cookie.
|
||||
* A wrapper around a `<details>` element that persists the state in local storage.
|
||||
*/
|
||||
class ToggleableSection {
|
||||
/**
|
||||
|
@ -204,8 +203,7 @@ class ToggleableSection {
|
|||
* @private
|
||||
*/
|
||||
_storeToggle() {
|
||||
Cookies.set(`toggle-${this._name}`, "" + this.isOpened(),
|
||||
{expires: 365 * 10, secure: true, sameSite: "lax", path: ""});
|
||||
localStorage.setItem(`/tools/doomsday//toggle-${this._name}`, "" + this.isOpened());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,7 +212,7 @@ class ToggleableSection {
|
|||
* @private
|
||||
*/
|
||||
_loadToggle() {
|
||||
const target = Cookies.get(`toggle-${this._name}`);
|
||||
const target = localStorage.getItem(`/tools/doomsday//toggle-${this._name}`);
|
||||
if (target === undefined) {
|
||||
this._storeToggle();
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue