Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

latest build

  • Loading branch information...
commit 834f175fb41dcd649ac878672466d34f6b295d95 1 parent 25f36e8
Daniel Dotsenko authored
Showing with 32 additions and 32 deletions.
  1. +32 −32 jSignature.min.js
64 jSignature.min.js
View
@@ -6,24 +6,24 @@
MIT License <http://www.opensource.org/licenses/mit-license.php>
==============
*/
-(function(){if(null==this.jQuery)throw Error("We need jQuery for some of the functionality. jQuery is not detected. Failing to initialize...");(function(j){function r(b){for(var a,i=b.css("color"),g;void 0===g&&void 0!==b;){try{a=b.css("background-color")}catch(l){a="transparent"}"transparent"!==a&&"rgba(0, 0, 0, 0)"!==a&&(g=a);try{b=b.parent(),b[0]===document&&(b=void 0)}catch(f){b=void 0}}var b=/rgb[a]*\((\d+),\s*(\d+),\s*(\d+)/,c=/#([AaBbCcDdEeFf\d]{2})([AaBbCcDdEeFf\d]{2})([AaBbCcDdEeFf\d]{2})/,
-e;a=void 0;(a=i.match(b))?e={r:parseInt(a[1],10),g:parseInt(a[2],10),b:parseInt(a[3],10)}:(a=i.match(c))&&(e={r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)});var m;g?(a=void 0,(a=g.match(b))?m={r:parseInt(a[1],10),g:parseInt(a[2],10),b:parseInt(a[3],10)}:(a=g.match(c))&&(m={r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)})):m=e?127<Math.max.apply(null,[e.r,e.g,e.b])?{r:0,g:0,b:0}:{r:255,g:255,b:255}:{r:255,g:255,b:255};a=function(a){return"rgb("+[a.r,a.g,a.b].join(", ")+
-")"};e&&m?(b=Math.max.apply(null,[e.r,e.g,e.b]),e=Math.max.apply(null,[m.r,m.g,m.b]),e=Math.round(e+-0.75*(e-b)),e={r:e,g:e,b:e}):e?(e=Math.max.apply(null,[e.r,e.g,e.b]),b=1,127<e&&(b=-1),e=Math.round(e+96*b),e={r:e,g:e,b:e}):e={r:191,g:191,b:191};return{color:i,"background-color":m?a(m):g,"decor-color":a(e)}}function h(b,a){this.x=b;this.y=a;this.reverse=function(){return new this.constructor(-1*this.x,-1*this.y)};this._length=null;this.getLength=function(){this._length||(this._length=Math.sqrt(Math.pow(this.x,
-2)+Math.pow(this.y,2)));return this._length};var i=function(a){return Math.round(a/Math.abs(a))};this.resizeTo=function(a){if(0===this.x&&0===this.y)this._length=0;else if(0===this.x)this._length=a,this.y=a*i(this.y);else if(0===this.y)this._length=a,this.x=a*i(this.x);else{var b=Math.abs(this.y/this.x),f=Math.sqrt(Math.pow(a,2)/(1+Math.pow(b,2))),b=b*f;this._length=a;this.x=f*i(this.x);this.y=b*i(this.y)}return this}}function t(b,a){this.x=b;this.y=a;this.getVectorToCoordinates=function(a,b){return new h(a-
-this.x,b-this.y)};this.getVectorFromCoordinates=function(a,b){return this.getVectorToCoordinates(a,b).reverse()};this.getVectorToPoint=function(a){return new h(a.x-this.x,a.y-this.y)};this.getVectorFromPoint=function(a){return this.getVectorToPoint(a).reverse()}}function C(b){this.data=b;this.changed=function(){};this.startStrokeFn=function(){};this.addToStrokeFn=function(){};this.endStrokeFn=function(){};this.inStroke=!1;this._stroke=this._lastPoint=null;this.startStroke=function(a){if(a&&"number"==
-typeof a.x&&"number"==typeof a.y){this._stroke={x:[a.x],y:[a.y]};this.data.push(this._stroke);this._lastPoint=a;this.inStroke=!0;var b=this._stroke,g=this.startStrokeFn;setTimeout(function(){g(b)},3);return a}return null};this.addToStroke=function(a){if(this.inStroke&&"number"===typeof a.x&&"number"===typeof a.y&&2<Math.abs(a.x-this._lastPoint.x)+Math.abs(a.y-this._lastPoint.y)){var b=this._stroke.x.length;this._stroke.x.push(a.x);this._stroke.y.push(a.y);this._lastPoint=a;var g=this._stroke,l=this.addToStrokeFn;
-setTimeout(function(){l(g,b)},3);return a}return null};this.endStroke=function(){var a=this.inStroke;this.inStroke=!1;this._lastPoint=null;if(a){var b=this.endStrokeFn,g=this._stroke;setTimeout(function(){b(g)},3);setTimeout(this.changed,3);return!0}return null}}var D=function(b){var a={width:"max",height:"max",sizeRatio:4,color:"#000","background-color":"#fff","decor-color":"#eee",lineWidth:0},i=j(this);j.extend(a,r(i));b&&j.extend(a,b);if("max"==a.width||"max"==a.height){var b=i.width(),g=i.height();
-b/a.sizeRatio>g&&(g=parseInt(b/a.sizeRatio,10));a.width=b;a.height=g}0==a.lineWidth&&(b=parseInt(a.width,10),b=parseInt(b/300,10),a.lineWidth=2>b?2:b);var l=1E3>parseInt(a.width,10)?!0:!1,f=i.find("canvas"),c;f.length?c=f.get(0):(c=document.createElement("canvas"),c.width=a.width,c.height=a.height,f=j(c),f.appendTo(i));f.addClass("jSignature");var e=!1,m=1;c.getContext||("undefined"!==typeof FlashCanvas?(window&&window.screen&&window.screen.deviceXDPI&&window.screen.logicalXDPI&&(m=window.screen.deviceXDPI/
-window.screen.logicalXDPI),c=FlashCanvas.initElement(c),1!=m&&f.children("object").get(0).resize(Math.ceil(c.width*m),Math.ceil(c.height*m)),e=!0):"undefined"!=typeof G_vmlCanvasManager&&(c=G_vmlCanvasManager.initElement(c),e=!0));if(!c.getContext)throw Error("Canvas element does not support 2d context. jSignature cannot proceed.");c.onselectstart=function(a){a&&a.preventDefault&&a.preventDefault();a&&a.stopPropagation&&a.stopPropagation();return false};a.cssclass&&""!=j.trim(a.cssclass)&&f.addClass(a.cssclass);
-var k=c.getContext("2d"),d,A,F,o,s,p,q=-1*Math.round(a.lineWidth/2),G=function(a,b,c,g){k.beginPath();k.moveTo(a,b);k.lineTo(c,g);k.stroke()},b=function(b){var g=c.width,h=c.height;k.clearRect(0,0,g*m+30,h*m+30);k.shadowColor=k.fillStyle=a["background-color"];e&&k.fillRect(0,0,g*m+30,h*m+30);k.lineWidth=Math.ceil(parseInt(a.lineWidth,10)*m);k.lineCap=k.lineJoin="round";var j=Math.round(h/5);k.strokeStyle=a["decor-color"];k.shadowOffsetX=0;k.shadowOffsetY=0;G(j*1.5,h-j,g-j*1.5,h-j);k.strokeStyle=a.color;
-if(!e&&!l){k.shadowColor=k.strokeStyle;k.shadowOffsetX=k.lineWidth*0.5;k.shadowOffsetY=k.lineWidth*-0.6;k.shadowBlur=0}if(b===void 0)b=[];else for(var g=b.length,n=0;n<g;n++){h=b[n];j=h.x.length;A(h);for(var H=1;H<j;H++)F(h,H);o(h)}d=new C(b);d.startStrokeFn=A;d.addToStrokeFn=F;d.endStrokeFn=o;d.changed=function(){i.trigger("change")};f.data("jSignature.data",b);return true},E=null,n=function(a){try{a.preventDefault()}catch(b){}clearTimeout(E);d.endStroke()},B=0,w=function(a){a=a.changedTouches&&
-a.changedTouches.length>0?a.changedTouches[0]:a;return new t(Math.round((a.pageX+s)*m),Math.round((a.pageY+p)*m)+B)},u=function(a){a.preventDefault();var b=f.offset();s=b.left*-1;p=b.top*-1;d.startStroke(w(a));clearTimeout(E);E=setTimeout(n,750)},v=function(a){a.preventDefault();if(d.inStroke&&d.addToStroke(w(a))){clearTimeout(E);E=setTimeout(n,750)}},z=3*a.lineWidth;A=function(b){var c=b.x[0],b=b.y[0];k.fillStyle=a.color;k.fillRect(c+q,b+q,a.lineWidth,a.lineWidth);k.fillStyle=a["background-color"]};
-F=function(a,b){var c=new t(a.x[b-1],a.y[b-1]),g=new t(a.x[b],a.y[b]),f=c.getVectorToPoint(g);if(b>1){var e=new t(a.x[b-2],a.y[b-2]),l=e.getVectorToPoint(c),m;if(l.getLength()>z){m=b>2?(new t(a.x[b-3],a.y[b-3])).getVectorToPoint(e):new h(0,0);var d=l.getLength()*0.35,i=(new h(m.x+l.x,m.y+l.y)).resizeTo(d),A=(new h(l.x+f.x,l.y+f.y)).reverse().resizeTo(d),l=e.x,d=e.y;m=c.x;var j=c.y,n=e.x+i.x,e=e.y+i.y,i=c.x+A.x,A=c.y+A.y;k.beginPath();k.moveTo(l,d);k.bezierCurveTo(n,e,i,A,m,j);k.stroke()}}f.getLength()<=
-z&&G(c.x,c.y,g.x,g.y)};o=function(a){var b=a.x.length-1;if(b>0){var c=new t(a.x[b],a.y[b]),g=new t(a.x[b-1],a.y[b-1]),f=g.getVectorToPoint(c);if(f.getLength()>z)if(b>1){var a=(new t(a.x[b-2],a.y[b-2])).getVectorToPoint(g),e=(new h(a.x+f.x,a.y+f.y)).resizeTo(f.getLength()/2),f=g.x,a=g.y,b=c.x,l=c.y,m=g.x+e.x,g=g.y+e.y,e=c.x,c=c.y;k.beginPath();k.moveTo(f,a);k.bezierCurveTo(m,g,e,c,b,l);k.stroke()}else G(g.x,g.y,c.x,c.y)}};e?f.bind("mousedown.jSignature",function(a){f.unbind("mousedown.jSignature");
-u(a);f.bind("mousemove.jSignature",v);f.bind("mouseup.jSignature",n);f.bind("mousedown.jSignature",u)}):(c.ontouchstart=function(b){c.onmousedown=null;c.onmouseup=null;c.onmousemove=null;B=a.lineWidth*-5<-15?a.lineWidth*-5:-15;u(b);c.ontouchend=n;c.ontouchstart=u;c.ontouchmove=v},c.onmousedown=function(a){c.ontouchstart=null;c.ontouchend=null;c.ontouchmove=null;u(a);c.onmousedown=u;c.onmouseup=n;c.onmousemove=v});f.data("jSignature.reset",b);j(document).bind("mouseup.jSignature",n);b(a.data)},p={"default":function(){return this.toDataURL()},
-"native":function(b){return b},image:function(){var b=this.toDataURL();if("string"===typeof b&&4<b.length&&"data:"===b.slice(0,5)&&-1!==b.indexOf(",")){var a=b.indexOf(",");return[b.slice(5,a),b.substr(a+1)]}return[]}},q={"native":function(b,a,d){d(b)}},d={init:function(b){return this.each(function(){D.call(this,b)})},reset:function(b){this.find("canvas.jSignature").add(this.filter("canvas.jSignature")).data("jSignature.reset")(b);return this},addPlugin:function(b,a,d){var g={"export":p,"import":q};
-g.hasOwnProperty(b)&&(g[b][a]=d);return this},listPlugins:function(b){var a={"export":p,"import":q},d=[];if(a.hasOwnProperty(b)){var b=a[b],g;for(g in b)b.hasOwnProperty(g)&&d.push(g)}return d},getData:function(b){var a=this.find("canvas.jSignature").add(this.filter("canvas.jSignature"));void 0===b&&(b="default");if(0!==a.length&&p.hasOwnProperty(b))return p[b].call(a.get(0),a.data("jSignature.data"))},setData:function(b,a){var d=this.find("canvas.jSignature").add(this.filter("canvas.jSignature"));
-if(void 0===a&&"string"===typeof b&&"data:"===b.substr(0,5)&&(a=b.slice(5).split(",")[0],b=b.slice(6+a.length),a===b))return;0!==d.length&&q.hasOwnProperty(a)&&q[a].call(d.get(0),b,a,d.data("jSignature.reset"));return this}};j.fn.jSignature=function(b){if(d[b])return d[b].apply(this,Array.prototype.slice.call(arguments,1));if("object"===typeof b||!b)return d.init.apply(this,arguments);j.error("Method "+b+" does not exist on jQuery.jSignature")};return j})(this.jQuery)})("undefined"!==typeof window?
+(function(){if(null==this.jQuery)throw Error("We need jQuery for some of the functionality. jQuery is not detected. Failing to initialize...");(function(j){function r(c){for(var b,i=c.css("color"),a;void 0===a&&void 0!==c;){try{b=c.css("background-color")}catch(v){b="transparent"}"transparent"!==b&&"rgba(0, 0, 0, 0)"!==b&&(a=b);try{c=c.parent(),c[0]===document&&(c=void 0)}catch(k){c=void 0}}var c=/rgb[a]*\((\d+),\s*(\d+),\s*(\d+)/,d=/#([AaBbCcDdEeFf\d]{2})([AaBbCcDdEeFf\d]{2})([AaBbCcDdEeFf\d]{2})/,
+e;b=void 0;(b=i.match(c))?e={r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}:(b=i.match(d))&&(e={r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)});var f;a?(b=void 0,(b=a.match(c))?f={r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}:(b=a.match(d))&&(f={r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)})):f=e?127<Math.max.apply(null,[e.r,e.g,e.b])?{r:0,g:0,b:0}:{r:255,g:255,b:255}:{r:255,g:255,b:255};b=function(a){return"rgb("+[a.r,a.g,a.b].join(", ")+
+")"};e&&f?(c=Math.max.apply(null,[e.r,e.g,e.b]),e=Math.max.apply(null,[f.r,f.g,f.b]),e=Math.round(e+-0.75*(e-c)),e={r:e,g:e,b:e}):e?(e=Math.max.apply(null,[e.r,e.g,e.b]),c=1,127<e&&(c=-1),e=Math.round(e+96*c),e={r:e,g:e,b:e}):e={r:191,g:191,b:191};return{color:i,"background-color":f?b(f):a,"decor-color":b(e)}}function g(c,b){this.x=c;this.y=b;this.reverse=function(){return new this.constructor(-1*this.x,-1*this.y)};this._length=null;this.getLength=function(){this._length||(this._length=Math.sqrt(Math.pow(this.x,
+2)+Math.pow(this.y,2)));return this._length};var i=function(a){return Math.round(a/Math.abs(a))};this.resizeTo=function(a){if(0===this.x&&0===this.y)this._length=0;else if(0===this.x)this._length=a,this.y=a*i(this.y);else if(0===this.y)this._length=a,this.x=a*i(this.x);else{var b=Math.abs(this.y/this.x),k=Math.sqrt(Math.pow(a,2)/(1+Math.pow(b,2))),b=b*k;this._length=a;this.x=k*i(this.x);this.y=b*i(this.y)}return this}}function l(c,b){this.x=c;this.y=b;this.getVectorToCoordinates=function(b,a){return new g(b-
+this.x,a-this.y)};this.getVectorFromCoordinates=function(b,a){return this.getVectorToCoordinates(b,a).reverse()};this.getVectorToPoint=function(b){return new g(b.x-this.x,b.y-this.y)};this.getVectorFromPoint=function(b){return this.getVectorToPoint(b).reverse()}}function t(c){this.data=c;this.changed=function(){};this.startStrokeFn=function(){};this.addToStrokeFn=function(){};this.endStrokeFn=function(){};this.inStroke=!1;this._stroke=this._lastPoint=null;this.startStroke=function(b){if(b&&"number"==
+typeof b.x&&"number"==typeof b.y){this._stroke={x:[b.x],y:[b.y]};this.data.push(this._stroke);this._lastPoint=b;this.inStroke=!0;var c=this._stroke,a=this.startStrokeFn;setTimeout(function(){a(c)},3);return b}return null};this.addToStroke=function(b){if(this.inStroke&&"number"===typeof b.x&&"number"===typeof b.y&&2<Math.abs(b.x-this._lastPoint.x)+Math.abs(b.y-this._lastPoint.y)){var c=this._stroke.x.length;this._stroke.x.push(b.x);this._stroke.y.push(b.y);this._lastPoint=b;var a=this._stroke,v=this.addToStrokeFn;
+setTimeout(function(){v(a,c)},3);return b}return null};this.endStroke=function(){var b=this.inStroke;this.inStroke=!1;this._lastPoint=null;if(b){var c=this.endStrokeFn,a=this._stroke;setTimeout(function(){c(a)},3);setTimeout(this.changed,3);return!0}return null}}var C=function(c){var b={width:"max",height:"max",sizeRatio:4,color:"#000","background-color":"#fff","decor-color":"#eee",lineWidth:0},i=j(this);j.extend(b,r(i));c&&j.extend(b,c);if("max"==b.width||"max"==b.height){var c=i.width(),a=i.height();
+c/b.sizeRatio>a&&(a=parseInt(c/b.sizeRatio,10));b.width=c;b.height=a}0==b.lineWidth&&(c=parseInt(b.width,10),c=parseInt(c/300,10),b.lineWidth=2>c?2:c);var v=1E3>parseInt(b.width,10)?!0:!1,k=i.find("canvas"),d;k.length?d=k.get(0):(d=document.createElement("canvas"),d.width=b.width,d.height=b.height,k=j(d),k.appendTo(i));k.addClass("jSignature");var e=!1,f=1;d.getContext||("undefined"!==typeof FlashCanvas?(window&&window.screen&&window.screen.deviceXDPI&&window.screen.logicalXDPI&&(f=window.screen.deviceXDPI/
+window.screen.logicalXDPI),d=FlashCanvas.initElement(d),1!=f&&k.children("object").get(0).resize(Math.ceil(d.width*f),Math.ceil(d.height*f)),e=!0):"undefined"!=typeof G_vmlCanvasManager&&(d=G_vmlCanvasManager.initElement(d),e=!0));if(!d.getContext)throw Error("Canvas element does not support 2d context. jSignature cannot proceed.");d.onselectstart=function(a){a&&a.preventDefault&&a.preventDefault();a&&a.stopPropagation&&a.stopPropagation();return false};b.cssclass&&""!=j.trim(b.cssclass)&&k.addClass(b.cssclass);
+var h=d.getContext("2d"),s,p,E,F,G,n,o=-1*Math.round(b.lineWidth/2),q=function(a,d,b,k){h.beginPath();h.moveTo(a,d);h.lineTo(b,k);h.stroke()},c=function(a){var c=d.width,g=d.height;h.clearRect(0,0,c*f+30,g*f+30);h.shadowColor=h.fillStyle=b["background-color"];e&&h.fillRect(0,0,c*f+30,g*f+30);h.lineWidth=Math.ceil(parseInt(b.lineWidth,10)*f);h.lineCap=h.lineJoin="round";var j=Math.round(g/5);h.strokeStyle=b["decor-color"];h.shadowOffsetX=0;h.shadowOffsetY=0;q(j*1.5,g-j,c-j*1.5,g-j);h.strokeStyle=b.color;
+if(!e&&!v){h.shadowColor=h.strokeStyle;h.shadowOffsetX=h.lineWidth*0.5;h.shadowOffsetY=h.lineWidth*-0.6;h.shadowBlur=0}if(a===void 0)a=[];else for(var c=a.length,l=0;l<c;l++){g=a[l];j=g.x.length;p(g);for(var m=1;m<j;m++)E(g,m);F(g)}s=new t(a);s.startStrokeFn=p;s.addToStrokeFn=E;s.endStrokeFn=F;s.changed=function(){i.trigger("change")};k.data("jSignature.data",a);return true},D=null,m=function(a){try{a.preventDefault()}catch(d){}clearTimeout(D);s.endStroke()},B=0,z=function(a){a=a.changedTouches&&
+a.changedTouches.length>0?a.changedTouches[0]:a;return new l(Math.round((a.pageX+G)*f),Math.round((a.pageY+n)*f)+B)},u=function(a){a.preventDefault();var d=k.offset();G=d.left*-1;n=d.top*-1;s.startStroke(z(a));clearTimeout(D);D=setTimeout(m,750)},w=function(a){a.preventDefault();if(s.inStroke&&s.addToStroke(z(a))){clearTimeout(D);D=setTimeout(m,750)}},A=3*b.lineWidth;p=function(a){var d=a.x[0],a=a.y[0];h.fillStyle=b.color;h.fillRect(d+o,a+o,b.lineWidth,b.lineWidth);h.fillStyle=b["background-color"]};
+E=function(a,d){var b=new l(a.x[d-1],a.y[d-1]),k=new l(a.x[d],a.y[d]),e=b.getVectorToPoint(k);if(d>1){var c=new l(a.x[d-2],a.y[d-2]),f=c.getVectorToPoint(b),v;if(f.getLength()>A){v=d>2?(new l(a.x[d-3],a.y[d-3])).getVectorToPoint(c):new g(0,0);var s=f.getLength()*0.35,i=(new g(v.x+f.x,v.y+f.y)).resizeTo(s),p=(new g(f.x+e.x,f.y+e.y)).reverse().resizeTo(s),f=c.x,s=c.y;v=b.x;var j=b.y,m=c.x+i.x,c=c.y+i.y,i=b.x+p.x,p=b.y+p.y;h.beginPath();h.moveTo(f,s);h.bezierCurveTo(m,c,i,p,v,j);h.stroke()}}e.getLength()<=
+A&&q(b.x,b.y,k.x,k.y)};F=function(a){var d=a.x.length-1;if(d>0){var b=new l(a.x[d],a.y[d]),k=new l(a.x[d-1],a.y[d-1]),c=k.getVectorToPoint(b);if(c.getLength()>A)if(d>1){var a=(new l(a.x[d-2],a.y[d-2])).getVectorToPoint(k),e=(new g(a.x+c.x,a.y+c.y)).resizeTo(c.getLength()/2),c=k.x,a=k.y,d=b.x,f=b.y,v=k.x+e.x,k=k.y+e.y,e=b.x,b=b.y;h.beginPath();h.moveTo(c,a);h.bezierCurveTo(v,k,e,b,d,f);h.stroke()}else q(k.x,k.y,b.x,b.y)}};e?k.bind("mousedown.jSignature",function(a){k.unbind("mousedown.jSignature");
+u(a);k.bind("mousemove.jSignature",w);k.bind("mouseup.jSignature",m);k.bind("mousedown.jSignature",u)}):(d.ontouchstart=function(a){d.onmousedown=null;d.onmouseup=null;d.onmousemove=null;B=b.lineWidth*-5<-15?b.lineWidth*-5:-15;u(a);d.ontouchend=m;d.ontouchstart=u;d.ontouchmove=w},d.onmousedown=function(a){d.ontouchstart=null;d.ontouchend=null;d.ontouchmove=null;u(a);d.onmousedown=u;d.onmouseup=m;d.onmousemove=w});k.data("jSignature.reset",c);j(document).bind("mouseup.jSignature",m);c(b.data)},n={"default":function(){return this.toDataURL()},
+"native":function(c){return c},image:function(){var c=this.toDataURL();if("string"===typeof c&&4<c.length&&"data:"===c.slice(0,5)&&-1!==c.indexOf(",")){var b=c.indexOf(",");return[c.slice(5,b),c.substr(b+1)]}return[]}},o={"native":function(c,b,g){g(c)}},q={init:function(c){return this.each(function(){C.call(this,c)})},reset:function(c){this.find("canvas.jSignature").add(this.filter("canvas.jSignature")).data("jSignature.reset")(c);return this},addPlugin:function(c,b,g){var a={"export":n,"import":o};
+a.hasOwnProperty(c)&&(a[c][b]=g);return this},listPlugins:function(c){var b={"export":n,"import":o},g=[];if(b.hasOwnProperty(c)){var c=b[c],a;for(a in c)c.hasOwnProperty(a)&&g.push(a)}return g},getData:function(c){var b=this.find("canvas.jSignature").add(this.filter("canvas.jSignature"));void 0===c&&(c="default");if(0!==b.length&&n.hasOwnProperty(c))return n[c].call(b.get(0),b.data("jSignature.data"))},setData:function(c,b){var g=this.find("canvas.jSignature").add(this.filter("canvas.jSignature"));
+if(void 0===b&&"string"===typeof c&&"data:"===c.substr(0,5)&&(b=c.slice(5).split(",")[0],c=c.slice(6+b.length),b===c))return;0!==g.length&&o.hasOwnProperty(b)&&o[b].call(g.get(0),c,b,g.data("jSignature.reset"));return this}};j.fn.jSignature=function(c){if(q[c])return q[c].apply(this,Array.prototype.slice.call(arguments,1));if("object"===typeof c||!c)return q.init.apply(this,arguments);j.error("Method "+c+" does not exist on jQuery.jSignature")};return j})(this.jQuery)})("undefined"!==typeof window?
window:this);/*
==============
@@ -32,10 +32,10 @@ window:this);/*
MIT License <http://www.opensource.org/licenses/mit-license.php>
==============
*/
-(function(){for(var j={},r={},h=29;-1<h;h--)j["0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX"[h]]="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX"[h+30],r["0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX"[h+30]]="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX"[h];var t=function(d){for(var d=d.split(""),b=d.length,a=1;a<b;a++)d[a]=j[d[a]];return d.join("")},C=function(d){for(var b=[],a=0,i=1,g=d.length,l,f,c=0;c<g;c++)l=d[c],f=l-a,a=l,0>f&&0<
-i?(i=-1,b.push("Z")):0<f&&0>i&&(i=1,b.push("Y")),l=Math.abs(f),30<=l?b.push(t(l.toString(30))):b.push(l.toString(30));return b.join("")},D=function(d){for(var b=[],d=d.split(""),a=d.length,i,g=1,l=[],f=0,c=0;c<a;c++)(i=d[c],i in j||"Z"===i||"Y"===i)?(0!==l.length&&(l=parseInt(l.join(""),30)*g+f,b.push(l),f=l),"Z"===i)?(g=-1,l=[]):"Y"===i?(g=1,l=[]):l=[i]:l.push(r[i]);b.push(parseInt(l.join(""),30)*g+f);return b},p=function(d){for(var b=[],a=d.length,i,g=0;g<a;g++)i=d[g],b.push(C(i.x)),b.push(C(i.y));
-return["image/jsignature;base30",b.join("_")]},q=function(d,b,a){if("string"===typeof d){"image/jsignature;base30"===d.substring(0,23).toLowerCase()&&(d=d.substring(24));for(var b=[],d=d.split("_"),i=d.length/2,g=0;g<i;g++)b.push({x:D(d[2*g]),y:D(d[2*g+1])});a(b)}};if(null==this.jQuery)throw Error("We need jQuery for some of the functionality. jQuery is not detected. Failing to initialize...");(function(d){d=d.fn.jSignature;d("addPlugin","export","base30",p);d("addPlugin","export","image/jsignature;base30",
-p);d("addPlugin","import","base30",q);d("addPlugin","import","image/jsignature;base30",q)})(this.jQuery)}).call("undefined"!==typeof window?window:this);/*
+(function(){for(var j={},r={},g="0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X".split(","),l=g.length/2,t=l-1;-1<t;t--)j[g[t]]=g[t+l],r[g[t+l]]=g[t];var C=function(a){for(var a=a.split(""),b=a.length,k=1;k<b;k++)a[k]=j[a[k]];return a.join("")},n=function(a){for(var b=[],k=0,d=1,c=a.length,f,h,g=0;g<c;g++)f=a[g],h=f-k,k=f,0>h&&0<d?(d=-1,b.push("Z")):0<h&&0>d&&(d=1,b.push("Y")),f=Math.abs(h),f>=l?b.push(C(f.toString(l))):b.push(f.toString(l));
+return b.join("")},o=function(a){for(var b=[],a=a.split(""),k=a.length,d,c=1,f=[],h=0,g=0;g<k;g++)(d=a[g],d in j||"Z"===d||"Y"===d)?(0!==f.length&&(f=parseInt(f.join(""),l)*c+h,b.push(f),h=f),"Z"===d)?(c=-1,f=[]):"Y"===d?(c=1,f=[]):f=[d]:f.push(r[d]);b.push(parseInt(f.join(""),l)*c+h);return b},q=function(a){for(var b=[],k=a.length,d,c=0;c<k;c++)d=a[c],b.push(n(d.x)),b.push(n(d.y));return b.join("_")},c=function(a){for(var b=[],a=a.split("_"),c=a.length/2,d=0;d<c;d++)b.push({x:o(a[2*d]),y:o(a[2*d+
+1])});return b},b=function(a){return["image/jsignature;base30",q(a)]},i=function(a,b,k){"string"===typeof a&&("image/jsignature;base30"===a.substring(0,23).toLowerCase()&&(a=a.substring(24)),k(c(a)))};if(null==this.jQuery)throw Error("We need jQuery for some of the functionality. jQuery is not detected. Failing to initialize...");(function(a){a=a.fn.jSignature;a("addPlugin","export","base30",b);a("addPlugin","export","image/jsignature;base30",b);a("addPlugin","import","base30",i);a("addPlugin","import",
+"image/jsignature;base30",i)})(this.jQuery);this.jSignatureDebug&&(this.jSignatureDebug.base30={remapTailChars:C,compressstrokeleg:n,uncompressstrokeleg:o,compressstrokes:q,uncompressstrokes:c,charmap:j})}).call("undefined"!==typeof window?window:this);/*
==============
Simplify.js BSD
@@ -64,13 +64,13 @@ p);d("addPlugin","import","base30",q);d("addPlugin","import","image/jsignature;b
MIT License <http://www.opensource.org/licenses/mit-license.php>
==============
*/
-(function(){function j(a,b){this.x=a;this.y=b;this.reverse=function(){return new this.constructor(-1*this.x,-1*this.y)};this._length=null;this.getLength=function(){this._length||(this._length=Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2)));return this._length};var f=function(a){return Math.round(a/Math.abs(a))};this.resizeTo=function(a){if(0===this.x&&0===this.y)this._length=0;else if(0===this.x)this._length=a,this.y=a*f(this.y);else if(0===this.y)this._length=a,this.x=a*f(this.x);else{var b=Math.abs(this.y/
-this.x),g=Math.sqrt(Math.pow(a,2)/(1+Math.pow(b,2))),b=b*g;this._length=a;this.x=g*f(this.x);this.y=b*f(this.y)}return this};this.angleTo=function(a){var b=this.getLength()*a.getLength();return 0===b?0:Math.acos(Math.min(Math.max((this.x*a.x+this.y*a.y)/b,-1),1))/Math.PI}}function r(a,b){this.x=a;this.y=b;this.getVectorToCoordinates=function(a,b){return new j(a-this.x,b-this.y)};this.getVectorFromCoordinates=function(a,b){return this.getVectorToCoordinates(a,b).reverse()};this.getVectorToPoint=function(a){return new j(a.x-
-this.x,a.y-this.y)};this.getVectorFromPoint=function(a){return this.getVectorToPoint(a).reverse()}}function h(a,b){var f=Math.pow(10,b);return Math.round(a*f)/f}function t(a,b,f){var b=b+1,c=new r(a.x[b-1],a.y[b-1]),e=new r(a.x[b],a.y[b]),e=c.getVectorToPoint(e),d=new r(a.x[b-2],a.y[b-2]),c=d.getVectorToPoint(c);return c.getLength()>f?(f=2<b?(new r(a.x[b-3],a.y[b-3])).getVectorToPoint(d):new j(0,0),a=0.35*c.getLength(),d=c.angleTo(f.reverse()),b=e.angleTo(c.reverse()),f=(new j(f.x+c.x,f.y+c.y)).resizeTo(Math.max(0.05,
-d)*a),e=(new j(c.x+e.x,c.y+e.y)).reverse().resizeTo(Math.max(0.05,b)*a),e=new j(c.x+e.x,c.y+e.y),["c",h(f.x,2),h(f.y,2),h(e.x,2),h(e.y,2),h(c.x,2),h(c.y,2)]):["l",h(c.x,2),h(c.y,2)]}function C(a,b){var f=a.x.length-1,c=new r(a.x[f],a.y[f]),e=new r(a.x[f-1],a.y[f-1]),c=e.getVectorToPoint(c);if(1<f&&c.getLength()>b){var f=(new r(a.x[f-2],a.y[f-2])).getVectorToPoint(e),e=c.angleTo(f.reverse()),d=0.35*c.getLength(),f=(new j(f.x+c.x,f.y+c.y)).resizeTo(Math.max(0.05,e)*d);return["c",h(f.x,2),h(f.y,2),h(c.x,
-2),h(c.y,2),h(c.x,2),h(c.y,2)]}return["l",h(c.x,2),h(c.y,2)]}function D(a,b,f){for(var b=["M",x=a.x[0]-b,y=a.y[0]-f],f=1,c=a.x.length-1;f<c;f++)b.push.apply(b,t(a,f,1));0<c&&b.push.apply(b,C(a,f,1));return b.join(" ")}function p(a){var b=['<?xml version="1.0" encoding="UTF-8" standalone="no"?>','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'],f,c=a.length,e,d=[],k=[],i=e=f=0,h=0,j=[];if(0!==c){for(f=0;f<c;f++){i=a[f];h=[];e={x:[],y:[]};for(var o=
-void 0,s=void 0,o=0,s=i.x.length;o<s;o++)h.push({x:i.x[o],y:i.y[o]});h=simplify(h,0.7,!0);o=0;for(s=h.length;o<s;o++)e.x.push(h[o].x),e.y.push(h[o].y);j.push(e);d=d.concat(e.x);k=k.concat(e.y)}a=Math.min.apply(null,d)-1;c=Math.max.apply(null,d)+1;d=Math.min.apply(null,k)-1;k=Math.max.apply(null,k)+1;i=0>a?0:a;h=0>d?0:d;f=c-a;e=k-d}b.push('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+f.toString()+'" height="'+e.toString()+'">');f=0;for(c=j.length;f<c;f++)e=j[f],b.push('<path fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="'+
-D(e,i,h)+'"/>');b.push("</svg>");return b.join("")}function q(b){return[a,p(b)]}function d(a){return[i,b(p(a))]}(function(a,b){"use strict";(typeof exports!=b+""?exports:a).simplify=function(a,c,e){c=c!==b?c*c:1;if(!e){for(var d=a.length,g,h=a[0],i=[h],e=1;e<d;e++){g=a[e];var j=g.x-h.x,o=g.y-h.y;j*j+o*o>c&&(i.push(g),h=g)}a=(h!==g&&i.push(g),i)}g=a;var e=g.length,d=new (typeof Uint8Array!=b+""?Uint8Array:Array)(e),h=0,i=e-1,s,p,q=[],r=[],t=[];for(d[h]=d[i]=1;i;){o=0;for(j=h+1;j<i;j++){s=g[j];var n=
-g[h],B=g[i],w=n.x,u=n.y,n=B.x-w,v=B.y-u,z=void 0;if(0!==n||0!==v)z=((s.x-w)*n+(s.y-u)*v)/(n*n+v*v),1<z?(w=B.x,u=B.y):0<z&&(w+=n*z,u+=v*z);s=(n=s.x-w,v=s.y-u,n*n+v*v);s>o&&(p=j,o=s)}o>c&&(d[p]=1,q.push(h),r.push(p),q.push(p),r.push(i));h=q.pop();i=r.pop()}for(j=0;j<e;j++)d[j]&&t.push(g[j]);return a=t,a}})(this);if("function"!==typeof b)var b=function(a){var b="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9,+,/,=".split(","),
-f,c,e,d,h=0,i=0,j="",j=[];do f=a.charCodeAt(h++),c=a.charCodeAt(h++),e=a.charCodeAt(h++),d=f<<16|c<<8|e,f=d>>18&63,c=d>>12&63,e=d>>6&63,d&=63,j[i++]=b[f]+b[c]+b[e]+b[d];while(h<a.length);j=j.join("");a=a.length%3;return(a?j.slice(0,a-3):j)+"===".slice(a||3)};var a="image/svg+xml",i="image/svg+xml;base64";if(null==this.jQuery)throw Error("We need jQuery for some of the functionality. jQuery is not detected. Failing to initialize...");(function(b){b=b.fn.jSignature;b("addPlugin","export","svg",q);b("addPlugin",
-"export",a,q);b("addPlugin","export","svgbase64",d);b("addPlugin","export",i,d)})(this.jQuery)}).call("undefined"!==typeof window?window:this);
+(function(){function j(a,b){this.x=a;this.y=b;this.reverse=function(){return new this.constructor(-1*this.x,-1*this.y)};this._length=null;this.getLength=function(){this._length||(this._length=Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2)));return this._length};var c=function(a){return Math.round(a/Math.abs(a))};this.resizeTo=function(a){if(0===this.x&&0===this.y)this._length=0;else if(0===this.x)this._length=a,this.y=a*c(this.y);else if(0===this.y)this._length=a,this.x=a*c(this.x);else{var b=Math.abs(this.y/
+this.x),f=Math.sqrt(Math.pow(a,2)/(1+Math.pow(b,2))),b=b*f;this._length=a;this.x=f*c(this.x);this.y=b*c(this.y)}return this};this.angleTo=function(a){var b=this.getLength()*a.getLength();return 0===b?0:Math.acos(Math.min(Math.max((this.x*a.x+this.y*a.y)/b,-1),1))/Math.PI}}function r(a,b){this.x=a;this.y=b;this.getVectorToCoordinates=function(a,b){return new j(a-this.x,b-this.y)};this.getVectorFromCoordinates=function(a,b){return this.getVectorToCoordinates(a,b).reverse()};this.getVectorToPoint=function(a){return new j(a.x-
+this.x,a.y-this.y)};this.getVectorFromPoint=function(a){return this.getVectorToPoint(a).reverse()}}function g(a,b){var c=Math.pow(10,b);return Math.round(a*c)/c}function l(a,b,c){var b=b+1,d=new r(a.x[b-1],a.y[b-1]),e=new r(a.x[b],a.y[b]),e=d.getVectorToPoint(e),f=new r(a.x[b-2],a.y[b-2]),d=f.getVectorToPoint(d);return d.getLength()>c?(c=2<b?(new r(a.x[b-3],a.y[b-3])).getVectorToPoint(f):new j(0,0),a=0.35*d.getLength(),f=d.angleTo(c.reverse()),b=e.angleTo(d.reverse()),c=(new j(c.x+d.x,c.y+d.y)).resizeTo(Math.max(0.05,
+f)*a),e=(new j(d.x+e.x,d.y+e.y)).reverse().resizeTo(Math.max(0.05,b)*a),e=new j(d.x+e.x,d.y+e.y),["c",g(c.x,2),g(c.y,2),g(e.x,2),g(e.y,2),g(d.x,2),g(d.y,2)]):["l",g(d.x,2),g(d.y,2)]}function t(a,b){var c=a.x.length-1,d=new r(a.x[c],a.y[c]),e=new r(a.x[c-1],a.y[c-1]),d=e.getVectorToPoint(d);if(1<c&&d.getLength()>b){var c=(new r(a.x[c-2],a.y[c-2])).getVectorToPoint(e),e=d.angleTo(c.reverse()),f=0.35*d.getLength(),c=(new j(c.x+d.x,c.y+d.y)).resizeTo(Math.max(0.05,e)*f);return["c",g(c.x,2),g(c.y,2),g(d.x,
+2),g(d.y,2),g(d.x,2),g(d.y,2)]}return["l",g(d.x,2),g(d.y,2)]}function C(a,b,c){for(var b=["M",x=a.x[0]-b,y=a.y[0]-c],c=1,d=a.x.length-1;c<d;c++)b.push.apply(b,l(a,c,1));0<d&&b.push.apply(b,t(a,c,1));return b.join(" ")}function n(a){var b=['<?xml version="1.0" encoding="UTF-8" standalone="no"?>','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'],c,d=a.length,e,f=[],h=[],g=e=c=0,p=0,j=[];if(0!==d){for(c=0;c<d;c++){g=a[c];p=[];e={x:[],y:[]};for(var i=
+void 0,l=void 0,i=0,l=g.x.length;i<l;i++)p.push({x:g.x[i],y:g.y[i]});p=simplify(p,0.7,!0);i=0;for(l=p.length;i<l;i++)e.x.push(p[i].x),e.y.push(p[i].y);j.push(e);f=f.concat(e.x);h=h.concat(e.y)}a=Math.min.apply(null,f)-1;d=Math.max.apply(null,f)+1;f=Math.min.apply(null,h)-1;h=Math.max.apply(null,h)+1;g=0>a?0:a;p=0>f?0:f;c=d-a;e=h-f}b.push('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+c.toString()+'" height="'+e.toString()+'">');c=0;for(d=j.length;c<d;c++)e=j[c],b.push('<path fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="'+
+C(e,g,p)+'"/>');b.push("</svg>");return b.join("")}function o(a){return[b,n(a)]}function q(a){return[i,c(n(a))]}(function(a,b){"use strict";(typeof exports!=b+""?exports:a).simplify=function(a,c,e){c=c!==b?c*c:1;if(!e){for(var f=a.length,h,g=a[0],i=[g],e=1;e<f;e++){h=a[e];var j=h.x-g.x,l=h.y-g.y;j*j+l*l>c&&(i.push(h),g=h)}a=(g!==h&&i.push(h),i)}h=a;var e=h.length,f=new (typeof Uint8Array!=b+""?Uint8Array:Array)(e),g=0,i=e-1,n,o,q=[],r=[],t=[];for(f[g]=f[i]=1;i;){l=0;for(j=g+1;j<i;j++){n=h[j];var m=
+h[g],B=h[i],z=m.x,u=m.y,m=B.x-z,w=B.y-u,A=void 0;if(0!==m||0!==w)A=((n.x-z)*m+(n.y-u)*w)/(m*m+w*w),1<A?(z=B.x,u=B.y):0<A&&(z+=m*A,u+=w*A);n=(m=n.x-z,w=n.y-u,m*m+w*w);n>l&&(o=j,l=n)}l>c&&(f[o]=1,q.push(g),r.push(o),q.push(o),r.push(i));g=q.pop();i=r.pop()}for(j=0;j<e;j++)f[j]&&t.push(h[j]);return a=t,a}})(this);if("function"!==typeof c)var c=function(a){var b="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9,+,/,=".split(","),
+c,d,e,f,g=0,j=0,i="",i=[];do c=a.charCodeAt(g++),d=a.charCodeAt(g++),e=a.charCodeAt(g++),f=c<<16|d<<8|e,c=f>>18&63,d=f>>12&63,e=f>>6&63,f&=63,i[j++]=b[c]+b[d]+b[e]+b[f];while(g<a.length);i=i.join("");a=a.length%3;return(a?i.slice(0,a-3):i)+"===".slice(a||3)};var b="image/svg+xml",i="image/svg+xml;base64";if(null==this.jQuery)throw Error("We need jQuery for some of the functionality. jQuery is not detected. Failing to initialize...");(function(a){a=a.fn.jSignature;a("addPlugin","export","svg",o);a("addPlugin",
+"export",b,o);a("addPlugin","export","svgbase64",q);a("addPlugin","export",i,q)})(this.jQuery)}).call("undefined"!==typeof window?window:this);
Please sign in to comment.
Something went wrong with that request. Please try again.