mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 20:59:59 +00:00
parent
709d14ee9e
commit
87e0621ec4
1 changed files with 8 additions and 1 deletions
|
@ -245,6 +245,7 @@ const hideAllPopups = () => {
|
||||||
const popup = (type, action, text) => {
|
const popup = (type, action, text) => {
|
||||||
if (action === 1) {
|
if (action === 1) {
|
||||||
hideAllPopups(); // hide the previous popup before showing a new one
|
hideAllPopups(); // hide the previous popup before showing a new one
|
||||||
|
history.pushState(type, "");
|
||||||
store.isPopupOpen = true;
|
store.isPopupOpen = true;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "about":
|
case "about":
|
||||||
|
@ -306,6 +307,7 @@ const popup = (type, action, text) => {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
store.isPopupOpen = false;
|
store.isPopupOpen = false;
|
||||||
|
history.back();
|
||||||
if (type === "picker") {
|
if (type === "picker") {
|
||||||
eid("picker-download").href = '/';
|
eid("picker-download").href = '/';
|
||||||
eid("picker-download").classList.remove("visible");
|
eid("picker-download").classList.remove("visible");
|
||||||
|
@ -651,6 +653,11 @@ document.onkeydown = (e) => {
|
||||||
if (e.key === "M") popup('settings', 1);
|
if (e.key === "M") popup('settings', 1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (e.key === "Escape") hideAllPopups();
|
if (e.key === "Escape") history.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window.addEventListener("popstate", (e) => {
|
||||||
|
if (store.isPopupOpen) {
|
||||||
|
hideAllPopups();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in a new issue