mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-08-24 14:31:36 +12:00
This commit is contained in:
parent
eeb890000b
commit
aafb85c6c6
1 changed files with 18 additions and 7 deletions
|
@ -472,18 +472,29 @@ var collapser = (function() {
|
||||||
meta.parentNode.removeChild(meta);
|
meta.parentNode.removeChild(meta);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var morphNoscript = function(from) {
|
||||||
|
if ( document instanceof XMLDocument ) {
|
||||||
|
var to = document.createElement('span');
|
||||||
|
while ( from.firstChild !== null ) {
|
||||||
|
to.appendChild(from.firstChild);
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
var parser = new DOMParser();
|
||||||
|
var doc = parser.parseFromString(
|
||||||
|
'<span>' + from.textContent + '</span>',
|
||||||
|
'text/html'
|
||||||
|
);
|
||||||
|
return document.adoptNode(doc.querySelector('span'));
|
||||||
|
};
|
||||||
|
|
||||||
var renderNoscriptTags = function(response) {
|
var renderNoscriptTags = function(response) {
|
||||||
if ( response !== true ) { return; }
|
if ( response !== true ) { return; }
|
||||||
var parser = new DOMParser();
|
var parent, span;
|
||||||
var doc, parent, span;
|
|
||||||
for ( var noscript of noscripts ) {
|
for ( var noscript of noscripts ) {
|
||||||
parent = noscript.parentNode;
|
parent = noscript.parentNode;
|
||||||
if ( parent === null ) { continue; }
|
if ( parent === null ) { continue; }
|
||||||
doc = parser.parseFromString(
|
span = morphNoscript(noscript);
|
||||||
'<span>' + noscript.textContent + '</span>',
|
|
||||||
'text/html'
|
|
||||||
);
|
|
||||||
span = document.adoptNode(doc.querySelector('span'));
|
|
||||||
span.style.setProperty('display', 'inline', 'important');
|
span.style.setProperty('display', 'inline', 'important');
|
||||||
if ( redirectTimer === undefined ) {
|
if ( redirectTimer === undefined ) {
|
||||||
autoRefresh(span);
|
autoRefresh(span);
|
||||||
|
|
Loading…
Reference in a new issue