Skip to content

Instantly share code, notes, and snippets.

@superskirv
Last active June 1, 2025 00:02
Show Gist options
  • Save superskirv/b2f3be9d9ed5b8ede8b3b698e9e9ca10 to your computer and use it in GitHub Desktop.
Save superskirv/b2f3be9d9ed5b8ede8b3b698e9e9ca10 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Civitai Ad Div Remover
// @namespace https://civitai.com/user/superskirv
// @version 0.4
// @description Removes add cell from the front page, and possibly others.
// @author Super.Skirv and Qwen2.5-QwQ
// @match https://civitai.com/*
// @icon https://civitai.com/images/android-chrome-192x192.png
// @grant none
// ==/UserScript==
(function() {
'use strict';
function removeAdDiv() {
// Target containers using CSS class selectors
document.querySelectorAll('div.flex-col.items-center.justify-center')
.forEach(div => div.remove());
}
// Updated to specifically target ads containing membership prompt
function removeAdDiv2() {
const targetText = "Become a Member to turn off ads today.";
document.querySelectorAll('.mantine-Text-root').forEach(element => {
if (
element.classList.contains('mantine-ljqvxq') && element.textContent === targetText
) {
// Traverse up to find the container div with specific classes
let container = element.closest(
'div[class*="mx-auto"][class*="min-w-80"]'
);
if (container) container.remove();
}
});
}
// Run once on load and periodically in case new content loads dynamically
window.addEventListener('load', removeAdDiv);
window.addEventListener('load', removeAdDiv2);
setInterval(removeAdDiv, 2000);
setInterval(removeAdDiv2, 2000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment