Last active
April 2, 2023 14:56
-
-
Save gsabater/d7767ee5d21069a814967ecfa81bd415 to your computer and use it in GitHub Desktop.
Userscript to clean Amazon links and remove Affiliate params
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 Amazon Affiliate cleaner | |
// @namespace https://gist.github.com/gsabater/d7767ee5d21069a814967ecfa81bd415 | |
// @version 0.3 | |
// @description Remove affiliate links for amazon links | |
// @author You | |
// @match * | |
// @include * | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function clearAmazonLinks(){ | |
var links = document.getElementsByTagName("a"); | |
for(var i=0; i<links.length; i++) { | |
var link = links[i]; | |
if(link.href.includes("amazon.")){ | |
var clean = link.href.substr(0, link.href.indexOf('?')); | |
// console.log(url,links[i].href); | |
link.href = clean; | |
} | |
} | |
} | |
window.setTimeout(clearAmazonLinks, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment