mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 03:59:21 +03:00
Don't use webpack on boot.js
This commit is contained in:
parent
b837013cfb
commit
fcaa2fd6de
11 changed files with 167 additions and 388 deletions
|
|
@ -30,33 +30,4 @@ w.ResizeObserver || (w.ResizeObserver = class {
|
|||
}
|
||||
});
|
||||
|
||||
const Storage = type => {
|
||||
let name = type+'Storage';
|
||||
try {
|
||||
w[name].setItem('storage', '');
|
||||
w[name].getItem('storage');
|
||||
w[name].removeItem('storage');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
const cookieName = encodeURIComponent(name+('session' === type ? w.name || (w.name = Date.now()) : ''));
|
||||
|
||||
// initialise if there's already data
|
||||
let data = document.cookie.match('(^|;) ?'+cookieName+'=([^;]*)(;|$)');
|
||||
data = data ? decodeURIComponent(data[2]) : null;
|
||||
data = data ? JSON.parse(data) : {};
|
||||
|
||||
w[name] = {
|
||||
getItem: key => data[key] === undefined ? null : data[key],
|
||||
setItem: function (key, value) {
|
||||
data[key] = ''+value; // forces the value to a string
|
||||
document.cookie = cookieName+'='+encodeURIComponent(JSON.stringify(data))
|
||||
+"; expires="+('local' === type ? (new Date(Date.now()+(365*24*60*60*1000))).toGMTString() : '')
|
||||
+"; path=/; samesite=strict";
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
Storage('local');
|
||||
Storage('session');
|
||||
|
||||
})(window);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue