Skip to content

Instantly share code, notes, and snippets.

@superskirv
Last active June 5, 2025 03:57
Show Gist options
  • Save superskirv/e1792bbcfce3ca5e7816fe605ce3ae19 to your computer and use it in GitHub Desktop.
Save superskirv/e1792bbcfce3ca5e7816fe605ce3ae19 to your computer and use it in GitHub Desktop.
Civitai Image Highlight Remover: Removes glowing border around images.
// ==UserScript==
// @name Civitai Image Highlight Remover
// @namespace https://civitai.com/user/superskirv
// @version 0.5.2
// @description Removes border from images and models on Civitai
// @author Super.Skirv and Qwen2.5-Coder-32B-Instruct
// @match https://civitai.com/*
// @icon https://civitai.com/images/android-chrome-192x192.png
// @grant none
// ==/UserScript==
(function() {
'use strict';
//Disabled calling this function till I figure out a better way to remove the parent frame for adds here...
// Function to remove class names from direct children of <div class="mantine-1ofgurw">
//Typically found on the front page.
function removeStyleGlowBorder() {
// Get the parent div with class "mantine-1ofgurw"
const parentDiv = document.querySelector('div.mantine-1ofgurw');
if (parentDiv) {
// Get all direct children <div> elements of the parent div
const childDivs = parentDiv.querySelectorAll(':scope > div');
childDivs.forEach(childDiv => {
// Clear the class attribute of each child div
childDiv.className = '';
});
}
}
// Function to remove class names from frame-decoration div names
//Typically found on the front page.
function removeStyleBorderColors() {
// Define the class pattern to search for
const classPattern = /^frame-decoration mantine-/;
// Get all div elements
const divs = document.querySelectorAll('div');
divs.forEach(div => {
// Check if the class attribute matches the pattern
if (classPattern.test(div.className)) {
// Clear the class attribute
div.className = '';
}
});
}
// Function to remove specific classes from divs
//Typically found on the image/movie pages.
function removeImageCosmeticWrapper() {
// Define the class names to search for
const classNamesToRemove = [
"CosmeticWrapper_cssFrame__Lrn6N",
"CosmeticWrapper_glow__KJ57U",
"CosmeticWrapper_texture__cRC58",
"CosmeticLights_green__mLmRu"
];
// Get all div elements
const divs = document.querySelectorAll('div');
divs.forEach(div => {
// Check if the div has any of the classes to remove
if (classNamesToRemove.some(className => div.classList.contains(className))) {
// Remove each specified class
classNamesToRemove.forEach(className => div.classList.remove(className));
}
});
}
// Run the function on page load
window.addEventListener('load', () => {
//removeStyleGlowBorder();
removeStyleBorderColors();
removeImageCosmeticWrapper();
});
// Optionally, you can run the function periodically if the page content changes dynamically
setInterval(() => {
//removeStyleGlowBorder();
removeStyleBorderColors();
removeImageCosmeticWrapper();
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment