Created
February 15, 2012 15:30
-
-
Save sandaru1/1836698 to your computer and use it in GitHub Desktop.
Facebook link cleaner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Facebook link cleaner | |
// @description Remove facebook link mousedown events that sends you to news site's facebook app instead actual content. Based on "http://userscripts.org/scripts/review/125355" | |
// @include http://www.facebook.com/* | |
// @include https://www.facebook.com/* | |
// @version 1.0 | |
// ==/UserScript== | |
function stripit(links) { | |
for (var i=0; i<links.length; i++) { | |
if (links[i].onmousedown && links[i].onmousedown.toString().indexOf("UntrustedLink") > -1) { | |
links[i].removeAttribute("onmousedown"); | |
links[i].removeEventListener("mousedown"); | |
} | |
} | |
} | |
stripit(document.links); | |
document.addEventListener('DOMNodeInserted', | |
function(e) { | |
var src=e.srcElement; | |
if (src.nodeType==1) stripit(src.getElementsByTagName("a")); | |
return true; | |
}, | |
false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment