mirror of
https://github.com/friendica/friendica
synced 2025-04-27 15:10:11 +00:00
We now store the state in a cookie
This commit is contained in:
parent
8f36a1554e
commit
cfeef7afed
7 changed files with 83 additions and 16 deletions
|
@ -33,6 +33,50 @@ function _resizeIframe(obj, desth) {
|
|||
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) {
|
||||
var elInf = document.getElementById(inflated);
|
||||
var elDef = document.getElementById(deflated);
|
||||
|
||||
if (!elInf || !elDef) {
|
||||
return;
|
||||
}
|
||||
if (getCookie(window.location.pathname + ":" + inflated) != "none") {
|
||||
elInf.style.display = "block";
|
||||
elDef.style.display = "none";
|
||||
} else {
|
||||
elInf.style.display = "none";
|
||||
elDef.style.display = "block";
|
||||
}
|
||||
}
|
||||
|
||||
function openCloseWidget(inflated, deflated) {
|
||||
var elInf = document.getElementById(inflated);
|
||||
var elDef = document.getElementById(deflated);
|
||||
|
||||
if (!elInf || !elDef) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (window.getComputedStyle(elInf).display === "none") {
|
||||
elInf.style.display = "block";
|
||||
elDef.style.display = "none";
|
||||
document.cookie = window.location.pathname + ":" + inflated + "=block";
|
||||
} else {
|
||||
elInf.style.display = "none";
|
||||
elDef.style.display = "block";
|
||||
document.cookie = window.location.pathname + ":" + inflated + "=none";
|
||||
}
|
||||
}
|
||||
|
||||
function openClose(theID) {
|
||||
var el = document.getElementById(theID);
|
||||
if (el) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue