aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/js/menu.js
blob: 4a39a93bfe2ba1fddb7a28f920ace6f9a4790d77 (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
33
34
35
36
37
38
if (document.querySelector('#mJewelNav') !== null) {
  console.log('Fetching menu');
  var viewport = document.querySelector('#viewport');
  var root = document.querySelector('#root');
  var y = new MutationObserver(function(mutations) {
    viewport.removeAttribute('style');
    root.removeAttribute('style');
  });
  y.observe(viewport, {
    attributes: true
  });
  y.observe(root, {
    attributes: true
  });
  var x = new MutationObserver(function(mutations) {
    var menu = document.querySelector('.mSideMenu');
    if (menu !== null) {
      x.disconnect();
      console.log('Found side menu');
      while (root.firstChild)
        root.removeChild(root.firstChild);
      while (menu.childNodes.length)
        root.appendChild(menu.childNodes[0]);
      Frost.emit(0);
      setTimeout(function() {
        y.disconnect();
        console.log('Unhook styler');
        Frost.handleHtml(document.documentElement.outerHTML);
      }, 500);
    }
  });
  x.observe(document.querySelector('#mJewelNav'), {
    childList: true,
    subtree: true
  });
  document.querySelector('#bookmarks_jewel').querySelector('a').click();
}
//otherwise we've already found the side nav and this is unnecessary