From e9244c9407a28bc81a095869f081c702868ab6a7 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 13 Jul 2018 12:03:55 +0800 Subject: [PATCH] domains/verdict.co.uk.js --- domains/verdict.co.uk.js | 87 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/domains/verdict.co.uk.js b/domains/verdict.co.uk.js index 0c24418..e59bdb2 100644 --- a/domains/verdict.co.uk.js +++ b/domains/verdict.co.uk.js @@ -1,9 +1,94 @@ (function (args) { + + + + var i; + var del = []; + for (var ss = 0; ss < document.styleSheets.length; ss++) { + var css =document.styleSheets[ss]; + console.log("sheet " + ss + '/' + document.styleSheets.length + ": " + css.ownerNode.outerHTML) ; + + var node = css.ownerNode; + + if (node.nodeName == 'STYLE' && node.getAttribute('media') && node.getAttribute('media').match(/print/)) { + node.innerHTML = ''; + continue; + } + if (node.nodeName == 'LINK' && node.getAttribute('media') && node.getAttribute('media').match(/print/)) { + node.setAttribute('href' , ''); + node.setAttribute('media' , 'speech'); + continue; + } + + // now we are dealing with non-print styles... + try { + var ar = document.styleSheets[ss].rules; + } catch(e) { + console.log("could not access stylesheet:" + ss); + continue; + } + if (!ar) { + del.push(node); + continue; + } + + var newsheet = ''; + + + for(i=0; i < ar.length; i++){ + if(ar[i].cssText.indexOf("@media") < 0 ) { + newsheet += ar[i].cssText +"\n"; + continue; + } + //console.log(ar[i].cssText); + if(ar[i].cssText.match(/@media\s+print/)) { + continue; + } + + + // see if getting rid of 'only' from screen works. + if(ar[i].cssText.match(/only\s+screen/)) { + var str = ar[i].cssText.replace(/only\s+screen/, ''); + newsheet += str +"\n"; + continue; + } + if(ar[i].cssText.match(/screen\s+and/)) { + var str = ar[i].cssText.replace(/screen\s+and/, ''); + newsheet += str +"\n"; + continue; + } + newsheet += ar[i].cssText +"\n"; + + + + + } + + + if (node.nodeName == 'STYLE' ) { + node.innerHTML = newsheet; + continue; + } + var newnode = document.createElement('STYLE'); + newnode.innerHTML = newsheet; + node.parentNode.replaceChild(newnode,node); + + + } + for(i = 0; i < del.length;i++) { + del[i].parentNode.removeChild(del[i]); + } + + + + + window.setInterval(function() { try { document.body.style.display = "relative"; - var e = document.getElementById('cookiepopup')[0];e.parentNode.removeChild(e); + var e = document.getElementById('cookiepopup');e.parentNode.removeChild(e); + e = document.getElementById('wrapper');e.className = ''; } catch(e) {} },200); -- 2.39.2