diff options
Diffstat (limited to 'app/src/main/assets')
-rw-r--r-- | app/src/main/assets/js/menu.js | 16 | ||||
-rw-r--r-- | app/src/main/assets/js/menu.min.js | 2 | ||||
-rw-r--r-- | app/src/main/assets/js/menu_click.js | 16 | ||||
-rw-r--r-- | app/src/main/assets/js/menu_click.min.js | 1 |
4 files changed, 25 insertions, 10 deletions
diff --git a/app/src/main/assets/js/menu.js b/app/src/main/assets/js/menu.js index 94261146..2c517ed2 100644 --- a/app/src/main/assets/js/menu.js +++ b/app/src/main/assets/js/menu.js @@ -1,35 +1,33 @@ var viewport = document.getElementById('viewport'); var root = document.getElementById('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) { - if (document.getElementsByClassName('mSideMenu').length) { + var menuChildren = document.getElementsByClassName('mSideMenu'); + if (menuChildren.length > 0) { x.disconnect(); console.log('Found side menu'); - var menu = document.getElementsByClassName('mSideMenu')[0]; + var menu = menuChildren[0]; 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'); - }, 500) + Frost.handleHtml(document.documentElement.outerHTML); + }, 500); } }); - x.observe(document.getElementById('mJewelNav'), { childList: true, subtree: true diff --git a/app/src/main/assets/js/menu.min.js b/app/src/main/assets/js/menu.min.js index 6943e2a5..7aa05351 100644 --- a/app/src/main/assets/js/menu.min.js +++ b/app/src/main/assets/js/menu.min.js @@ -1 +1 @@ -var viewport=document.getElementById("viewport");var root=document.getElementById("root");var y=new MutationObserver(function(a){viewport.removeAttribute("style");root.removeAttribute("style")});y.observe(viewport,{attributes:true});y.observe(root,{attributes:true});var x=new MutationObserver(function(a){if(document.getElementsByClassName("mSideMenu").length){x.disconnect();console.log("Found side menu");var b=document.getElementsByClassName("mSideMenu")[0];while(root.firstChild){root.removeChild(root.firstChild)}while(b.childNodes.length){root.appendChild(b.childNodes[0])}setTimeout(function(){y.disconnect();console.log("Unhook styler")},500)}});x.observe(document.getElementById("mJewelNav"),{childList:true,subtree:true});document.getElementById("bookmarks_jewel").getElementsByTagName("a")[0].click();
\ No newline at end of file +var viewport=document.getElementById("viewport");var root=document.getElementById("root");var y=new MutationObserver(function(a){viewport.removeAttribute("style");root.removeAttribute("style")});y.observe(viewport,{attributes:true});y.observe(root,{attributes:true});var x=new MutationObserver(function(a){var c=document.getElementsByClassName("mSideMenu");if(c.length>0){x.disconnect();console.log("Found side menu");var b=c[0];while(root.firstChild){root.removeChild(root.firstChild)}while(b.childNodes.length){root.appendChild(b.childNodes[0])}Frost.emit(0);setTimeout(function(){y.disconnect();console.log("Unhook styler");Frost.handleHtml(document.documentElement.outerHTML)},500)}});x.observe(document.getElementById("mJewelNav"),{childList:true,subtree:true});document.getElementById("bookmarks_jewel").getElementsByTagName("a")[0].click();
\ No newline at end of file diff --git a/app/src/main/assets/js/menu_click.js b/app/src/main/assets/js/menu_click.js new file mode 100644 index 00000000..5698cbf0 --- /dev/null +++ b/app/src/main/assets/js/menu_click.js @@ -0,0 +1,16 @@ +// we will handle click events +document.onclick = function(e) { + e.preventDefault ? e.preventDefault() : e.returnValue = false; + e = e || window.event; + var element = e.target || e.srcElement; + if (element.tagName !== 'A') + element = element.parentNode; + if (element.tagName === 'A') { + var url = element.href; + console.log('Click Intercept'); + console.log(url); + if (url !== "https://m.facebook.com/settings" && url !== "https://m.facebook.com/settings#" && url !== "https://m.facebook.com/settings#!/settings?soft=bookmarks") + Frost.loadUrl(url); + Frost.reloadBaseUrl(); //temporary workaround + } +}; diff --git a/app/src/main/assets/js/menu_click.min.js b/app/src/main/assets/js/menu_click.min.js new file mode 100644 index 00000000..f404e360 --- /dev/null +++ b/app/src/main/assets/js/menu_click.min.js @@ -0,0 +1 @@ +document.onclick=function(c){c.preventDefault?c.preventDefault():c.returnValue=false;c=c||window.event;var b=c.target||c.srcElement;if(b.tagName!=="A"){b=b.parentNode}if(b.tagName==="A"){var a=b.href;console.log("Click Intercept");console.log(a);if(a!=="https://m.facebook.com/settings"&&a!=="https://m.facebook.com/settings#"&&a!=="https://m.facebook.com/settings#!/settings?soft=bookmarks"){Frost.loadUrl(a)}Frost.reloadBaseUrl()}};
\ No newline at end of file |