Conversaciones » Peticiones de scripts

csdn标题消息能完全去掉吗

§
Publicado: 19/12/2021

用每100ms检查标题去掉的办法,会不停的闪,不能完全去除

§
Publicado: 21/12/2021

Use:

.class-of-this-element{display: none}; // elem.style.display = 'none'

or

let observer = new MutationObserver(mutationRecords => {
mutationRecords.forEach( (record)=>{
record.addedNodes( (node)=> {
if (node.classList.includes('your-element-class')) node.parentNode.removeChild(node);
} )
} )
});

observer.observe(document, {
childList: true,
subtree: true
});

NEVER use setInterval like this
§
Publicado: 21/12/2021

Use:

Thank you for your replay.

What I mean is that to forbid auto-add '(2 new messages)' in the title from some site, instead of delete some element of a website.

§
Publicado: 22/12/2021

If you want to forbid the auto adding, I think you need to redefine appendChild method of the parent node (it will work only if this element adding to parent by this method).

element.parentNode.appendChild = function(){}

Publicar respuesta

Inicia sesión para responder.