Here's my config:
"content_scripts": [
{
"matches": ["https://www.baidu.com/"],
"js": ["./baidu/baidu.js"]
}
]
And here's my baidu.js
// #region delete useless DOM
const deleteIdList = [
'#s_top_wrap',
'#bottom_layer',
'#lm-new',
'#s-top-left',
'#u1',
'#s-hotsearch-wrapper',
'#s_side_wrapper'
];
deleteIdList.forEach(v => {
const element = document.querySelector(v);
element.style.display = 'none';
// element.parentNode.removeChild(element);
});
All I want is very simple, I just hope when I visit the baidu.com
, the useless dom can be remove(or hide). My problem is as my config works, but the useless dom will flash in the beginning. Then those disappears. I hope when I see the web, everything's ok.
I've tried to specify the attribute run_at
as document_start
. Then my js file do not works.
How can I make it ? (Tested in FireFox browser)