aboutsummaryrefslogtreecommitdiff
path: root/app/src/web/ts/menu.ts
blob: 5b3e6fa9324aa811c1dc6061f3e91b1b648e54d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Click menu after delay and notify
(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
    }

    // 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);
        }, 100);
    }, 500);
}).call(undefined);