inliner.js
[app.webkitpdf] / inliner.js
1
2
3
4 (function(){
5     
6     //var camelize = function(a,b){
7     //    return b.toUpperCase();
8     //}
9     
10     var fillStyle = function(dom)
11     {
12          
13         console.log(dom.nodeName);
14         
15         var style = window.getComputedStyle(dom, null);
16         if (style.display == 'none') {
17             dom.parentElement.removeChild(dom);
18             return;
19         }
20         
21         for(var i=0;i<style.length;i++){
22             var prop = style[i];
23             //var camel = prop.replace(/\-([a-z])/g, camelize);
24             var val = style.getPropertyValue(prop);
25             //returns[camel] = val;
26             dom.style[prop] = val;
27         }
28         for (var i = dom.childNodes.length -1; i--; i> -1) {
29             fillStyle(dom.childNodes[i]);
30         }
31         
32         
33         //return returns;
34     }
35     var el = document.querySelector('body');
36     fillStyle(el);
37     
38     var matches = document.getElementsByTagName('style');
39     for(var i =0;i < matches.length;i++) {
40         matches[i].parentElement.removeChild(matches[i]);
41     }
42     
43      
44     
45 })();