3 * could this work by findind all the visible text,
4 * then making them hidden..
6 * -- make a snapshot of the background..
8 * -- delete the whole page...
9 * -- show the image as the background.
10 * -- then overlay all the text given their calculated positions..
19 var camelize = function(a,b){
20 return b.toUpperCase();
25 var fillStyle = function(dom, pstyle)
27 if (!dom || dom.nodeType != 1) {
28 //console.log("SKIP: " + dom.nodeName);
31 //console.log(dom.nodeName);
33 var style = window.getComputedStyle(dom, null);
34 if (style.display == 'none' || dom.nodeName == "NOSCRIPT" || dom.nodeName == "SCRIPT" ) {
35 dom.parentElement.removeChild(dom);
40 if (dom.childNodes.length > 100) {
42 throw "too many child nodes?" + dom.childNodes.length ;
44 for (var i = 0;i < dom.childNodes.length;i++) {
45 cn.push(dom.childNodes[i]);
48 if (cn.length > 100) {
50 throw "too many child nodes? cn";
52 for (var i = 0;i < cn.length;i++) {
54 //console.log( i + ':'+ cn[i].nodeName);
55 fillStyle(cn[i], style);
60 //if (dom.nodeName != 'BODY') {
61 // pstyle = window.getComputedStyle(dom.parentElement, null);
64 if (dom.nodeName == 'SPAM') {
65 pstyle = false; //?? others??
68 //if (dom.nodeName == 'LI') { throw 'done'; }
71 for(var i=0;i<style.length;i++){
73 var camel = prop.replace(/\-([a-z])/g, camelize);
74 var val = style.getPropertyValue(prop);
75 //returns[camel] = val;
77 // idea... if the parent has the same style.. then do not apply it to the child?
78 if (pstyle && pstyle[prop] == val) {
81 //console.log(prop + '=' + val);
83 dom.style[camel] = val;
87 var es = dom.getAttribute('style');
88 //console.log(dom.nodeName + '::' + es);
89 dom.setAttribute('style', es);
97 var el = document.querySelector('body');
100 var matches = document.getElementsByTagName('style');
102 for(var i =0;i < matches.length;i++) {
106 var matches = document.getElementsByTagName('link');
107 for(var i =0;i < matches.length;i++) {
110 for(var i =0 ; i < rm.length;i++) {
111 rm[i].parentNode.removeChild(rm[i]);