Blocks image-based ads on bbblox.org | By feowi_
目前為
// ==UserScript==
// @name BubbaBlox AdBlocker
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Blocks image-based ads on bbblox.org | By feowi_
// @author feowi_ (@doi on Bubbablox)
// @license MIT
// @match *://bbblox.org/*
// @match *://www.bbblox.org/*
// @run-at document-start
// @grant none
// ==/UserScript==
(function() {
'use strict';
const blockURL = "https://bbblox.org/images/";
const observer = new MutationObserver(() => {
document.querySelectorAll('img').forEach(img => {
if (img.src.startsWith(blockURL)) {
img.remove();
}
});
});
observer.observe(document.documentElement, { childList: true, subtree: true });
const open = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function(method, url) {
if (url.startsWith(blockURL)) {
console.log("Blocked:", url);
return;
}
return open.apply(this, arguments);
};
const origFetch = window.fetch;
window.fetch = function(url, options) {
if (typeof url === 'string' && url.startsWith(blockURL)) {
console.log("Blocked fetch:", url);
return new Promise(() => {});
}
return origFetch.apply(this, arguments);
};
})();