Skip to content

Instantly share code, notes, and snippets.

@ZhangYiJiang
Last active January 29, 2026 01:05
Show Gist options
  • Select an option

  • Save ZhangYiJiang/1978d2a648ba567d67805c41c2946165 to your computer and use it in GitHub Desktop.

Select an option

Save ZhangYiJiang/1978d2a648ba567d67805c41c2946165 to your computer and use it in GitHub Desktop.
Block ads on tanstack.com
// ==UserScript==
// @name Hide ads on tanstack.com
// @namespace Violentmonkey Scripts
// @match https://tanstack.com/*
// @grant none
// @version 1.2
// @author -
// @description 1/28/2026, 4:31:24 PM
// ==/UserScript==
const adContainers = [
'.px-4.mx-auto.flex',
'.w-full.sm\\:sticky',
'.w-full',
];
function cleanAds() {
for (const a of document.getElementsByTagName('a')) {
if (a.textContent.trim() === "Hide Ads") {
for (const selector of adContainers) {
const c = a.closest(selector);
if (c) {
c.classList.add('hidden');
break;
}
}
}
}
}
setTimeout(() => cleanAds(), 150);
setTimeout(() => cleanAds(), 300);
setTimeout(() => cleanAds(), 1000);
setTimeout(() => cleanAds(), 1500);
setTimeout(() => cleanAds(), 2000);
setTimeout(() => cleanAds(), 3000);
let page = window.location.href;
setInterval(() => {
if (page !== window.location.href) {
page = window.location.href;
cleanAds();
setTimeout(() => cleanAds(), 1000);
setTimeout(() => cleanAds(), 2000);
setTimeout(() => cleanAds(), 3000);
}
}, 300);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment