diff options
author | Allan Wang <me@allanwang.ca> | 2021-11-21 23:56:20 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2021-11-21 23:56:20 -0800 |
commit | ba458a612610512e28b65bafcf74177ddc77bbbe (patch) | |
tree | 0fb3aec423b5db8a06f8f72c97c73df171401e96 /app/src/web/ts | |
parent | c28973319df956c6ce75998b4d213c2da31bf91b (diff) | |
download | frost-ba458a612610512e28b65bafcf74177ddc77bbbe.tar.gz frost-ba458a612610512e28b65bafcf74177ddc77bbbe.tar.bz2 frost-ba458a612610512e28b65bafcf74177ddc77bbbe.zip |
Improve menu loading when going back
Diffstat (limited to 'app/src/web/ts')
-rw-r--r-- | app/src/web/ts/menu.ts | 10 | ||||
-rw-r--r-- | app/src/web/ts/menu_quick.ts | 24 |
2 files changed, 26 insertions, 8 deletions
diff --git a/app/src/web/ts/menu.ts b/app/src/web/ts/menu.ts index a288ba07..5b3e6fa9 100644 --- a/app/src/web/ts/menu.ts +++ b/app/src/web/ts/menu.ts @@ -1,4 +1,4 @@ -// Click menu and move contents to main view +// Click menu after delay and notify (function () { const viewport = document.querySelector("#viewport"); const root = document.querySelector("#root"); @@ -20,12 +20,6 @@ return } - // menu container - const bookmarkFlyout = document.querySelector('#bookmarks_flyout'); - if (bookmarkFlyout instanceof HTMLElement) { - bookmarkFlyout.style.marginTop = "0"; - } - // Js handling is a bit slow so we need to wait setTimeout(() => { menuA.click(); @@ -34,5 +28,5 @@ setTimeout(() => { Frost.emit(0); }, 100); - }, 200); + }, 500); }).call(undefined); diff --git a/app/src/web/ts/menu_quick.ts b/app/src/web/ts/menu_quick.ts new file mode 100644 index 00000000..f7b117a4 --- /dev/null +++ b/app/src/web/ts/menu_quick.ts @@ -0,0 +1,24 @@ +// Copy of menu.ts without timeouts or notifications +(function () { + const viewport = document.querySelector("#viewport"); + const root = document.querySelector("#root"); + const bookmarkJewel = document.querySelector("#bookmarks_jewel"); + if (!viewport || !root || !bookmarkJewel) { + console.log('Menu.js: main elements not found'); + Frost.emit(0); + return + } + const menuA = bookmarkJewel.querySelector("a"); + if (!menuA) { + console.log('Menu.js: menu links not found'); + Frost.emit(0); + return + } + const jewel = document.querySelector('#mJewelNav'); + if (!jewel) { + console.log('Menu.js: jewel is null'); + return + } + + menuA.click(); +}).call(undefined); |