diff options
Diffstat (limited to 'app/src/main/assets/js')
-rw-r--r-- | app/src/main/assets/js/menu.js | 74 | ||||
-rw-r--r-- | app/src/main/assets/js/menu.min.js | 8 | ||||
-rw-r--r-- | app/src/main/assets/js/search.js | 10 | ||||
-rw-r--r-- | app/src/main/assets/js/search.min.js | 10 |
4 files changed, 61 insertions, 41 deletions
diff --git a/app/src/main/assets/js/menu.js b/app/src/main/assets/js/menu.js index 4a39a93b..458d9edf 100644 --- a/app/src/main/assets/js/menu.js +++ b/app/src/main/assets/js/menu.js @@ -1,38 +1,36 @@ -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 +//click menu and move contents to main view +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(); diff --git a/app/src/main/assets/js/menu.min.js b/app/src/main/assets/js/menu.min.js index 0f218ea5..4627b847 100644 --- a/app/src/main/assets/js/menu.min.js +++ b/app/src/main/assets/js/menu.min.js @@ -1,14 +1,16 @@ -if(null!==document.querySelector("#mJewelNav")){ console.log("Fetching menu") + ;var viewport=document.querySelector("#viewport"),root=document.querySelector("#root"),y=new MutationObserver(function(e){ viewport.removeAttribute("style"), root.removeAttribute("style") }) + ;y.observe(viewport,{ attributes:!0 }),y.observe(root,{ attributes:!0 }) + ;var x=new MutationObserver(function(e){ var o=document.querySelector(".mSideMenu") ;if(null!==o){ @@ -20,8 +22,8 @@ Frost.handleHtml(document.documentElement.outerHTML) },500) } }) + ;x.observe(document.querySelector("#mJewelNav"),{ childList:!0, subtree:!0 -}),document.querySelector("#bookmarks_jewel").querySelector("a").click() -}
\ No newline at end of file +}),document.querySelector("#bookmarks_jewel").querySelector("a").click();
\ No newline at end of file diff --git a/app/src/main/assets/js/search.js b/app/src/main/assets/js/search.js new file mode 100644 index 00000000..3d10e6f5 --- /dev/null +++ b/app/src/main/assets/js/search.js @@ -0,0 +1,10 @@ +//binds callbacks to an invisible webview to take in the search events +console.log('Binding Search'); +var page = document.querySelector('#page'); +var x = new MutationObserver(function(mutations) { + Frost.handleHtml(page.innerHTML); +}); +x.observe(page, { + childList: true, + subtree: true +}); diff --git a/app/src/main/assets/js/search.min.js b/app/src/main/assets/js/search.min.js new file mode 100644 index 00000000..fe93d004 --- /dev/null +++ b/app/src/main/assets/js/search.min.js @@ -0,0 +1,10 @@ +console.log("Binding Search") + +;var page=document.querySelector("#page"),x=new MutationObserver(function(e){ +Frost.handleHtml(page.innerHTML) +}) + +;x.observe(page,{ +childList:!0, +subtree:!0 +});
\ No newline at end of file |