domains/verdict.co.uk.js
[app.webkitpdf] / domains / verdict.co.uk.js
1
2 (function (args) {
3     
4     
5     
6     var i;
7     var del = [];
8     for (var ss = 0; ss < document.styleSheets.length; ss++) {
9         var css =document.styleSheets[ss];
10         console.log("sheet " + ss + '/' + document.styleSheets.length + ": " + css.ownerNode.outerHTML) ;
11         
12         var node = css.ownerNode;
13         
14         if (node.nodeName == 'STYLE' && node.getAttribute('media') && node.getAttribute('media').match(/print/)) {
15             node.innerHTML = '';
16             continue;
17         }
18         if (node.nodeName == 'LINK' && node.getAttribute('media') && node.getAttribute('media').match(/print/)) {
19             node.setAttribute('href' , '');
20             node.setAttribute('media' , 'speech');
21             continue;
22         }
23         
24         // now we are dealing with non-print styles...
25         try {
26             var ar = document.styleSheets[ss].rules;
27         } catch(e) {
28             console.log("could not access stylesheet:" + ss);
29             continue;
30         }
31         if (!ar) {
32             del.push(node);
33             continue;
34         }
35         
36         var newsheet = '';
37         
38         
39         for(i=0; i < ar.length; i++){
40             if(ar[i].cssText.indexOf("@media") < 0 ) {
41                 newsheet += ar[i].cssText +"\n";
42                 continue;
43             }
44             //console.log(ar[i].cssText);
45             if(ar[i].cssText.match(/@media\s+print/)) {
46                 continue;
47             }
48             
49             
50             // see if getting rid of 'only' from screen works.
51             if(ar[i].cssText.match(/only\s+screen/)) {
52                 var str = ar[i].cssText.replace(/only\s+screen/, '');
53                 newsheet += str +"\n";
54                 continue;   
55             }
56             if(ar[i].cssText.match(/screen\s+and/)) {
57                 var str = ar[i].cssText.replace(/screen\s+and/, '');
58                 newsheet += str +"\n";
59                 continue;   
60             }
61             newsheet += ar[i].cssText +"\n";
62                 
63             
64             
65             
66         }
67         
68         
69         if (node.nodeName == 'STYLE' ) {
70             node.innerHTML = newsheet;
71             continue;
72         }
73         var newnode = document.createElement('STYLE');
74         newnode.innerHTML = newsheet;
75         node.parentNode.replaceChild(newnode,node);
76         
77     
78     }
79     for(i = 0; i < del.length;i++) {
80         del[i].parentNode.removeChild(del[i]);
81     }
82
83     
84     
85
86     
87     window.setInterval(function() {
88         try {
89             document.body.style.display = "relative";
90             var e = document.getElementById('cookiepopup');e.parentNode.removeChild(e);
91             e = document.getElementById('wrapper');e.className = '';
92         } catch(e) {}
93     },200);
94     
95 })();