Last active
September 13, 2024 02:40
-
-
Save kushagharahi/62841e3484271803e788a3650769d2ea to your computer and use it in GitHub Desktop.
Slickdeals URL Cleaner UserScript
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 Slickdeals URL Cleaner | |
// @description This script strips the URLS on slickdeals of referrers. If it can't strip the urls, it marks them as "Referral Link?" in hot pink. | |
// @author Kusha | |
// @homepage https://kusha.me/ | |
// @include http://slickdeals.net/* | |
// @include https://slickdeals.net/* | |
// @include http://*.slickdeals.net/* | |
// @include https://*.slickdeals.net/* | |
// @run-at document-idle | |
// @version 0.1 | |
// ==/UserScript== | |
(function() { | |
let REF_WARN = "<span style='color:#FF1493;font-weight: bold;'>[Referral Link?] </span>"; | |
let HREF_CHK = "u2="; | |
document.querySelectorAll("a[target]").forEach(url => { | |
if(url.href.includes(HREF_CHK)) { | |
url.href = decodeURIComponent(url.href.split(HREF_CHK)[1]) | |
} else { | |
url.innerHTML = REF_WARN + url.innerHTML; | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment