-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple-popup-block.js
42 lines (38 loc) · 1.34 KB
/
simple-popup-block.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// ==UserScript==
// @name Simple Popup Blocker
// @namespace http://interlacedpixel.com/
// @updateURL https://github.com/Jayian1890/userscripts/raw/main/simple-popup-block.js
// @downloadURL https://github.com/Jayian1890/userscripts/raw/main/simple-popup-block.js
// @version 0.8
// @description Blocks requests to specific URLs, domains, and filenames.
// @author Jayian
// @match *://*/*
// @grant none // No other @grant directives needed
// ==/UserScript==
(function () {
"use strict";
const blockedURLs = [
"https://peezowhat.net/tag.min.js",
"*://*/tag.min.js",
// Add more URLs here...
];
function blockScripts(mutationList) {
for (const mutation of mutationList) {
if (mutation.type === "childList") {
for (const node of mutation.addedNodes) {
if (node.nodeName === "SCRIPT" && node.src) {
for (const blockedURL of blockedURLs) {
if (node.src.includes(blockedURL)) {
node.remove();
console.log("Blocked script injection:", node.src);
break; // Stop checking other blocked URLs once a match is found
}
}
}
}
}
}
}
const observer = new MutationObserver(blockScripts);
observer.observe(document.head, { childList: true, subtree: true });
})();