Browse Source

Merge pull request #8115 from annando/path

Use only the first part of the path for the local storage
pull/8116/head
Hypolite Petovan 1 year ago
committed by GitHub
parent
commit
4a5a74b674
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      view/js/main.js

+ 3
- 3
view/js/main.js View File

@ -40,7 +40,7 @@ function initWidget(inflated, deflated) {
if (!elInf || !elDef) {
return;
}
if (localStorage.getItem(window.location.pathname + ":" + inflated) != "none") {
if (localStorage.getItem(window.location.pathname.split("/")[1] + ":" + inflated) != "none") {
elInf.style.display = "block";
elDef.style.display = "none";
} else {
@ -60,11 +60,11 @@ function openCloseWidget(inflated, deflated) {
if (window.getComputedStyle(elInf).display === "none") {
elInf.style.display = "block";
elDef.style.display = "none";
localStorage.setItem(window.location.pathname + ":" + inflated, "block");
localStorage.setItem(window.location.pathname.split("/")[1] + ":" + inflated, "block");
} else {
elInf.style.display = "none";
elDef.style.display = "block";
localStorage.setItem(window.location.pathname + ":" + inflated, "none");
localStorage.setItem(window.location.pathname.split("/")[1] + ":" + inflated, "none");
}
}


Loading…
Cancel
Save