From c28973319df956c6ce75998b4d213c2da31bf91b Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 21 Nov 2021 23:21:14 -0800 Subject: Simplify menu tab loading process --- app/src/web/ts/menu.ts | 50 +++++++++++++------------------------------------- 1 file changed, 13 insertions(+), 37 deletions(-) (limited to 'app/src/web/ts') 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); -- cgit v1.2.3