I want to stop a javascript .js to load on a specific website with greasemonkey/violentmonkey scrpit
https://cdn.jsdelivr.net/gh/s9e/[email protected]/loader.min.js
This is the script that loads on pagesource:
<script async="" crossorigin="anonymous" data-hljs-style="github-gist" integrity="sha384-TB2DTH77ndX7xwCHAtxD7BZqyn4r429ZSoGL7vcrb5x0bFSvLGAMoiriMUcIqeTu" onload="hljsLoader.highlightBlocks(this.parentNode)" src="https://cdn.jsdelivr.net/gh/s9e/[email protected]/loader.min.js"></script>
This is the url I want to stop loading on a webpage because it highlights code with syntax highlihgting, I want to stop syntax highlight.
If I block it on browser using ublock origin it works but I want to block it with userscript.
Edit: I used the script as suggested but it is not working, what could I be doing wrong?
// ==UserScript==
// @name New script
// @namespace Violentmonkey Scripts
// @match *flarum.org*
// @include *flarum.org*
// @grant none
// @version 1.0
// @run-at document-start
// @author -
// @description 12/26/2020, 9:57:34 AM
// ==/UserScript==
const observer = new MutationObserver((mutations) => {
mutations.forEach(({ addedNodes }) => {
addedNodes.forEach((addedNode) => {
if (addedNode.nodeType === 1 && addedNode.matches('script') && addedNode.src === 'https://cdn.jsdelivr.net/gh/s9e/[email protected]/loader.min.js') {
addedNode.remove();
observer.disconnect();
}
});
});
});
observer.observe(document.documentElement, { childList: true, subtree: true });
Am I missing something?
Here is the url That I'm trying to run script on https://discuss.flarum.org/d/25739-disable-syntax-highlighting