Skip to content

Instantly share code, notes, and snippets.

@kushagharahi
Last active December 25, 2023 20:34
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kushagharahi/62841e3484271803e788a3650769d2ea to your computer and use it in GitHub Desktop.
Save kushagharahi/62841e3484271803e788a3650769d2ea to your computer and use it in GitHub Desktop.
Slickdeals URL Cleaner UserScript
// ==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