Skip to content

Instantly share code, notes, and snippets.

@K4rakara
Last active December 16, 2021 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save K4rakara/2457dba0af6e77b49b104cc38cbefd44 to your computer and use it in GitHub Desktop.
Save K4rakara/2457dba0af6e77b49b104cc38cbefd44 to your computer and use it in GitHub Desktop.
Fuck you, New York Times
// ==UserScript==
// @name FuNYTimes
// @description Fuck You, New York Times.
// @match https://www.nytimes.com/*
// @version 1
// ==/UserScript==
!function() {
console.log("FuNYTimes: now active.");
function getCookies() {
return document.cookie
.split(";")
.map((cookie) => cookie.trim().split("=")[0])
.filter((cookie) => cookie != null && cookie != "");
}
function deleteCookies() {
for (const cookie of getCookies()) {
document.cookie = cookie + "=;Path=/;Domain=.nytimes.com;Max-Age=-9999;";
console.log(`FuNYTimes: Deleted '${cookie}' cookie.`);
}
}
setInterval(deleteCookies, 5000);
function pestControl() {
const pests = document.querySelectorAll([
".MAG_web_all_Monthly-Sale-dock.shown:not(.pesticide)",
"[class*=Sale]:not(.pesticide)",
"[class*=sale]:not(.pesticide)",
].join(", "));
for (const pest of pests) {
pest.remove();
pest.classList.add("pesticide");
console.log("FuNYTimes: Removed a pest.");
}
const otherPest = document.querySelector(".css-1wspfld");
if (otherPest != null) {
if (otherPest.innerHTML.indexOf("out of free") != -1) {
otherPest.remove();
console.log("FuNYTimes: Removed the 'almost out of free articles for this month' pest.");
}
}
setTimeout(pestControl, 100);
}
setInterval(pestControl, 100);
}.call({});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment