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