Skip to content

Instantly share code, notes, and snippets.

@825i
Last active March 24, 2025 14:42
Show Gist options
  • Save 825i/965c939383e6bc89cd8a25c93bb204d6 to your computer and use it in GitHub Desktop.
Save 825i/965c939383e6bc89cd8a25c93bb204d6 to your computer and use it in GitHub Desktop.
Hide Migaku Extension GrabbyTabby on asbplayer's website
// ==UserScript==
// @name Hide Migaku GrabbyTabby
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Hides the Migaku GrabbyTabby on asbplayer page
// @author You
// @match https://killergerbah.github.io/asbplayer/*
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
// CSS to hide the ToolbarGrabbyTabby
const hideToolbarCSS = `
.ToolbarGrabbyTabby__wrapper {
display: none !important;
}
`;
// Function to inject the style into the shadow DOM
function injectStyleToShadowDOM() {
const migakuShadowDom = document.getElementById('MigakuShadowDom');
if (migakuShadowDom && migakuShadowDom.shadowRoot) {
const style = document.createElement('style');
style.id = 'migaku-toolbar-hider';
style.textContent = hideToolbarCSS;
migakuShadowDom.shadowRoot.appendChild(style);
return true;
}
return false;
}
// Use MutationObserver to detect when the shadow DOM is added to the page
const observer = new MutationObserver((mutations) => {
for (const mutation of mutations) {
if (mutation.addedNodes) {
for (const node of mutation.addedNodes) {
if (node.id === 'MigakuShadowDom') {
// Wait a brief moment for the shadow DOM to be fully initialized
setTimeout(() => {
if (injectStyleToShadowDOM()) {
observer.disconnect(); // Stop observing once we've injected the style
}
}, 100);
}
}
}
}
});
// Start observing the document body for changes
observer.observe(document.body, { childList: true, subtree: true });
// Try to inject immediately in case the element already exists
if (injectStyleToShadowDOM()) {
observer.disconnect();
}
})();
@825i
Copy link
Author

825i commented Mar 24, 2025

Add additional URLs to line 7:

/ @match        https://killergerbah.github.io/asbplayer/*

That you want the script to work on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment