Skip to content

Instantly share code, notes, and snippets.

@guyru
Last active Aug 29, 2015
Embed
What would you like to do?
Outbrained - Greasemonkey script to remove tracking URLs from Outbrain links.
// ==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