2014-01-26 20:10:04 +04:00
|
|
|
(function(t,e,n){function r(){return Math.max(Math.max(e.body.scrollWidth,e.documentElement.scrollWidth),Math.max(e.body.offsetWidth,e.documentElement.offsetWidth),Math.max(e.body.clientWidth,e.documentElement.clientWidth))}function o(){return Math.max(Math.max(e.body.scrollHeight,e.documentElement.scrollHeight),Math.max(e.body.offsetHeight,e.documentElement.offsetHeight),Math.max(e.body.clientHeight,e.documentElement.clientHeight))}function i(e,n,r){var o=e.documentElement.cloneNode(!0),i=e.createElement("iframe");return i.style.display="hidden",i.style.position="absolute",i.style.width=n+"px",i.style.height=r+"px",e.body.appendChild(i),new Promise(function(e){var n=function(){"none"!==i.contentWindow.getComputedStyle(s,null).backgroundImage?(r.body.removeChild(s),r.body.removeChild(a),e(i)):t.setTimeout(n,10)},r=i.contentWindow.document;r.open(),r.write(""),r.close(),r.replaceChild(r.adoptNode(o),r.documentElement),i.contentWindow.scrollTo(t.scrollX,t.scrollY);var s=r.createElement("div");s.className="html2canvas-ready-test",r.body.appendChild(s);var a=r.createElement("style");a.innerHTML="body div.html2canvas-ready-test { background-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7); }",r.body.appendChild(a),n()})}function s(t,e,n,r,o){this.renderer=e,this.options=o,this.range=null,this.support=n,this.stack=new H(!0,1,t.ownerDocument,null);var i=new W(t,null);i.visibile=i.isElementVisible(),this.nodes=[i].concat(this.getChildren(i)).filter(function(t){return t.visible=t.isElementVisible()}),this.images=r.fetch(this.nodes.filter(C)),this.createStackingContexts(),this.sortStackingContexts(this.stack),this.images.ready.then(N(function(){D("Images loaded, starting parsing"),this.parse(this.stack),o.onrendered(e.canvas)},this))}function a(t){return 0>t.cssInt("zIndex")}function c(t){return t.cssInt("zIndex")>0}function u(t){return 0===t.cssInt("zIndex")}function h(t){return-1!==["inline","inline-block","inline-table"].indexOf(t.css("display"))}function p(t){return t instanceof H}function d(t){return t.node.data.trim().length>0}function l(t){return/^(normal|none|0px)$/.test(t.parent.css("letterSpacing"))}function f(t,e,n,r,o,i,s){e[0]>0||e[1]>0?(t.push(["line",r[0].start.x,r[0].start.y]),r[0].curveTo(t),r[1].curveTo(t)):t.push(["line",i,s]),(n[0]>0||n[1]>0)&&t.push(["line",o[0].start.x,o[0].start.y])}function g(t){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(e){var n=t.css("border"+e+"Radius"),r=n.split(" ");return 1>=r.length&&(r[1]=r[0]),r.map(m)})}function m(t){return parseInt(t,10)}function y(t,e,n,r){var o=4*((Math.sqrt(2)-1)/3),i=n*o,s=r*o,a=t+n,c=e+r;return{topLeft:v({x:t,y:c},{x:t,y:c-s},{x:a-i,y:e},{x:a,y:e}),topRight:v({x:t,y:e},{x:t+i,y:e},{x:a,y:c-s},{x:a,y:c}),bottomRight:v({x:a,y:e},{x:a,y:e+s},{x:t+i,y:c},{x:t,y:c}),bottomLeft:v({x:a,y:c},{x:a-i,y:c},{x:t,y:e+s},{x:t,y:e})}}function w(t,e,n){var r=t.left,o=t.top,i=t.width,s=t.height,a=e[0][0],c=e[0][1],u=e[1][0],h=e[1][1],p=e[2][0],d=e[2][1],l=e[3][0],f=e[3][1],g=i-u,m=s-d,w=i-p,v=s-f;return{topLeftOuter:y(r,o,a,c).topLeft.subdivide(.5),topLeftInner:y(r+n[3].width,o+n[0].width,Math.max(0,a-n[3].width),Math.max(0,c-n[0].width)).topLeft.subdivide(.5),topRightOuter:y(r+g,o,u,h).topRight.subdivide(.5),topRightInner:y(r+Math.min(g,i+n[3].width),o+n[0].width,g>i+n[3].width?0:u-n[3].width,h-n[0].width).topRight.subdivide(.5),bottomRightOuter:y(r+w,o+m,p,d).bottomRight.subdivide(.5),bottomRightInner:y(r+Math.min(w,i+n[3].width),o+Math.min(m,s+n[0].width),Math.max(0,p-n[1].width),Math.max(0,d-n[2].width)).bottomRight.subdivide(.5),bottomLeftOuter:y(r,o+v,l,f).bottomLeft.subdivide(.5),bottomLeftInner:y(r+n[3].width,o+v,Math.max(0,l-n[3].width),Math.max(0,f-n[2].width)).bottomLeft.subdivide(.5)}}function v(t,e,n,r){var o=function(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}};return{start:t,startControl:e,endControl:n,end:r,subdivide:function(i){var s=o(t,e,i),a=o(e,n,i),c=o(n,r,i),u=o(s,a,i),h=o(a,c,i),p=o(u,h,i);return[v(t,s,u,p),v(p,h,c,r)]},curveTo:function(t){t.push(["bezierCurve",e.x,e.y,n.x,n.y,
|