From 7ce3a2c84d7c2feb90a01581dbc19c6ba1584fc2 Mon Sep 17 00:00:00 2001 From: Akamaru Date: Thu, 6 Nov 2025 20:07:19 +0100 Subject: [PATCH] Neu: MuchoHentai: Popup-Blocker --- README.md | 17 ++++ muchohentai-popup-blocker.user.js | 149 ++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 muchohentai-popup-blocker.user.js diff --git a/README.md b/README.md index 899706c..538411c 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,23 @@ Behebt nicht funktionierende Produkt-Klicks auf doncarne.de, wenn das Clerk.io C --- +### 10. `muchohentai-popup-blocker.user.js` + +**Beschreibung:** +Blockiert nervige Popup-Werbung auf muchohentai.com, die sich bei jedem Klick öffnet. + +**Funktionen:** +- Überschreibt globale Ad-Funktionen (kjjzn, inwwhfk, vaujj) +- Blockiert window.open() Aufrufe zu bekannten Ad-Domains +- Erkennt und blockiert mehrfache Popup-Versuche bei einem Klick +- MutationObserver entfernt dynamisch eingefügte Ad-Scripts +- Blockiert Scripts mit verdächtigen Data-Attributen (data-clocid, data-clbaid) +- Popunder-Schutz: Holt automatisch den Fokus zurück +- Läuft bei document-start für maximale Effektivität +- Console-Logs für Debugging + +--- + ## Übersicht der enthaltenen UserStyles ### 1. `myanimelist-tweaks.user.css` diff --git a/muchohentai-popup-blocker.user.js b/muchohentai-popup-blocker.user.js new file mode 100644 index 0000000..70c7f56 --- /dev/null +++ b/muchohentai-popup-blocker.user.js @@ -0,0 +1,149 @@ +// ==UserScript== +// @name MuchoHentai: Popup-Blocker +// @namespace https://git.ponywave.de/Akamaru/Userscripts +// @version 1.0 +// @description Blockiert nervige Popup-Werbung die sich bei jedem Klick öffnet +// @author Akamaru +// @match *://muchohentai.com/* +// @match *://*.muchohentai.com/* +// @grant none +// @run-at document-start +// @updateURL https://git.ponywave.de/Akamaru/Userscripts/raw/branch/master/muchohentai-popup-blocker.user.js +// @downloadURL https://git.ponywave.de/Akamaru/Userscripts/raw/branch/master/muchohentai-popup-blocker.user.js +// ==/UserScript== + +(function() { + 'use strict'; + + // Liste der bekannten Ad-Domains die blockiert werden sollen + const adDomains = [ + 'browsecoherentunrefined.com', + 'guidepaparazzisurface.com', + 'earmuffpostnasalrisotto.com', + 'szubtepzaka.com' + ]; + + // ===== STRATEGIE 1: Globale Ad-Funktionen überschreiben ===== + // Diese Funktionen werden von den Ad-Scripts aufgerufen + window.kjjzn = function() { console.log('[Popup-Blocker] kjjzn blocked'); }; + window.inwwhfk = function() { console.log('[Popup-Blocker] inwwhfk blocked'); }; + window.vaujj = function() { console.log('[Popup-Blocker] vaujj blocked'); }; + + // ===== STRATEGIE 2: window.open() überschreiben ===== + const originalOpen = window.open; + window.open = function(url, name, features) { + // Prüfe ob die URL zu einer Ad-Domain gehört + if (url) { + const urlStr = url.toString().toLowerCase(); + for (const domain of adDomains) { + if (urlStr.includes(domain)) { + console.log('[Popup-Blocker] Blocked popup to:', url); + return null; + } + } + } + + // Erlaube nur window.open() Aufrufe mit explizitem User-Intent + // (z.B. wenn es keine Features angegeben sind, ist es vermutlich ein Popup) + if (!features && name !== '_blank') { + console.log('[Popup-Blocker] Blocked suspicious window.open()'); + return null; + } + + // Erlaube legitime window.open() Aufrufe + return originalOpen.call(window, url, name, features); + }; + + // ===== STRATEGIE 3: Click-Event-Schutz ===== + // Fange alle Click-Events in der Capture-Phase ab und prüfe auf verdächtiges Verhalten + let lastClickTime = 0; + let clickCount = 0; + + document.addEventListener('click', function(event) { + const now = Date.now(); + + // Reset Counter nach 1 Sekunde + if (now - lastClickTime > 1000) { + clickCount = 0; + } + + lastClickTime = now; + clickCount++; + + // Wenn mehrere window.open() Aufrufe in kurzer Zeit erfolgen, blockiere sie + const originalOpen = window.open; + let openCallCount = 0; + + window.open = function(...args) { + openCallCount++; + + if (openCallCount > 1) { + console.log('[Popup-Blocker] Multiple window.open() calls detected and blocked'); + window.open = originalOpen; + return null; + } + + // Wiederherstellung nach kurzem Timeout + setTimeout(() => { + window.open = originalOpen; + openCallCount = 0; + }, 100); + + return originalOpen.apply(this, args); + }; + }, true); // true = Capture-Phase (vor normalen Event-Handlern) + + // ===== STRATEGIE 4: Ad-Scripts blockieren ===== + // MutationObserver um dynamisch eingefügte Scripts zu entfernen + const observer = new MutationObserver(function(mutations) { + mutations.forEach(function(mutation) { + mutation.addedNodes.forEach(function(node) { + if (node.nodeName === 'SCRIPT' && node.src) { + const src = node.src.toLowerCase(); + + // Prüfe ob das Script von einer Ad-Domain kommt + for (const domain of adDomains) { + if (src.includes(domain)) { + console.log('[Popup-Blocker] Blocked script from:', node.src); + node.remove(); + return; + } + } + + // Prüfe auf verdächtige Data-Attribute (von Ad-Networks verwendet) + if (node.hasAttribute('data-clocid') || node.hasAttribute('data-clbaid')) { + console.log('[Popup-Blocker] Blocked ad script with data attributes'); + node.remove(); + } + } + }); + }); + }); + + // Starte Observer sobald das DOM verfügbar ist + if (document.documentElement) { + observer.observe(document.documentElement, { + childList: true, + subtree: true + }); + } else { + window.addEventListener('DOMContentLoaded', function() { + observer.observe(document.documentElement, { + childList: true, + subtree: true + }); + }); + } + + // ===== STRATEGIE 5: Popunder-Schutz ===== + // Verhindere dass das aktuelle Fenster im Hintergrund verschoben wird (Popunder-Technik) + window.addEventListener('blur', function() { + // Wenn ein neues Fenster geöffnet wurde und das aktuelle in den Hintergrund geht, + // hole den Fokus zurück + setTimeout(function() { + window.focus(); + }, 100); + }); + + console.log('[Popup-Blocker] MuchoHentai Popup-Blocker aktiviert'); +})();