about summary refs log tree commit diff stats
path: root/dist/cookie.js
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-03-29 09:54:51 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-03-29 09:54:51 +0300
commit7d1f357a5e263567707b8f018da17f74c44c6d50 (patch)
treefaefd91113c180f3591002a8fdf291dbfdf6e692 /dist/cookie.js
parentd2ea17abf815b6cd754511e27f4853045e0b3ca2 (diff)
downloadthe-epube-ts.tar.gz
the-epube-ts.tar.xz
horrors of ts ts
Diffstat (limited to 'dist/cookie.js')
-rw-r--r--dist/cookie.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/dist/cookie.js b/dist/cookie.js
new file mode 100644
index 0000000..fb01989
--- /dev/null
+++ b/dist/cookie.js
@@ -0,0 +1,28 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Cookie = void 0;
+class Cookie {
+    static set(name, value, lifetime) {
+        const d = new Date();
+        d.setTime(d.getTime() + lifetime * 1000);
+        const expires = "expires=" + d.toUTCString();
+        document.cookie = name + "=" + encodeURIComponent(value) + "; " + expires;
+    }
+    static get(name) {
+        name = name + "=";
+        const ca = document.cookie.split(';');
+        for (let i = 0; i < ca.length; i++) {
+            let c = ca[i];
+            while (c.charAt(0) == ' ')
+                c = c.substring(1);
+            if (c.indexOf(name) == 0)
+                return decodeURIComponent(c.substring(name.length, c.length));
+        }
+        return "";
+    }
+    static delete(name) {
+        const expires = "expires=Thu, 01-Jan-1970 00:00:01 GMT";
+        document.cookie = name + "=; " + expires;
+    }
+}
+exports.Cookie = Cookie;