Last active
August 29, 2015 14:04
-
-
Save guyru/b03b52fa8140146dad7d to your computer and use it in GitHub Desktop.
Outbrained - Greasemonkey script to remove tracking URLs from Outbrain links.
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 Outbrained | |
// @namespace http://www.guyrutenberg.com | |
// @description Removes annoying tracking outbrain links. | |
// @include http://www.haaretz.co.il/* | |
// @include http://www.ynet.co.il/* | |
// @include http://www.calcalist.co.il/* | |
// @include http://www.themarker.com/* | |
// @version 1.0 | |
// @grant none | |
// ==/UserScript== | |
// Change Log | |
// ========== | |
// 1.0: 2014-08-01 | |
// * Initial release. | |
function isOutbrainLink(element) { | |
var onmousedown_attr = element.getAttribute('onmousedown'); | |
return /^this\.href='http:\/\/[^.]+\.outbrain\.com/.test(onmousedown_attr); | |
} | |
function fixLink(element, index, array) { | |
element.removeAttribute('onmousedown'); | |
element.removeAttribute('onclick'); | |
} | |
var all_links = document.getElementsByTagName('a'); | |
for (var i = 0; i < all_links.length; i++) { | |
var link = all_links[i]; | |
if (!isOutbrainLink(link)) | |
continue; | |
fixLink(link); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment