It's a custom blocklist script* for Greasemonkey/Tampermonkey that works on the repo pages. The darker black area with the script options is a right-click menu. That could have been made clearer, yeah.
*Thanks ChatGPT for making it for my non-coding ass. :D
Cheers dude. I didn't even know what tampermonkey was, but now I've added a script to block hacks and homebrew.
If anyone else wants the script, this is it:
// ==UserScript==
//
@Name CDRomance Custom Filters
// @namespace
http://tampermonkey.net/
//
@Version 1.0
// @description Adds filters to hide Rom Hacks and Homebrew content on CDRomance.
//
@Author Gemini
//
@match https://cdromance.org/*
//
@GranT GM_addStyle
// ==/UserScript==
(function() {
'use strict';
// --- CONFIGURATION ---
// Selector for the main game container element.
const GAME_CONTAINER_SELECTOR = '.game-container';
// Selector for the wrapper where we will insert the new filters (the options bar).
const FILTER_BAR_SELECTOR = '.options';
// Selector for the Hack tag element within a game container.
const HACK_TAG_SELECTOR = '.bannertag.hack';
// Selector for the Homebrew tag element within a game container.
const HOMEBREW_TAG_SELECTOR = '.bannertag.homebrew';
// Helper function to get a value from localStorage
function getStoredValue(key, defaultValue) {
const stored = localStorage.getItem(key);
return stored === null ? defaultValue : (stored === 'true');
}
// Helper function to save a value to localStorage
function setStoredValue(key, value) {
localStorage.setItem(key, value);
}
// --- MAIN FILTER LOGIC ---
function applyFilters() {
const hideHacks = document.getElementById('hide-rom-hacks').checked;
const hideHomebrew = document.getElementById('hide-homebrew').checked;
// Save the current state to localStorage
setStoredValue('cdr_hide_rom_hacks', hideHacks);
setStoredValue('cdr_hide_homebrew', hideHomebrew);
// Iterate over all game containers
document.querySelectorAll(GAME_CONTAINER_SELECTOR).forEach(game => {
let shouldHide = false;
// Check for Rom Hacks
const isHack = game.querySelector(HACK_TAG_SELECTOR);
if (hideHacks && isHack) {
shouldHide = true;
}
// Check for Homebrew
const isHomebrew = game.querySelector(HOMEBREW_TAG_SELECTOR);
if (hideHomebrew && isHomebrew) {
shouldHide = true;
}
// Apply display style
game.style.display = shouldHide ? 'none' : 'block';
});
// The layout is a CSS Grid, so we may need to re-center the remaining items
// by forcing a reflow or using the existing CSS. Setting display: block is usually enough.
}
// --- INTERFACE CREATION ---
function createFilterInterface() {
const filterBar = document.querySelector(FILTER_BAR_SELECTOR);
if (!filterBar) {
console.error('Filter bar container not found.');
return;
}
// 1. Create a container for our new filters
const newFilterDiv = document.createElement('div');
newFilterDiv.className = 'custom-filters'; // Use this class for custom styling if needed
// 2. Add "Hide Rom Hacks" checkbox
const hideHacksState = getStoredValue('cdr_hide_rom_hacks', false);
newFilterDiv.innerHTML += `
<label style="margin-left: 10px; cursor: pointer;">
<input type="checkbox" id="hide-rom-hacks" ${hideHacksState ? 'checked' : ''} style="margin-right: 5px;">
Hide Rom Hacks
</label>
`;
// 3. Add "Hide Homebrew" checkbox
const hideHomebrewState = getStoredValue('cdr_hide_homebrew', false);
newFilterDiv.innerHTML += `
<label style="margin-left: 10px; cursor: pointer;">
<input type="checkbox" id="hide-homebrew" ${hideHomebrewState ? 'checked' : ''} style="margin-right: 5px;">
Hide Homebrew Roms
</label>
`;
// The existing filters are inside the div with class 'options'.
// We will prepend our new div to ensure it appears logically near the search bar.
filterBar.prepend(newFilterDiv);
// 4. Attach event listeners
document.getElementById('hide-rom-hacks').addEventListener('change', applyFilters);
document.getElementById('hide-homebrew').addEventListener('change', applyFilters);
// 5. Apply filters on initial load
applyFilters();
}
// --- EXECUTION ---
// Run the setup when the document is ready.
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', createFilterInterface);
} else {
createFilterInterface();
}
})();