diff options
author | Allan Wang <me@allanwang.ca> | 2021-11-21 23:21:14 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2021-11-21 23:21:14 -0800 |
commit | c28973319df956c6ce75998b4d213c2da31bf91b (patch) | |
tree | 61ace21dbed8d5d3d91a319b3fbf918b93379c0f /app/src/web/ts | |
parent | dd37321626e6e5d604f12d7ffb00eeb789df0d5f (diff) | |
download | frost-c28973319df956c6ce75998b4d213c2da31bf91b.tar.gz frost-c28973319df956c6ce75998b4d213c2da31bf91b.tar.bz2 frost-c28973319df956c6ce75998b4d213c2da31bf91b.zip |
Simplify menu tab loading process
Diffstat (limited to 'app/src/web/ts')
-rw-r--r-- | app/src/web/ts/menu.ts | 50 |
1 files changed, 13 insertions, 37 deletions
diff --git a/app/src/web/ts/menu.ts b/app/src/web/ts/menu.ts index b26e9cc9..a288ba07 100644 --- a/app/src/web/ts/menu.ts +++ b/app/src/web/ts/menu.ts @@ -20,43 +20,19 @@ return } - /* - * Required to remove height restrictions - */ - const y = new MutationObserver(() => { - viewport.removeAttribute('style'); - root.removeAttribute('style'); - }); - - y.observe(viewport, { - attributes: true - }); - y.observe(root, { - attributes: true - }); + // menu container + const bookmarkFlyout = document.querySelector('#bookmarks_flyout'); + if (bookmarkFlyout instanceof HTMLElement) { + bookmarkFlyout.style.marginTop = "0"; + } - const x = new MutationObserver(() => { - const menu = document.querySelector('.mSideMenu'); - if (menu) { - x.disconnect(); - console.log("Found side menu"); - // Transfer elements - while (root.firstChild) { - root.removeChild(root.firstChild); - } - while (menu.childNodes.length) { - viewport.appendChild(menu.childNodes[0]); - } + // Js handling is a bit slow so we need to wait + setTimeout(() => { + menuA.click(); + console.log("Menu setup clicked"); + // Reaction is also slow so we need to wait + setTimeout(() => { Frost.emit(0); - setTimeout(() => { - y.disconnect(); - console.log('Unhook styler'); - }, 500); - } - }); - x.observe(jewel, { - childList: true, - subtree: true - }); - menuA.click(); + }, 100); + }, 200); }).call(undefined); |