mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
updated from source
This commit is contained in:
parent
0b8684dd20
commit
4b7ea7d7cc
4
html2canvas.min.js
vendored
4
html2canvas.min.js
vendored
@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function html2canvas(s,I){function t(){if(j.length==0||u==j.length/2)m("Started parsing"),x(s),J(s)}function m(a){q.logging&&(typeof console!="undefined"&&console.log?console.log(a):alert(a))}function y(a){if(j.indexOf(a)==-1){j.push(a);var b=new Image;$(b).load(function(){u++;t()});b.onerror=function(){j.splice(j.indexOf(b.src),2);u++;t()};b.src=a;j.push(b)}}function z(a){n($(a).contents(),function(a,e){RegExp("("+A+")").test(e.nodeName)||z(e)});if(a.nodeType==1||typeof a.nodeType=="undefined")if((a=
|
function html2canvas(s,I){function t(){if(j.length==0||u==j.length/2)m("Started parsing"),x(s),J(s)}function m(a){q.logging&&(typeof console!="undefined"&&console.log?console.log(a):alert(a))}function y(a){if(j.indexOf(a)==-1){j.push(a);var b=new Image;$(b).load(function(){u++;t()});b.onerror=function(){j.splice(j.indexOf(b.src),2);u++;t()};b.src=a;j.push(b)}}function z(a){n($(a).contents(),function(a,e){RegExp("("+A+")").test(e.nodeName)||z(e)});if(a.nodeType==1||typeof a.nodeType=="undefined")if((a=
|
||||||
i(a,"background-image"))&&a!="1"&&a!="none"&&a.substring(0,7)!="-webkit")a=B(a),y(a)}function v(a){if(!RegExp("("+A+")").test(a.nodeName)){x(a);var b=$(a).contents();b.length==1?b[0].nodeType==1?v(b[0]):b[0].nodeType==3&&C(a,b[0]):n(b,function(b,g){g.nodeType==1?v(g):g.nodeType==3&&C(a,g)})}}function J(a){n(a.children,function(a,e){v(e)});K()}function B(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}function D(a){a=j.indexOf(a);
|
i(a,"background-image"))&&a!="1"&&a!="none"&&a.substring(0,7)!="-webkit"&&a.substring(0,4)!="-moz")a=B(a),y(a)}function v(a){if(!RegExp("("+A+")").test(a.nodeName)){x(a);var b=$(a).contents();b.length==1?b[0].nodeType==1?v(b[0]):b[0].nodeType==3&&C(a,b[0]):n(b,function(b,g){g.nodeType==1?v(g):g.nodeType==3&&C(a,g)})}}function J(a){n(a.children,function(a,e){v(e)});K()}function B(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}function D(a){a=
|
||||||
return a!=-1?j[a+1]:!1}function E(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(i(a,"border-left-width"),10),top:b.top+parseInt(i(a,"border-top-width"),10),width:$(a).innerWidth(),height:$(a).innerHeight()}}}function x(a){var b=E(a),e=b.left,g=b.top,f=b.width,d=b.height,b=i(a,"background-color"),c=L(a);n(c,function(a,b){if(b.width>0){var h=e,i=g,j=f,k=d-c[2].width;switch(a){case 0:k=
|
j.indexOf(a);return a!=-1?j[a+1]:!1}function E(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(i(a,"border-left-width"),10),top:b.top+parseInt(i(a,"border-top-width"),10),width:$(a).innerWidth(),height:$(a).innerHeight()}}}function x(a){var b=E(a),e=b.left,g=b.top,f=b.width,d=b.height,b=i(a,"background-color"),c=L(a);n(c,function(a,b){if(b.width>0){var h=e,i=g,j=f,k=d-c[2].width;switch(a){case 0:k=
|
||||||
c[0].width;break;case 1:h=e+f-c[1].width;j=c[1].width;break;case 2:i=i+d-c[2].width;k=c[2].width;break;case 3:j=c[3].width}r(h,i,j,k,b.color)}});r(e+c[3].width,g+c[0].width,f-(c[1].width+c[3].width),d-(c[0].width+c[2].width),b);M(a,{left:e+c[3].width,top:g+c[0].width,width:f-(c[1].width+c[3].width),height:d-(c[0].width+c[2].width)});a.nodeName=="IMG"&&((F=D(a.getAttribute("src")))?k.drawImage(F,e+parseInt(i(a,"padding-left"),10),g+parseInt(i(a,"padding-top"),10)):m("Error loading <img>:"+a.getAttribute("src")))}
|
c[0].width;break;case 1:h=e+f-c[1].width;j=c[1].width;break;case 2:i=i+d-c[2].width;k=c[2].width;break;case 3:j=c[3].width}r(h,i,j,k,b.color)}});r(e+c[3].width,g+c[0].width,f-(c[1].width+c[3].width),d-(c[0].width+c[2].width),b);M(a,{left:e+c[3].width,top:g+c[0].width,width:f-(c[1].width+c[3].width),height:d-(c[0].width+c[2].width)});a.nodeName=="IMG"&&((F=D(a.getAttribute("src")))?k.drawImage(F,e+parseInt(i(a,"padding-left"),10),g+parseInt(i(a,"padding-top"),10)):m("Error loading <img>:"+a.getAttribute("src")))}
|
||||||
function M(a,b){var e=i(a,"background-image"),g=i(a,"background-repeat");if(typeof e!="undefined"&&/^(1|none)$/.test(e)==!1){var e=B(e),f=D(e),d,c=i(a,"background-position").split(" "),o;c[0].indexOf("%")!=-1?(o=parseFloat(c[0])/100,d=b.width*o-f.width*o):d=parseInt(c[0],10);c[1].indexOf("%")!=-1?(o=parseFloat(c[1])/100,c=b.height*o-f.height*o):c=parseInt(c[1],10);d={top:c,left:d};if(f)switch(g){case "repeat-x":G(f,d,b.left,b.top,b.width,b.height);break;case "repeat-y":var e=b.left,g=b.top,c=b.height,
|
function M(a,b){var e=i(a,"background-image"),g=i(a,"background-repeat");if(typeof e!="undefined"&&/^(1|none)$/.test(e)==!1){var e=B(e),f=D(e),d,c=i(a,"background-position").split(" "),o;c[0].indexOf("%")!=-1?(o=parseFloat(c[0])/100,d=b.width*o-f.width*o):d=parseInt(c[0],10);c[1].indexOf("%")!=-1?(o=parseFloat(c[1])/100,c=b.height*o-f.height*o):c=parseInt(c[1],10);d={top:c,left:d};if(f)switch(g){case "repeat-x":G(f,d,b.left,b.top,b.width,b.height);break;case "repeat-y":var e=b.left,g=b.top,c=b.height,
|
||||||
j=Math.min(f.width,b.width);d.top-=Math.ceil(d.top/f.height)*f.height;for(h=g+d.top;h<=c+g;)o=Math.floor(h+f.height)>c+g?c+g-h:f.height,w(f,e+d.left,h,j,o,e,g),h=Math.floor(h+f.height);break;case "no-repeat":w(f,d.left+b.left,d.top+b.top,Math.min(b.width,f.width),Math.min(b.height,f.height),b.left,b.top);break;default:d.top-=Math.ceil(d.top/f.height)*f.height;for(h=b.top+d.top;h<=b.height+b.top;)e=Math.min(f.height,b.height+b.top-h),e=Math.floor(h+f.height)>e+h?e+h-h:f.height,h<b.top?(g=b.top-h,h=
|
j=Math.min(f.width,b.width);d.top-=Math.ceil(d.top/f.height)*f.height;for(h=g+d.top;h<=c+g;)o=Math.floor(h+f.height)>c+g?c+g-h:f.height,w(f,e+d.left,h,j,o,e,g),h=Math.floor(h+f.height);break;case "no-repeat":w(f,d.left+b.left,d.top+b.top,Math.min(b.width,f.width),Math.min(b.height,f.height),b.left,b.top);break;default:d.top-=Math.ceil(d.top/f.height)*f.height;for(h=b.top+d.top;h<=b.height+b.top;)e=Math.min(f.height,b.height+b.top-h),e=Math.floor(h+f.height)>e+h?e+h-h:f.height,h<b.top?(g=b.top-h,h=
|
||||||
|
Loading…
Reference in New Issue
Block a user