Greasy Fork is available in English.
Blocks ads on Shellshock.io
当前为
// ==UserScript==
// @name Shellshock.io Ad Blocker
// @namespace https://shellshock.io
// @description Blocks ads on Shellshock.io
// @version 1.2
// @match https://shellshock.io/*
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// Function to remove the ad blocker warning element
function removeAdBlockerWarning() {
var adBlockerWarning = document.getElementById('adBlockerVideo');
if (adBlockerWarning) {
adBlockerWarning.parentNode.removeChild(adBlockerWarning);
}
}
// Function to prevent ads from being loaded
function blockAds() {
var aiptag = window.aiptag;
if (aiptag) {
aiptag.cmd = [];
aiptag.cmd.display = [];
aiptag.cmd.player = [];
}
}
// Observe the document for changes to detect when the ad blocker warning element is created
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.addedNodes && mutation.addedNodes.length > 0) {
for (var i = 0; i < mutation.addedNodes.length; i++) {
var node = mutation.addedNodes[i];
if (node.id === 'adBlockerVideo') {
removeAdBlockerWarning();
}
}
}
});
});
// Configure the observer to observe the document for changes
observer.observe(document, {
childList: true,
subtree: true
});
// Block ads immediately
blockAds();
// Block ads whenever the aiptag object is updated
setInterval(blockAds, 1000);
})();