Skip to content

Instantly share code, notes, and snippets.

@rEtSaMfF
Last active September 5, 2016 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rEtSaMfF/874c6b64b0bfe6f3a4bf43be41279ddc to your computer and use it in GitHub Desktop.
Save rEtSaMfF/874c6b64b0bfe6f3a4bf43be41279ddc to your computer and use it in GitHub Desktop.
Remove tumblr outgoing URL tracking.
// ==UserScript==
// @name fixTumblr
// @namespace https://gist.github.com/rEtSaMfF/874c6b64b0bfe6f3a4bf43be41279ddc
// @description Remove tumblr outgoing URL tracking.
// @include /^https?://.*\.tumblr\.com/?.*$/
// @exclude /^https?://(secure\.)?(assets)\.tumblr\.com/.*$/
// @version 2016-09-05
// @run-at document-idle
// @grant none
// ==/UserScript==
// do not run on iframes
if (window.location.href.includes("iframe"))
return;
if (window.top != window.self) {
console.log("iframe: " + window.location);
//return;
} else {
console.log("NOT iframe: " + window.location);
}
function fixTumblr() {
var links = document.getElementsByTagName("a");
var linksArray = Array.prototype.slice.call(links);
linksArray.forEach(function(link) {
var href = link.href;
if (! href.includes("umblr.com/redirect?z="))
return;
var one = href.split("=")[1];
var two = one.split("&");
var decodedURL = decodeURIComponent(two[0]);
//console.log(link.href);
link.href = decodedURL;
//console.log(link.href);
});
}
fixTumblr();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment