Created
October 14, 2023 13:47
-
-
Save fishyer/165bdfe8b067bd19f8abc90a5c261b4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 监听网页元素-五彩标注 | |
// @namespace your-namespace | |
// @version 1.0 | |
// @description 当匹配到以后,就修改五彩标注的样式 | |
// @match *://*/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const observer = new MutationObserver((mutations, observer) => { | |
mutations.forEach(mutation => { | |
if (mutation.type === 'childList') { | |
for (const addedNode of mutation.addedNodes) { | |
if (addedNode instanceof HTMLElement && addedNode.id === 'wuCaiPN6-defaultColor-button-id') { | |
const childElement = addedNode.querySelector('.wuCaiPN6-small-color-point'); | |
if (childElement) { | |
childElement.style.marginTop = '0'; | |
childElement.style.width = '60px'; | |
childElement.style.height = '60px'; | |
} | |
} | |
} | |
} | |
}); | |
}); | |
observer.observe(document.documentElement, { childList: true, subtree: true,attributes: true, attributeFilter: ['style'] }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment