Switch client information from cookies to session storage

Dieser Commit ist enthalten in:
Michael Kuron 2021-05-06 22:45:28 +02:00 committet von GitHub
Ursprung 134ab856d6
Commit 04cfc3dc2a
Es konnte kein GPG-SchlĂĽssel zu dieser Signatur gefunden werden
GPG-SchlĂĽssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -1,7 +1,7 @@
if (window.location.href.indexOf('/client/') >= 0) { if (window.location.href.indexOf('/client/') >= 0) {
window.window.addEventListener('load', function () { window.window.addEventListener('load', function () {
function setCookie(name, value) { function setCookie(name, value) {
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + "; path=/"; sessionStorage.setItem(name, value);
} }
function getParameterByName(name) { function getParameterByName(name) {
@ -39,18 +39,7 @@ if (window.location.href.indexOf('/client/') >= 0) {
if (window.location.href.indexOf('/client') >= 0) { if (window.location.href.indexOf('/client') >= 0) {
window.window.addEventListener('load', function () { window.window.addEventListener('load', function () {
function getCookie(cn) { function getCookie(cn) {
var fixedcn = encodeURIComponent(cn); return sessionStorage.getItem(cn);
var cs = document.cookie.split(';');
for (var i = 0; i < cs.length; i++) {
var c = cs[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(fixedcn + "=") == 0) {
return decodeURIComponent(c.substring(cn.length + 1, c.length));
}
}
return "";
} }
/* Hide variable fields if no values are available */ /* Hide variable fields if no values are available */