Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Remove JADS Scripts and Links
- // @namespace loki-scripts
- // @version 2
- // @description Removes any script or link containing "jads" or "juicyads" in the URL from webpages
- // @match *://*/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // Define a regular expression to match URLs containing "jads" or "juicyads"
- const blockedRegExp = /jads|juicyads/i;
- // Define an array of URLs to block
- const blockedUrls = [
- 'xapi.juicyads.com',
- 'juicyads.rocks'
- // Add any other URLs you want to block here
- ];
- // Find all <script> and <link> elements on the page
- const scripts = document.querySelectorAll('script,link');
- // Loop through each element
- for (let i = 0; i < scripts.length; i++) {
- const script = scripts[i];
- // Check if the element's href or src attribute contains the blockedRegExp
- if (blockedRegExp.test(script.href) || blockedRegExp.test(script.src)) {
- // Loop through the blockedUrls array
- for (let j = 0; j < blockedUrls.length; j++) {
- // Check if the element's href or src attribute contains a blocked URL
- if (script.href.includes(blockedUrls[j]) || script.src.includes(blockedUrls[j])) {
- // If it does, remove the element from the page
- script.parentNode.removeChild(script);
- break;
- }
- }
- }
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment