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