!function (L) { L.fn.extend({ sigpad: function (w) { return w = L.extend({ lineWidth: 3, lineCap: "round", lineJoin: "round", miterLimit: 10, strokeStyle: "black", fillStyle: "none", showClear: !1, clearLabel: "Clear", clearStyle: "button" }, w), this.each(function () { if ("CANVAS" === this.nodeName) { if (L(this).css("cursor", "pointer"), L(this).attr("onclick", "function onclick(event) { void 1; }"), this.getContext) { var e = this, o = this.getContext("2d"), n = L(this).attr("id"); L(this).after('
'), o.underInteractionEnabled = !0, o.lineWidth = w.lineWidth, o.lineCap = w.lineCap, o.lineJoin = w.lineJoin, o.miterLimit = w.miterLimit, o.strokeStyle = w.strokeStyle, o.fillStyle = w.fillStyle; var l = n + "-data"; L(this).after(''); var i = !1, r = L("#" + n).height(), c = L("#" + n).width(), s = "", a = 0, u = 0, d = L(this).attr("offsetLeft"), h = L(this).attr("offsetTop"), f = !1, v = !1, m = !1, p = !1, t = L("#sigpad"); if (t.mousedown(function (t) { S(t) }), t.mousemove(function (t) { k(t) }), t.mouseup(function () { C() }), t.bind("touchstart", function (t) { S(t) }), t.bind("touchmove", function (t) { k(t) }), t.bind("touchend", function () { C() }), t.bind("touchcancel", function () { C() }), !0 === w.showClear) { var g = "link" == w.clearStyle ? "div" : "button"; L("#" + n + "-controls").append("<" + g + ' id="' + n + '-clear" style="float:left">' + w.clearLabel + "
'), clear = !0 } function b(t) { return u = "undefined" != typeof event && void 0 !== event.touches ? (t = event.touches.item(0), a = document.body.scrollLeft, document.body.scrollTop) : (a = L(document).scrollLeft(), L(document).scrollTop()), 0 != m && (v = m, p), m = t.clientX - (d - a), p = t.clientY - (h - u), t } function y(t) { if ("stop" != t) { if ("start" == t) { if (v = f = !1, o.beginPath(), o.moveTo(m, p), "" == s) { var e = new Date, n = e.getFullYear() + ":" + (e.getMonth() + 1) + ":" + e.getDate() + ":" + e.getHours() + ":" + e.getMinutes() + ":" + e.getSeconds(); s = "{version=1 width=" + c + " height=" + r + " captured=" + n + "}" } "" != s && (s += "X") } else 0 == v && (m += 1, p += 1), o.lineTo(m, p); o.stroke(), 0 < s.length && '"' != s.substring(s.length - 1) && (s += " "), s = s + m + "," + p, 0 < m && m <= c && 0 < p && p <= r && (f = !0) } else if (y("move"), 1 == f) { var i = L("#" + l); i.val(); i.val(s) } } function S(t) { 1 == f && t.preventDefault(), i = !0, t = b(t), o.strokeStyle = L("#" + n + "-colors div.selected").css("backgroundColor"), y("start") } function k(t) { return 1 == f && t.preventDefault(), 1 == i && (t = b(t), y("move")), !1 } function C() { i = !1, y("stop") } L("#" + n + "-clear").click(function (t) { o.save(), o.beginPath(), o.closePath(), o.restore(), o.clearRect(0, 0, L(e).width(), L(e).height()), L("#" + l).val("") }) } } else alert("Not a CANVAS element") }) } }) }(jQuery);