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