-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcontent.js
More file actions
24 lines (20 loc) · 603 Bytes
/
content.js
File metadata and controls
24 lines (20 loc) · 603 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(function() {
const noscriptTags = document.querySelectorAll('noscript');
noscriptTags.forEach((tag) => {
if (tag.firstChild) {
const newDiv = document.createElement('div'),
parser = new DOMParser();
if (tag.childNodes.length === 1) {
const parsedDOM = parser.parseFromString(tag.childNodes[0].textContent, 'text/html');
parsedDOM.body.childNodes.forEach((child) => {
newDiv.appendChild(child);
});
} else {
tag.childNodes.forEach((child) => {
newDiv.appendChild(child);
});
}
tag.parentNode.replaceChild(newDiv, tag);
}
})
})();