Skip to content

Instantly share code, notes, and snippets.

@plasmatic1
Last active August 17, 2023 19:46
Show Gist options
  • Save plasmatic1/99ed6e8ea2161f63871132bc0e2629fc to your computer and use it in GitHub Desktop.
Save plasmatic1/99ed6e8ea2161f63871132bc0e2629fc to your computer and use it in GitHub Desktop.
RemoveSimplify: A GreaseMonkey script that removes URL query parameter values containing the case-insensitive string "simplify", repeating very 5 seconds.
// ==UserScript==
// @name Remove Simplify
// @version 1
// @grant none
// @author Plasmatic (Moses Xu)
// ==/UserScript==
function removeSimplify() {
// Function to remove a specific query parameter from a URL
function removeQueryParamByValueContains(url, param) {
var urlParts = url.split("?");
if (urlParts.length > 1) {
var queryParams = urlParts[1].split("&");
var newParams = queryParams.filter(function(query) {
var key = query.split("=")[0];
var value = query.split("=")[1];
return !value.toLowerCase().includes(param.toLowerCase());
});
return urlParts[0] + (newParams.length > 0 ? "?" + newParams.join("&") : "");
}
return url;
}
// Retrieve the current URL of the browser window
let currentURL = window.location.href, newURL = removeQueryParamByValueContains(currentURL, "simplify");
if (currentURL !== newURL) {
history.pushState(null, null, newURL);
console.log("REMOVESIMPLIFY: Modified URL from", currentURL, "to", window.location.href);
}
}
setInterval(removeSimplify, 5000);
console.log("REMOVESIMPLIFY: Script initialized");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment