Skip to content

Instantly share code, notes, and snippets.

@sandaru1
Created February 15, 2012 15:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandaru1/1836698 to your computer and use it in GitHub Desktop.
Save sandaru1/1836698 to your computer and use it in GitHub Desktop.
Facebook link cleaner
// ==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