From f1f15bb92ddc21672cab882ddeaa158844986ca9 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Mon, 18 Jul 2011 13:20:04 +0300 Subject: [PATCH] rebuilt source --- build/html2canvas.js | 270 +++++++++++++++++++++++++++++---------- build/html2canvas.min.js | 47 +++---- 2 files changed, 227 insertions(+), 90 deletions(-) diff --git a/build/html2canvas.js b/build/html2canvas.js index 498f245..6367652 100644 --- a/build/html2canvas.js +++ b/build/html2canvas.js @@ -46,7 +46,9 @@ function html2canvas(el, userOptions) { iframeDefault: "default", flashCanvasPath: "http://html2canvas.hertzen.com/external/flashcanvas/flashcanvas.js", renderViewport: false, - reorderZ: true + reorderZ: true, + throttle:true, + renderOrder: "canvas flash html" }); this.element = el; @@ -65,20 +67,44 @@ function html2canvas(el, userOptions) { this.ignoreElements = "IFRAME|OBJECT|PARAM"; this.needReorder = false; this.blockElements = new RegExp("(BR|PARAM)"); - + this.ignoreRe = new RegExp("("+this.ignoreElements+")"); - // test how to measure text bounding boxes - this.useRangeBounds = false; - // Check disabled as Opera doesn't provide bounds.height/bottom even though it supports the method. - // TODO take the check back into use, but fix the issue for Opera - /* + this.support = { + rangeBounds: false + + }; + + // Test whether we can use ranges to measure bounding boxes + // Opera doesn't provide valid bounds.height/bottom even though it supports the method. + + if (document.createRange){ var r = document.createRange(); - this.useRangeBounds = new Boolean(r.getBoundingClientRect); - }*/ + //this.support.rangeBounds = new Boolean(r.getBoundingClientRect); + if (r.getBoundingClientRect){ + var testElement = document.createElement('boundtest'); + testElement.style.height = "123px"; + testElement.style.display = "block"; + document.getElementsByTagName('body')[0].appendChild(testElement); + + r.selectNode(testElement); + var rangeBounds = r.getBoundingClientRect(); + var rangeHeight = rangeBounds.height; + + if (rangeHeight==123){ + this.support.rangeBounds = true; + } + document.getElementsByTagName('body')[0].removeChild(testElement); + + + } + + } + + // Start script this.init(); @@ -91,7 +117,7 @@ function html2canvas(el, userOptions) { html2canvas.prototype.init = function(){ var _ = this; - + /* this.ctx = new this.stackingContext($(document).width(),$(document).height()); if (!this.ctx){ @@ -101,7 +127,7 @@ html2canvas.prototype.init = function(){ } this.canvas = this.ctx.canvas; - + */ this.log('Finding background images'); this.getImages(this.element); @@ -129,25 +155,23 @@ html2canvas.prototype.start = function(){ this.log('Started parsing'); this.bodyOverflow = document.getElementsByTagName('body')[0].style.overflow; document.getElementsByTagName('body')[0].style.overflow = "hidden"; - - var stack = this.newElement(this.element,{ - ctx:this.ctx, - opacity:this.getCSS(this.element,"opacity") + var rootStack = new this.storageContext($(document).width(),$(document).height()); + rootStack.opacity = this.getCSS(this.element,"opacity"); + var stack = this.newElement(this.element,rootStack); - }) || this.ctx; + + this.parseElement(this.element,stack); } - - this.parseElement(this.element,stack); - + } html2canvas.prototype.stackingContext = function(width,height){ this.canvas = document.createElement('canvas'); - // TODO remove jQuery dependency - this.canvas.width = $(document).width(); - this.canvas.height = $(document).height(); + + this.canvas.width = width; + this.canvas.height = width; if (!this.canvas.getContext){ @@ -178,8 +202,9 @@ html2canvas.prototype.stackingContext = function(width,height){ html2canvas.prototype.storageContext = function(width,height){ this.storage = []; - - + this.width = width; + this.height = height; + //this.zIndex; // todo simplify this whole section this.fillRect = function(x, y, w, h){ @@ -221,9 +246,11 @@ html2canvas.prototype.storageContext = function(width,height){ */ html2canvas.prototype.finish = function(){ - this.log("Finished rendering"); - document.getElementsByTagName('body')[0].style.overflow = this.bodyOverflow; + this.log("Finished rendering"); + + document.getElementsByTagName('body')[0].style.overflow = this.bodyOverflow; + /* if (this.opts.renderViewport){ // let's crop it to viewport only then var newCanvas = document.createElement('canvas'); @@ -231,7 +258,7 @@ html2canvas.prototype.finish = function(){ newCanvas.width = window.innerWidth; newCanvas.height = window.innerHeight; - } + }*/ this.opts.ready(this); } @@ -343,8 +370,8 @@ html2canvas.prototype.backgroundImageUrl = function(src){ */ html2canvas.prototype.getBackgroundPosition = function(el,bounds,image){ - - var bgposition = this.getCSS(el,"background-position").split(" "), + var bgpos = this.getCSS(el,"backgroundPosition") || "0 0"; + var bgposition = bgpos.split(" "), top, left, percentage; @@ -475,44 +502,13 @@ html2canvas.prototype.getBorderData = function(el){ } - - - -html2canvas.prototype.newElement = function(el,parentStack){ - - var bounds = this.getBounds(el); - - var x = bounds.left; - var y = bounds.top; - var w = bounds.width; - var h = bounds.height; - var _ = this, - image; - var bgcolor = this.getCSS(el,"background-color"); - - var zindex = this.formatZ(this.getCSS(el,"z-index"),this.getCSS(el,"position"),parentStack.zIndex,el.parentNode); +html2canvas.prototype.drawBorders = function(el,ctx, x, y, w, h){ - //console.log(el.nodeName+":"+zindex+":"+this.getCSS(el,"position")+":"+this.numDraws+":"+this.getCSS(el,"z-index")) - - var opacity = this.getCSS(el,"opacity"); - - - var stack = { - ctx: new this.storageContext(), - zIndex: zindex, - opacity: opacity*parentStack.opacity - }; - - var stackLength = this.contextStacks.push(stack); - - var ctx = this.contextStacks[stackLength-1].ctx; - - this.setContextVariable(ctx,"globalAlpha",stack.opacity); - /* * TODO add support for different border-style's than solid */ var borders = this.getBorderData(el); + var _ = this; this.each(borders,function(borderSide,borderData){ if (borderData.width>0){ @@ -548,9 +544,53 @@ html2canvas.prototype.newElement = function(el,parentStack){ } }); + + return borders; + +}; + + +html2canvas.prototype.newElement = function(el,parentStack){ + + var bounds = this.getBounds(el); + + var x = bounds.left; + var y = bounds.top; + var w = bounds.width; + var h = bounds.height; + var _ = this, + image; + var bgcolor = this.getCSS(el,"background-color"); + + + parentStack = parentStack || {}; + + var zindex = this.formatZ(this.getCSS(el,"zIndex"),this.getCSS(el,"position"),parentStack.zIndex,el.parentNode); + + //console.log(el.nodeName+":"+zindex+":"+this.getCSS(el,"position")+":"+this.numDraws+":"+this.getCSS(el,"z-index")) + + var opacity = this.getCSS(el,"opacity"); + + + var stack = { + ctx: new this.storageContext(), + zIndex: zindex, + opacity: opacity*parentStack.opacity + }; + + var stackLength = this.contextStacks.push(stack); + + var ctx = this.contextStacks[stackLength-1].ctx; + + this.setContextVariable(ctx,"globalAlpha",stack.opacity); + + // draw element borders + var borders = this.drawBorders(el, ctx, bounds.left, bounds.top, bounds.width, bounds.height); + + if (this.ignoreRe.test(el.nodeName) && this.opts.iframeDefault != "transparent"){ if (this.opts.iframeDefault=="default"){ bgcolor = "#efefef"; @@ -687,7 +727,7 @@ html2canvas.prototype.getImages = function(el) { html2canvas.prototype.loadImage = function(src){ - var imgIndex = this.images.indexOf(src); + var imgIndex = this.getIndex(this.images,src); if (imgIndex!=-1){ return this.images[imgIndex+1]; }else{ @@ -697,10 +737,13 @@ html2canvas.prototype.loadImage = function(src){ } + + html2canvas.prototype.preloadImage = function(src){ - - if (this.images.indexOf(src)==-1){ + + + if (this.getIndex(this.images,src)==-1){ this.images.push(src); var img = new Image(); @@ -723,13 +766,90 @@ html2canvas.prototype.preloadImage = function(src){ } +html2canvas.prototype.Renderer = function(queue){ + + var _ = this; + + this.each(this.opts.renderOrder.split(" "),function(i,renderer){ + + switch(renderer){ + case "canvas": + _.canvas = document.createElement('canvas'); + if (_.canvas.getContext){ + _.canvasRenderer(queue); + return false; + } + break; + case "flash": + /* + var script = document.createElement('script'); + script.type = "text/javascript"; + script.src = _.opts.flashCanvasPath; + var s = document.getElementsByTagName('script')[0]; + s.parentNode.insertBefore(script, s); + + + if (typeof FlashCanvas != "undefined") { + _.canvas = document.createElement('canvas'); + FlashCanvas.initElement(_.canvas); + _.canvasRenderer(queue); + return false; + } */ + + break; + + + } + + + + }); + +// this.canvasRenderer(queue); + +/* + if (!this.canvas.getContext){ + + + }*/ +// TODO include Flashcanvas +/* + var script = document.createElement('script'); + script.type = "text/javascript"; + script.src = this.opts.flashCanvasPath; + var s = document.getElementsByTagName('script')[0]; + s.parentNode.insertBefore(script, s); + + if (typeof FlashCanvas != "undefined") { + + FlashCanvas.initElement(this.canvas); + this.ctx = this.canvas.getContext('2d'); + } */ + +} + + html2canvas.prototype.canvasRenderer = function(queue){ var _ = this; queue = this.sortQueue(queue); + + + + + this.canvas.width = $(document).width(); + this.canvas.height = $(document).height(); + + this.ctx = this.canvas.getContext("2d"); + + // set common settings for canvas + this.ctx.textBaseline = "bottom"; + + + this.each(queue,function(i,storageContext){ if (storageContext.ctx.storage){ @@ -884,7 +1004,7 @@ html2canvas.prototype.newText = function(el,textNode,ctx){ for(var c=0;ce+d?e+d-d:g.height,d0&&(a.top+=f),d=Math.floor(d+g.height)-f}else this.log("Error loading background:"+d)}}; html2canvas.prototype.backgroundImageUrl=function(a){a.substr(0,5)=='url("'?(a=a.substr(5),a=a.substr(0,a.length-2)):(a=a.substr(4),a=a.substr(0,a.length-1));return a}; -html2canvas.prototype.getBackgroundPosition=function(a,b,c){var a=this.getCSS(a,"background-position").split(" "),d,e;a.length==1&&(d=a,a=[],a[0]=d,a[1]=d);a[0].toString().indexOf("%")!=-1?(e=parseFloat(a[0])/100,d=b.width*e-c.width*e):d=parseInt(a[0],10);a[1].toString().indexOf("%")!=-1?(e=parseFloat(a[1])/100,b=b.height*e-c.height*e):b=parseInt(a[1],10);return{top:b,left:d}}; -html2canvas.prototype.drawbackgroundRepeatY=function(a,b,c,d,e,g,f){var i=Math.min(b.width,g),h;c.top-=Math.ceil(c.top/b.height)*b.height;for(h=e+c.top;hf+e?f+e-h:b.height,this.drawBackgroundRepeat(a,b,d+c.left,h,i,g,d,e),h=Math.floor(h+b.height)}; -html2canvas.prototype.drawbackgroundRepeatX=function(a,b,c,d,e,g,f){var f=Math.min(b.height,f),i,h;c.left-=Math.ceil(c.left/b.width)*b.width;for(h=d+c.left;hg+d?g+d-h:b.width,this.drawBackgroundRepeat(a,b,h,e+c.top,i,f,d,e),h=Math.floor(h+b.width)};html2canvas.prototype.drawBackgroundRepeat=function(a,b,c,d,e,g,f,i){var h=0,k=0;f-c>0&&(h=f-c);i-d>0&&(k=i-d);this.drawImage(a,b,h,k,e-h,g-k,c+h,d+k,e-h,g-k)}; +html2canvas.prototype.getBackgroundPosition=function(a,b,c){var a=(this.getCSS(a,"backgroundPosition")||"0 0").split(" "),d,e;a.length==1&&(d=a,a=[],a[0]=d,a[1]=d);a[0].toString().indexOf("%")!=-1?(e=parseFloat(a[0])/100,d=b.width*e-c.width*e):d=parseInt(a[0],10);a[1].toString().indexOf("%")!=-1?(e=parseFloat(a[1])/100,b=b.height*e-c.height*e):b=parseInt(a[1],10);return{top:b,left:d}}; +html2canvas.prototype.drawbackgroundRepeatY=function(a,b,c,d,e,g,f){var k=Math.min(b.width,g),h;c.top-=Math.ceil(c.top/b.height)*b.height;for(h=e+c.top;hf+e?f+e-h:b.height,this.drawBackgroundRepeat(a,b,d+c.left,h,k,g,d,e),h=Math.floor(h+b.height)}; +html2canvas.prototype.drawbackgroundRepeatX=function(a,b,c,d,e,g,f){var f=Math.min(b.height,f),k,h;c.left-=Math.ceil(c.left/b.width)*b.width;for(h=d+c.left;hg+d?g+d-h:b.width,this.drawBackgroundRepeat(a,b,h,e+c.top,k,f,d,e),h=Math.floor(h+b.width)};html2canvas.prototype.drawBackgroundRepeat=function(a,b,c,d,e,g,f,k){var h=0,j=0;f-c>0&&(h=f-c);k-d>0&&(j=k-d);this.drawImage(a,b,h,j,e-h,g-j,c+h,d+j,e-h,g-j)}; html2canvas.prototype.getBorderData=function(a){var b=[],c=this;this.each(["top","right","bottom","left"],function(d,e){b.push({width:parseInt(c.getCSS(a,"border-"+e+"-width"),10),color:c.getCSS(a,"border-"+e+"-color")})});return b}; -html2canvas.prototype.newElement=function(a,b){var c=this.getBounds(a),d=c.left,e=c.top,g=c.width,f=c.height,i=this,h;h=this.getCSS(a,"background-color");var k=this.formatZ(this.getCSS(a,"z-index"),this.getCSS(a,"position"),b.zIndex,a.parentNode),l=this.getCSS(a,"opacity"),l={ctx:new this.storageContext,zIndex:k,opacity:l*b.opacity},k=this.contextStacks.push(l),m=this.contextStacks[k-1].ctx;this.setContextVariable(m,"globalAlpha",l.opacity);var j=this.getBorderData(a);this.each(j,function(a,b){if(b.width> -0){var c=d,h=e,k=g,l=f-j[2].width;switch(a){case 0:l=j[0].width;break;case 1:c=d+g-j[1].width;k=j[1].width;break;case 2:h=h+f-j[2].width;l=j[2].width;break;case 3:k=j[3].width}i.newRect(m,c,h,k,l,b.color)}});this.ignoreRe.test(a.nodeName)&&this.opts.iframeDefault!="transparent"&&(h=this.opts.iframeDefault=="default"?"#efefef":this.opts.iframeDefault);this.newRect(m,d+j[3].width,e+j[0].width,g-(j[1].width+j[3].width),f-(j[0].width+j[2].width),h);this.drawBackground(a,{left:d+j[3].width,top:e+j[0].width, -width:g-(j[1].width+j[3].width),height:f-(j[0].width+j[2].width)},m);a.nodeName=="IMG"&&((h=i.loadImage(i.getAttr(a,"src")))?this.drawImage(m,h,0,0,h.width,h.height,d+parseInt(i.getCSS(a,"padding-left"),10)+j[3].width,e+parseInt(i.getCSS(a,"padding-top"),10)+j[0].width,c.width-(j[1].width+j[3].width+parseInt(i.getCSS(a,"padding-left"),10)+parseInt(i.getCSS(a,"padding-right"),10)),c.height-(j[0].width+j[2].width+parseInt(i.getCSS(a,"padding-top"),10)+parseInt(i.getCSS(a,"padding-bottom"),10))):this.log("Error loading :"+ -i.getAttr(a,"src")));return this.contextStacks[k-1]};html2canvas.prototype.printText=function(a,b,c,d){this.trim(a).length>0&&(d.fillText(a,b,c),this.numDraws++)};html2canvas.prototype.newRect=function(a,b,c,d,e,g){g!="transparent"&&(this.setContextVariable(a,"fillStyle",g),a.fillRect(b,c,d,e),this.numDraws++)};html2canvas.prototype.drawImage=function(a,b,c,d,e,g,f,i,h,k){a.drawImage(b,c,d,e,g,f,i,h,k);this.numDraws++}; +html2canvas.prototype.drawBorders=function(a,b,c,d,e,g){var f=this.getBorderData(a),k=this;this.each(f,function(a,j){if(j.width>0){var i=c,l=d,m=e,n=g-f[2].width;switch(a){case 0:n=f[0].width;break;case 1:i=c+e-f[1].width;m=f[1].width;break;case 2:l=l+g-f[2].width;n=f[2].width;break;case 3:m=f[3].width}k.newRect(b,i,l,m,n,j.color)}});return f}; +html2canvas.prototype.newElement=function(a,b){var c=this.getBounds(a),d=c.left,e=c.top,g=c.width,f=c.height,k=this.getCSS(a,"background-color"),b=b||{},h=this.formatZ(this.getCSS(a,"zIndex"),this.getCSS(a,"position"),b.zIndex,a.parentNode),j=this.getCSS(a,"opacity"),i={ctx:new this.storageContext,zIndex:h,opacity:j*b.opacity},h=this.contextStacks.push(i),j=this.contextStacks[h-1].ctx;this.setContextVariable(j,"globalAlpha",i.opacity);i=this.drawBorders(a,j,c.left,c.top,c.width,c.height);this.ignoreRe.test(a.nodeName)&& +this.opts.iframeDefault!="transparent"&&(k=this.opts.iframeDefault=="default"?"#efefef":this.opts.iframeDefault);this.newRect(j,d+i[3].width,e+i[0].width,g-(i[1].width+i[3].width),f-(i[0].width+i[2].width),k);this.drawBackground(a,{left:d+i[3].width,top:e+i[0].width,width:g-(i[1].width+i[3].width),height:f-(i[0].width+i[2].width)},j);a.nodeName=="IMG"&&((g=this.loadImage(this.getAttr(a,"src")))?this.drawImage(j,g,0,0,g.width,g.height,d+parseInt(this.getCSS(a,"padding-left"),10)+i[3].width,e+parseInt(this.getCSS(a, +"padding-top"),10)+i[0].width,c.width-(i[1].width+i[3].width+parseInt(this.getCSS(a,"padding-left"),10)+parseInt(this.getCSS(a,"padding-right"),10)),c.height-(i[0].width+i[2].width+parseInt(this.getCSS(a,"padding-top"),10)+parseInt(this.getCSS(a,"padding-bottom"),10))):this.log("Error loading :"+this.getAttr(a,"src")));return this.contextStacks[h-1]};html2canvas.prototype.printText=function(a,b,c,d){this.trim(a).length>0&&(d.fillText(a,b,c),this.numDraws++)}; +html2canvas.prototype.newRect=function(a,b,c,d,e,g){g!="transparent"&&(this.setContextVariable(a,"fillStyle",g),a.fillRect(b,c,d,e),this.numDraws++)};html2canvas.prototype.drawImage=function(a,b,c,d,e,g,f,k,h,j){a.drawImage(b,c,d,e,g,f,k,h,j);this.numDraws++}; html2canvas.prototype.getImages=function(a){var b=this;this.ignoreRe.test(a.nodeName)||this.each($(a).contents(),function(a,d){RegExp("("+this.ignoreElements+")").test(d.nodeName)||b.getImages(d)});if(a.nodeType==1||typeof a.nodeType=="undefined")(a=this.getCSS(a,"background-image"))&&a!="1"&&a!="none"&&a.substring(0,7)!="-webkit"&&a.substring(0,4)!="-moz"&&this.preloadImage(this.backgroundImageUrl(a))}; -html2canvas.prototype.loadImage=function(a){a=this.images.indexOf(a);return a!=-1?this.images[a+1]:!1};html2canvas.prototype.preloadImage=function(a){if(this.images.indexOf(a)==-1){this.images.push(a);var b=new Image,c=this;$(b).load(function(){c.imagesLoaded++;c.start()});b.onerror=function(){c.images.splice(c.images.indexOf(b.src),2);c.imagesLoaded++;c.start()};b.src=a;this.images.push(b)}}; -html2canvas.prototype.canvasRenderer=function(a){var b=this,a=this.sortQueue(a);this.each(a,function(a,d){d.ctx.storage&&b.each(d.ctx.storage,function(a,c){switch(c.type){case "variable":b.ctx[c.name]=c.arguments;break;case "function":c.name=="fillRect"?b.ctx.fillRect(c.arguments[0],c.arguments[1],c.arguments[2],c.arguments[3]):c.name=="fillText"?b.ctx.fillText(c.arguments[0],c.arguments[1],c.arguments[2]):c.name=="drawImage"?b.ctx.drawImage(c.arguments[0],c.arguments[1],c.arguments[2],c.arguments[3], -c.arguments[4],c.arguments[5],c.arguments[6],c.arguments[7],c.arguments[8]):this.log(c)}})})}; +html2canvas.prototype.loadImage=function(a){a=this.getIndex(this.images,a);return a!=-1?this.images[a+1]:!1};html2canvas.prototype.preloadImage=function(a){if(this.getIndex(this.images,a)==-1){this.images.push(a);var b=new Image,c=this;$(b).load(function(){c.imagesLoaded++;c.start()});b.onerror=function(){c.images.splice(c.images.indexOf(b.src),2);c.imagesLoaded++;c.start()};b.src=a;this.images.push(b)}}; +html2canvas.prototype.Renderer=function(a){var b=this;this.each(this.opts.renderOrder.split(" "),function(c,d){switch(d){case "canvas":if(b.canvas=document.createElement("canvas"),b.canvas.getContext)return b.canvasRenderer(a),!1}})}; +html2canvas.prototype.canvasRenderer=function(a){var b=this,a=this.sortQueue(a);this.canvas.width=$(document).width();this.canvas.height=$(document).height();this.ctx=this.canvas.getContext("2d");this.ctx.textBaseline="bottom";this.each(a,function(a,d){d.ctx.storage&&b.each(d.ctx.storage,function(a,c){switch(c.type){case "variable":b.ctx[c.name]=c.arguments;break;case "function":c.name=="fillRect"?b.ctx.fillRect(c.arguments[0],c.arguments[1],c.arguments[2],c.arguments[3]):c.name=="fillText"?b.ctx.fillText(c.arguments[0], +c.arguments[1],c.arguments[2]):c.name=="drawImage"?b.ctx.drawImage(c.arguments[0],c.arguments[1],c.arguments[2],c.arguments[3],c.arguments[4],c.arguments[5],c.arguments[6],c.arguments[7],c.arguments[8]):this.log(c)}})})}; html2canvas.prototype.sortQueue=function(a){if(!this.opts.reorderZ||!this.needReorder)return a;var b=0;this.each(a,function(a,c){if(be.zIndex.length;)e.zIndex+="0";for(e.zIndex+=c;b+g+c.toString().length>e.zIndex.length;)e.zIndex+="0";c++});return a=a.sort(function(a,b){return a.zIndexb.zIndex?1:0})}; html2canvas.prototype.setContextVariable=function(a,b,c){a.storage?a.storage.push({type:"variable",name:b,arguments:c}):a[b]=c}; -html2canvas.prototype.newText=function(a,b,c){var d=this.getCSS(a,"font-family"),e=this.getCSS(a,"font-size"),g=this.getCSS(a,"color"),f=this.getCSS(a,"font-weight"),i=this.getCSS(a,"font-style"),h=this.getCSS(a,"font-variant"),k=this.getCSS(a,"text-decoration");b.nodeValue=this.textTransform(b.nodeValue,this.getCSS(a,"text-transform"));a=b.nodeValue;if(a.length>0){switch(f){case "401":f="bold"}if(k!="none")var l=this.fontMetrics(d,e);this.setContextVariable(c,"fillStyle",g);this.setContextVariable(c, -"font",h+" "+f+" "+i+" "+e+" "+d);for(d=0;d0){switch(f){case "401":f="bold"}if(j!="none")var i=this.fontMetrics(d,e);this.setContextVariable(c,"fillStyle",g);this.setContextVariable(c, +"font",h+" "+f+" "+k+" "+e+" "+d);for(d=0;d-1)return this.fontData[c+1];c=document.createElement("div");document.getElementsByTagName("body")[0].appendChild(c);$(c).css({visibility:"hidden",fontFamily:a,fontSize:b,margin:0,padding:0});var d=document.createElement("img");d.src="http://html2canvas.hertzen.com/images/8.jpg";d.width=1;d.height=1;$(d).css({margin:0,padding:0});var e=document.createElement("span");$(e).css({fontFamily:a,fontSize:b,margin:0, padding:0});e.appendChild(document.createTextNode("Hidden Text"));c.appendChild(e);c.appendChild(d);var g=d.offsetTop-e.offsetTop+1;c.removeChild(e);c.appendChild(document.createTextNode("Hidden Text"));$(c).css("line-height","normal");$(d).css("vertical-align","super");d={baseline:g,lineWidth:1,middle:d.offsetTop-c.offsetTop+1};this.fontData.push(a+"-"+b);this.fontData.push(d);$(c).remove();return d}; -html2canvas.prototype.textTransform=function(a,b){switch(b){case "lowercase":return a.toLowerCase();case "capitalize":return a.replace(/(^|\s|:|-|\(|\))([a-z])/g,function(a,b,e){return b+e.toUpperCase()});case "uppercase":return a.toUpperCase();default:return a}};html2canvas.prototype.trim=function(a){return a.replace(/^\s*/,"").replace(/\s*$/,"")}; -html2canvas.prototype.parseElement=function(a,b){var c=this;this.each(a.children,function(a,e){c.parsing(e,b)});this.canvasRenderer(this.contextStacks);this.finish()}; +html2canvas.prototype.textTransform=function(a,b){switch(b){case "lowercase":return a.toLowerCase();case "capitalize":return a.replace(/(^|\s|:|-|\(|\))([a-z])/g,function(a,b,e){return b+e.toUpperCase()});case "uppercase":return a.toUpperCase();default:return a}};html2canvas.prototype.trim=function(a){return a.replace(/^\s*/,"").replace(/\s*$/,"")};html2canvas.prototype.parseElement=function(a,b){var c=this;this.each(a.children,function(a,e){c.parsing(e,b)});this.Renderer(this.contextStacks);this.finish()}; html2canvas.prototype.parsing=function(a,b){if(this.getCSS(a,"display")!="none"&&this.getCSS(a,"visibility")!="hidden"){var c=this,b=this.newElement(a,b)||b,d=b.ctx;if(!this.ignoreRe.test(a.nodeName)){var e=this.contentsInZ(a);e.length==1?e[0].nodeType==1?this.parsing(e[0],b):e[0].nodeType==3&&this.newText(a,e[0],b.ctx):this.each(e,function(e,f){f.nodeType==1?c.parsing(f,b):f.nodeType==3&&c.newText(a,f,d)})}}};html2canvas.prototype.log=function(){}; -html2canvas.prototype.getBounds=function(a){window.scroll(0,0);if(a.getBoundingClientRect)return a=a.getBoundingClientRect(),a.top=a.top,a.left=a.left,a;else{var b=$(a).offset();return{left:b.left+parseInt(this.getCSS(a,"border-left-width"),10),top:b.top+parseInt(this.getCSS(a,"border-top-width"),10),width:$(a).innerWidth(),height:$(a).innerHeight()}}};html2canvas.prototype.each=function(a,b){for(var b=b||function(){},c=0;c