Skip to content

Instantly share code, notes, and snippets.

@kushagharahi
Last active September 13, 2024 02:40
Show Gist options
  • 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