Discussions » Creation Requests

csdn标题消息能完全去掉吗

§
Posted: 2021-12-19

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

§
Posted: 2021-12-21

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
§
Posted: 2021-12-21

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.

§
Posted: 2021-12-22

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(){}

Post reply

Sign in to post a reply.