Use local storage
This commit is contained in:
parent
d46a940d20
commit
d9f26aed66
|
@ -33,15 +33,6 @@ function _resizeIframe(obj, desth) {
|
||||||
setTimeout(_resizeIframe, 100, obj, ch);
|
setTimeout(_resizeIframe, 100, obj, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCookie(name) {
|
|
||||||
var value = "; " + document.cookie;
|
|
||||||
var parts = value.split("; " + name + "=");
|
|
||||||
|
|
||||||
if (parts.length == 2) {
|
|
||||||
return parts.pop().split(";").shift();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function initWidget(inflated, deflated) {
|
function initWidget(inflated, deflated) {
|
||||||
var elInf = document.getElementById(inflated);
|
var elInf = document.getElementById(inflated);
|
||||||
var elDef = document.getElementById(deflated);
|
var elDef = document.getElementById(deflated);
|
||||||
|
@ -49,7 +40,7 @@ function initWidget(inflated, deflated) {
|
||||||
if (!elInf || !elDef) {
|
if (!elInf || !elDef) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (getCookie(window.location.pathname + ":" + inflated) != "none") {
|
if (localStorage.getItem(window.location.pathname + ":" + inflated) != "none") {
|
||||||
elInf.style.display = "block";
|
elInf.style.display = "block";
|
||||||
elDef.style.display = "none";
|
elDef.style.display = "none";
|
||||||
} else {
|
} else {
|
||||||
|
@ -69,11 +60,11 @@ function openCloseWidget(inflated, deflated) {
|
||||||
if (window.getComputedStyle(elInf).display === "none") {
|
if (window.getComputedStyle(elInf).display === "none") {
|
||||||
elInf.style.display = "block";
|
elInf.style.display = "block";
|
||||||
elDef.style.display = "none";
|
elDef.style.display = "none";
|
||||||
document.cookie = window.location.pathname + ":" + inflated + "=block";
|
localStorage.setItem(window.location.pathname + ":" + inflated, "block");
|
||||||
} else {
|
} else {
|
||||||
elInf.style.display = "none";
|
elInf.style.display = "none";
|
||||||
elDef.style.display = "block";
|
elDef.style.display = "block";
|
||||||
document.cookie = window.location.pathname + ":" + inflated + "=none";
|
localStorage.setItem(window.location.pathname + ":" + inflated, "none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user