Skip to content

Instantly share code, notes, and snippets.

@asonas
Created April 10, 2024 05:46
Show Gist options
  • Save asonas/fa46763cd5acb655e6b28846474e77d8 to your computer and use it in GitHub Desktop.
Save asonas/fa46763cd5acb655e6b28846474e77d8 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Remove onclick from a tags on Soundhouse
// @namespace https://ason.as/
// @version 0.1
// @description Remove onclick events from all a tags on Soundhouse website
// @author asonas
// @match *://www.soundhouse.co.jp/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((node) => {
if (node.nodeType === 1 && node.tagName === 'A') {
node.removeAttribute('onclick');
}
});
});
});
const config = { childList: true, subtree: true };
observer.observe(document.body, config);
document.querySelectorAll('a[onclick]').forEach((a) => {
a.removeAttribute('onclick');
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment