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         if (!dom || dom.nodeType != 1) {
13             return;
14         }
15         console.log(dom.nodeName);
16         
17         var style = window.getComputedStyle(dom, null);
18         if (style.display == 'none') {
19             dom.parentElement.removeChild(dom);
20             return;
21         }
22         
23         for(var i=0;i<style.length;i++){
24             var prop = style[i];
25             //var camel = prop.replace(/\-([a-z])/g, camelize);
26             var val = style.getPropertyValue(prop);
27             //returns[camel] = val;
28             dom.style[prop] = val;
29         }
30         for (var i = dom.childNodes.length -1; i--; i> -1) {
31             fillStyle(dom.childNodes[i]);
32         }
33         
34         
35         //return returns;
36     }
37     var el = document.querySelector('body');
38     fillStyle(el);
39     
40     //var matches = document.getElementsByTagName('style');
41     //for(var i =0;i < matches.length;i++) {
42     //    matches[i].parentElement.removeChild(matches[i]);
43     //}
44     
45      
46     
47 })();