diff options
author | Allan Wang <me@allanwang.ca> | 2021-11-22 12:15:10 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-22 12:15:10 -0800 |
commit | eb2e0d07f278eb2079666ffabcbee007173c17af (patch) | |
tree | 1094d0b1de61c927b63b683fce30200ebf6d4012 /app/src/web/ts/menu.ts | |
parent | b9dbef403e4c57b9c252d8b97b10c30d33075ac7 (diff) | |
parent | f448eaf4c21c40778663f2d11b6f6f8ad8855b0f (diff) | |
download | frost-eb2e0d07f278eb2079666ffabcbee007173c17af.tar.gz frost-eb2e0d07f278eb2079666ffabcbee007173c17af.tar.bz2 frost-eb2e0d07f278eb2079666ffabcbee007173c17af.zip |
Merge pull request #1856 from AllanWang/menu-tab
Diffstat (limited to 'app/src/web/ts/menu.ts')
-rw-r--r-- | app/src/web/ts/menu.ts | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/app/src/web/ts/menu.ts b/app/src/web/ts/menu.ts index b26e9cc9..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,43 +20,13 @@ 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 - }); - - 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); + }, 500); }).call(undefined); |