summaryrefslogtreecommitdiff
path: root/webcards/scripts/cookie.js
diff options
context:
space:
mode:
Diffstat (limited to 'webcards/scripts/cookie.js')
-rw-r--r--webcards/scripts/cookie.js36
1 files changed, 0 insertions, 36 deletions
diff --git a/webcards/scripts/cookie.js b/webcards/scripts/cookie.js
deleted file mode 100644
index d614af7..0000000
--- a/webcards/scripts/cookie.js
+++ /dev/null
@@ -1,36 +0,0 @@
-'use strict';
-
-class Cookies {
- static getCookie(name){
- let cookies = document.cookie.split(";");
- for(let i in cookies) {
- let cname = cookies[i].trim().split("=")[0];
- if(cname == name){
- return cookies[i].trim().slice(name.length + 1);
- }
- }
- return "";
- }
-
- static setCookie(name, value, data = {}) {
- let extra = "";
-
- for(let key in data)
- {
- extra += "; " + key + "=" + data[key];
- }
-
- document.cookie = name + "=" + value + extra;
- }
-
- static setYearCookie(name, value) {
- var date = new Date(Date.now());
- date.setFullYear(date.getFullYear() + 1);
- Cookies.setCookie(name, value, {expires: date.toUTCString()});
- }
-
- static removeCookie(name) {
- var date = new Date(0);
- Cookies.setCookie(name, "", {expires: date.toUTCString()});
- }
-}