油猴脚本在html之前运⾏,javascript–在页⾯加载之前运⾏
Tampermonkey脚本
需要:
> @run-at: document-start in usercript metablock.
// ==UserScript==
..............
// @run-at document-start
..............
// ==/UserScript==
现在有了上述选项,您可以:
>只需注⼊隐藏徽标的样式:
(document.head || document.documentElement).insertAdjacentHTML('beforeend',
'');
如何下载javascript>使⽤MutationObserver在元素添加到DOM后⽴即检测并删除元素.
new MutationObserver(function(mutations) {
// check at least two H1 exist using the extremely fast getElementsByTagName
// which is faster than enumerating all the added nodes in mutations
if (ElementsByTagName('h1')[1]) {
var ibmlogo = document.querySelectorAll('h1.logo.floatLeft')[1];
if (ibmlogo) {
this.disconnect(); // disconnect the observer
}
}
}).observe(document, {childList: true, subtree: true});
// the above observes added/removed nodes on all descendants recursively

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。