/*! * mustache.js - logic-less {{mustache}} templates with javascript * http://github.com/janl/mustache.js */ (function(a, b) { if (typeof exports === "object" && exports) { b(exports) } else { var c = {}; b(c); if (typeof define === "function" && define.amd) { define(c) } else { a.mustache = c } } } (this, function(a) { var f = /\s*/; var m = /\s+/; var k = /\s/; var i = /\s*=/; var o = /\s*\}/; var t = /#|\^|\/|>|\{|&|=|!/; var g = regexp.prototype.test; function s(z, y) { return g.call(z, y) } function h(y) { return ! s(k, y) } var v = object.prototype.tostring; var l = array.isarray || function(y) { return v.call(y) === "[object array]" }; function b(y) { return typeof y === "function" } function e(y) { return y.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&") } var d = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'", "/": "/" }; function n(y) { return string(y).replace(/[&<>"'\/]/g, function(z) { return d[z] }) } function r(y) { if (!l(y) || y.length !== 2) { throw new error("invalid tags: " + y) } return [new regexp(e(y[0]) + "\\s*"), new regexp("\\s*" + e(y[1]))] } function x(o, e) { e = e || a.tags; o = o || ""; if (typeof e === "string") { e = e.split(m) } var i = r(e); var a = new u(o); var g = []; var f = []; var d = []; var p = false; var n = false; function m() { if (p && !n) { while (d.length) { delete f[d.pop()] } } else { d = [] } p = false; n = false } var b, z, h, j, c, y; while (!a.eos()) { b = a.pos; h = a.scanuntil(i[0]); if (h) { for (var k = 0, l = h.length; k < l; ++k) { j = h.charat(k); if (h(j)) { d.push(f.length) } else { n = true } f.push(["text", j, b, b + 1]); b += 1; if (j === "\n") { m() } } } if (!a.scan(i[0])) { break } p = true; z = a.scan(t) || "name"; a.scan(f); if (z === "=") { h = a.scanuntil(i); a.scan(i); a.scanuntil(i[1]) } else { if (z === "{") { h = a.scanuntil(new regexp("\\s*" + e("}" + e[1]))); a.scan(o); a.scanuntil(i[1]); z = "&" } else { h = a.scanuntil(i[1]) } } if (!a.scan(i[1])) { throw new error("unclosed tag at " + a.pos) } c = [z, h, b, a.pos]; f.push(c); if (z === "#" || z === "^") { g.push(c) } else { if (z === "/") { y = g.pop(); if (!y) { throw new error('unopened section "' + h + '" at ' + b) } if (y[1] !== h) { throw new error('unclosed section "' + y[1] + '" at ' + b) } } else { if (z === "name" || z === "{" || z === "&") { n = true } else { if (z === "=") { i = r(e = h.split(m)) } } } } } y = g.pop(); if (y) { throw new error('unclosed section "' + y[1] + '" at ' + a.pos) } return w(c(f)) } function c(d) { var a = []; var c, z; for (var b = 0, y = d.length; b < y; ++b) { c = d[b]; if (c) { if (c[0] === "text" && z && z[0] === "text") { z[1] += c[1]; z[3] = c[3] } else { a.push(c); z = c } } } return a } function w(d) { var f = []; var c = f; var e = []; var a, b; for (var z = 0, y = d.length; z < y; ++z) { a = d[z]; switch (a[0]) { case "#": case "^": c.push(a); e.push(a); c = a[4] = []; break; case "/": b = e.pop(); b[5] = a[2]; c = e.length > 0 ? e[e.length - 1][4] : f; break; default: c.push(a) } } return f } function u(y) { this.string = y; this.tail = y; this.pos = 0 } u.prototype.eos = function() { return this.tail === "" }; u.prototype.scan = function(a) { var z = this.tail.match(a); if (z && z.index === 0) { var y = z[0]; this.tail = this.tail.substring(y.length); this.pos += y.length; return y } return "" }; u.prototype.scanuntil = function(a) { var z = this.tail.search(a), y; switch (z) { case - 1 : y = this.tail; this.tail = ""; break; case 0: y = ""; break; default: y = this.tail.substring(0, z); this.tail = this.tail.substring(z) } this.pos += y.length; return y }; function q(z, y) { this.view = z == null ? {}: z; this.cache = { ".": this.view }; this.parent = y } q.prototype.push = function(y) { return new q(y, this) }; q.prototype.lookup = function(y) { var b; if (y in this.cache) { b = this.cache[y] } else { var a = this; while (a) { if (y.indexof(".") > 0) { b = a.view; var c = y.split("."), z = 0; while (b != null && z < c.length) { b = b[c[z++]] } } else { b = a.view[y] } if (b != null) { break } a = a.parent } this.cache[y] = b } if (b(b)) { b = b.call(this.view) } return b }; function p() { this.cache = {} } p.prototype.clearcache = function() { this.cache = {} }; p.prototype.parse = function(a, z) { var y = this.cache; var b = y[a]; if (b == null) { b = y[a] = x(a, z) } return b }; p.prototype.render = function(b, y, a) { var c = this.parse(b); var z = (y instanceof q) ? y: new q(y); return this.rendertokens(c, z, a, b) }; p.prototype.rendertokens = function(g, y, e, i) { var c = ""; var k = this; function z(l) { return k.render(l, y, e) } var a, h; for (var d = 0, f = g.length; d < f; ++d) { a = g[d]; switch (a[0]) { case "#": h = y.lookup(a[1]); if (!h) { continue } if (l(h)) { for (var b = 0, j = h.length; b < j; ++b) { c += this.rendertokens(a[4], y.push(h[b]), e, i) } } else { if (typeof h === "object" || typeof h === "string") { c += this.rendertokens(a[4], y.push(h), e, i) } else { if (b(h)) { if (typeof i !== "string") { throw new error("cannot use higher-order sections without the original template") } h = h.call(y.view, i.slice(a[3], a[5]), z); if (h != null) { c += h } } else { c += this.rendertokens(a[4], y, e, i) } } } break; case "^": h = y.lookup(a[1]); if (!h || (l(h) && h.length === 0)) { c += this.rendertokens(a[4], y, e, i) } break; case ">": if (!e) { continue } h = b(e) ? e(a[1]) : e[a[1]]; if (h != null) { c += this.rendertokens(this.parse(h), y, e, h) } break; case "&": h = y.lookup(a[1]); if (h != null) { c += h } break; case "name": h = y.lookup(a[1]); if (h != null) { c += a.escape(h) } break; case "text": c += a[1]; break } } return c }; a.name = "mustache.js"; a.version = "0.8.1"; a.tags = ["{{", "}}"]; var j = new p(); a.clearcache = function() { return j.clearcache() }; a.parse = function(z, y) { return j.parse(z, y) }; a.render = function(a, y, z) { return j.render(a, y, z) }; a.to_html = function(b, z, a, c) { var y = a.render(b, z, a); if (b(c)) { c(y) } else { return y } }; a.escape = n; a.scanner = u; a.context = q; a.writer = p })); /*! * zeromodal.js * http://git.oschina.net/cylansad/zeromodal * * copyright 2016, sad */ (function(a) { if (typeof module !== "undefined" && typeof exports === "object" && define.cmd) { module.exports = a } else { if (typeof define === "function" && define.amd) { define(function() { return a }) } else { window.zeromodal = a } } } ((function(f, h) { var z = {}; var g = '
'; var v = '
'; v += ' {{#drag}}
{{/drag}}'; v += '
'; v += ' {{#close}}
{{/close}}'; v += ' {{#max}}
{{/max}}'; v += ' {{#min}}
{{/min}}'; v += ' {{#escape}}{{&title}}{{/escape}}{{^escape}}{{title}}{{/escape}}'; v += "
"; v += '
'; v += ' {{#url}}
{{#iframe}}{{/iframe}}{{/url}}'; v += "
"; v += ' {{#resize}}
{{/resize}}'; v += "
"; var u = '{{#icondisplay}}{{&icondisplay}}{{/icondisplay}}{{^icondisplay}}
{{&icontext}}
{{/icondisplay}}'; u += '
{{&_content}}
'; u += '
{{&contentdetail}}
'; var w = { unique: "", title: "", content: "", escape: true, url: false, ajaxtype: "get", ajaxdata: {}, iframe: false, width: "500px", height: "300px", top: h, left: h, transition: false, opacity: 0.2, overlay: true, overlayclose: false, forbidbodyscroll: false, forbidbodyscrollclass: h, drag: true, draghandle: "top", close: true, max: false, min: false, minposition: h, resize: false, resizeafterfn: h, ok: false, oktitle: "确定", okfn: false, cancel: false, canceltitle: "关闭", cancelfn: true, buttontopline: true, buttons: [], esc: false, onopen: false, onload: false, oncomplete: false, oncleanup: false, onclosed: false }; var e = false; var t = 10000; var m = {}; var r = false; var l = false; f(function() { if (document.body.style.overflow != "hidden" && document.body.scroll != "no" && document.body.scrollheight > document.body.offsetheight) { r = true } }); z.show = function(b) { var c = o(b); j(c); e = true; f(window).resize(function() { if (e) { i(c) } }); return c.unique }; z.close = function(b) { b({ unique: b }); e = false; delete m[b] }; z.closeall = function() { f('[role="zeromodal-loading"]').remove(); f(".zeromodal-overlay").remove(); f(".zeromodal-container").each(function() { var d = f(this); var c = d.attr("zero-unique-container"); if (c !== h && m[c] !== h) { var b = m[c]; if (typeof b.oncleanup === "function") { b.oncleanup(b) } d.remove(); if (typeof b.onclosed === "function") { b.onclosed(b) } delete m[c] } }); e = false }; z.loading = function(e) { var h = o(); y(h); t++; var g = f(window).scrolltop() + math.ceil(f(window).height() / 3); if (e === h) { e = 1 } if (e === 1 || e === 2) { var f = "zeromodal-loading" + e; f("body").append('
') } else { if (k([3, 4, 5, 6], e)) { var b = {}; switch (e) { case 3: b.classname = "pacman"; b.containercount = 5; break; case 4: b.classname = "line-scale-pulse-out"; b.containercount = 5; break; case 5: b.classname = "line-spin-fade-loader"; b.containercount = 8; break; case 6: b.classname = "square-spin"; b.containercount = 1; break } var c = '
'; for (var d = 0; d < b.containercount; d++) { c += "
" } c += "
"; f("body").append(c) } } return h.unique }; z.progress = function(h, b) { var e = o(); y(e); t++; if (h === h) { h = 3 } var j = f(window).scrolltop() + math.ceil(f(window).height() / 3); var i = {}; switch (h) { case 3: i.classname = "pacman"; i.containercount = 5; break; case 4: i.classname = "line-scale-pulse-out"; i.containercount = 5; break; case 5: i.classname = "line-spin-fade-loader"; i.containercount = 8; break; case 6: i.classname = "square-spin"; i.containercount = 1; break } var c = '
'; for (var g = 0; g < i.containercount; g++) { c += "
" } c += "
"; c += '
'; c += ""; f("body").append(c); var f = 0; var d = setinterval(function() { f.ajax({ url: b.getprogressurl + "?_=" + new date().gettime(), datatype: "json", type: "get", success: function(k) { f("#progess_content_" + e.unique).html(k.progress); if (k.progress === "finish") { clearinterval(d); f.get(b.clearprogressurl); z.close(e.unique) } } }); f++; if (f >= 500) { clearinterval(d) } }, 500); return e.unique }; z.progress_old = function(d) { var g = o(); y(g); t++; var j = f(window).scrolltop() + math.ceil(f(window).height() / 3); var k = f(window).width() / 2 - 200; var h = 1; if (d !== h && d > h && d < 10) { h = d } var c = '
'; c += '
'; c += '
 0%
'; c += "
"; c += "
"; f("body").append(c); var b = 0; var i = f('[zeromodal-progress-bar="' + g.unique + '"]'); var f = f('[zeromodal-progress-val="' + g.unique + '"]'); var e = setinterval(function() { b += 1; i.css("width", b + "%"); f.html((b > 9 ? b: " " + b) + "%"); if (b >= 100) { f.html(''); clearinterval(e) } }, h * 100); return g.unique }; z.alert = function(c) { var b = { iconclass: "show-zero2 zeromodal-icon-info", icontext: "!" }; var d = {}; f.extend(d, b); if (typeof c === "object") { f.extend(d, c) } else { d.content = c } q(d) }; z.error = function(b) { var c = { icondisplay: '
' }; if (typeof b === "object") { f.extend(c, b) } else { c.content = b } q(c) }; z.success = function(b) { var c = { icondisplay: '
' }; if (typeof b === "object") { f.extend(c, b) } else { c.content = b } q(c) }; z.confirm = function(d, c) { var b = { iconclass: "show-zero2 zeromodal-icon-question", icontext: "?", }; var e = {}; f.extend(e, b); if (typeof c === "function") { e.okfn = c } e.cancel = true; if (typeof d === "object") { f.extend(e, d) } else { e.content = d } q(e) }; function o(b) { var c = {}; f.extend(c, w); f.extend(c, b); if (typeof c.unique === "undefined" || c.unique === "") { c.unique = c() } m[c.unique] = c; return c } function j(b) { if (typeof b.onopen === "function") { b.onopen(b) } y(b); n(b) } function b(b) { if (typeof b === "object") { if (typeof b.oncleanup === "function") { b.oncleanup() } f('[zero-unique-overlay="' + b.unique + '"]').remove(); f('[zero-unique-container="' + b.unique + '"]').remove(); f('[zero-unique-loading="' + b.unique + '"]').remove(); f("body").removeclass("zeromodal-overflow-hidden"); if (b.forbidbodyscrollclass !== h) { f("body").removeclass(b.forbidbodyscrollclass) } if (typeof b.onclosed === "function") { b.onclosed() } } } function y(c) { t++; c._tmp_last_zindex = t; c._width = f(document).width(); c._height = f(document).height(); if (c.overlay) { var b = f(mustache.render(g, c)); f("body").append(b); if (c.overlayclose) { b.css("cursor", "pointer"); b.click(function() { b(c) }) } else { b.click(function() { x(f('[zero-unique-container="' + c.unique + '"]')) }) } } } function n(d) { t++; var f = d.width.replace("px", ""); var h = d.height.replace("px", ""); var c = f(window).width(); var g = f(window).height(); if (f.indexof("%") !== -1) { f = (c * parseint(f.replace("%", "")) / 100) } if (h.indexof("%") !== -1) { h = (g * parseint(h.replace("%", "")) / 100) } if (typeof f === "string") { f = parseint(f) } if (typeof h === "string") { h = parseint(h) } var l = ((c - f) / 2) + "px"; var k = (f(window).scrolltop() + math.ceil((f(window).height() - h) / 3)) + "px"; if (d.top !== h) { k = d.top } if (d.left !== h) { l = d.left } d._tmp_last_zindex = t; d._width = f; d._height = h; d._left = l; d._top = k; f("body").append(mustache.render(v, d)); if (d.drag) { var b; if (d.draghandle === "container") { b = f('[zero-unique-container="' + d.unique + '"]')[0] } else { b = f('[zero-unique-top="' + d.unique + '"]')[0] } new a(f('[zero-unique-container="' + d.unique + '"]')[0], { handle: b, limit: false }) } f('[zero-close-unique="' + d.unique + '"]').click(function() { b(m[f(this).attr("zero-close-unique")]) }); f('[zero-max-unique="' + d.unique + '"]').click(function() { var m = f('[zeromodal-unqiue-header="' + d.unique + '"]'); f('[zero-title-unique="' + d.unique + '"]').removeclass("modal-title-min"); f('[zero-unique-body="' + d.unique + '"]').show(); f('[zero-unique-container="' + d.unique + '"]').removeclass("zeromodal-fixed"); if (m.attr("zero-status") !== "2") { i(m[f(this).attr("zero-max-unique")], "90%", "85%"); m.attr("zero-status", "2") } else { i(m[f(this).attr("zero-max-unique")]); m.attr("zero-status", "1") } p(d) }); f('[zero-min-unique="' + d.unique + '"]').click(function() { var o = f('[zeromodal-unqiue-header="' + d.unique + '"]'); var n = f('[zero-unique-container="' + d.unique + '"]'); var p = f('[zero-unique-body="' + d.unique + '"]'); if (o.attr("zero-status") !== "0") { p.hide(); n.css("height", "22px").css("width", "220px").addclass("zeromodal-fixed"); f('[zero-title-unique="' + d.unique + '"]').addclass("modal-title-min"); if (d.minposition !== h && d.minposition !== "") { var m = d.minposition.split(","); if (m.length === 2) { n.css("left", m[0] + "px").css("top", (parseint(m[1]) + f(window).scrolltop()) + "px") } } o.attr("zero-status", "0") } else { f('[zero-title-unique="' + d.unique + '"]').removeclass("modal-title-min"); p.show(); n.removeclass("zeromodal-fixed"); i(m[f(this).attr("zero-min-unique")]); o.attr("zero-status", "1") } }); if (d.transition) { f(".zeromodal-container").animate({ top: k }, 300) } p(d); if (d.resize) { a(d.unique, d) } if (typeof d.onload === "function") { d.onload(d) } var e = f('[zero-unique-body="' + d.unique + '"]'); if (!d.url) { e.addclass("zeromodal-overflow-y"); if (d.escape) { e.html(d.content) } else { e.text(d.content) } if (typeof d.oncomplete === "function") { d.oncomplete(d) } } else { e.append('
'); if (d.iframe) { var j = f('[zero-unique-frame="' + d.unique + '"]'); j.load(function() { f(".zeromodal-loading1").remove(); if (typeof d.oncomplete === "function") { d.oncomplete(d) } }) } else { e.addclass("zeromodal-overflow-y"); f.ajax({ url: d.url, datatype: "html", type: d.ajaxtype, data: d.ajaxdata, success: function(m) { e.append(m); f(".zeromodal-loading1").remove(); if (typeof d.oncomplete === "function") { d.oncomplete(d) } } }) } } if (d.forbidbodyscroll) { var i = f("body"); if (d.forbidbodyscrolloffset !== h && r && d.forbidbodyscrollclass !== h) { i.addclass(d.forbidbodyscrollclass) } i.addclass("zeromodal-overflow-hidden") } d(d, f('[zero-unique-container="' + d.unique + '"]')); if (d.esc) { f("body").one("keyup", function(m) { if (m.keycode === 27) { b(d) } }) } } function d(g, d) { if (g.ok || g.cancel || (g.buttons !== h && g.buttons.length > 0)) { var c = '"; d.append(c); if (g.buttons !== h && g.buttons.length > 0) { for (var f = 0; f < g.buttons.length; f++) { var b = g.buttons[f]; var e = f('"); if (typeof b.fn === "function") { (function(j) { e.click(function() { var k = j.fn(g); if (typeof k === "undefined" || k) { b(g) } }) } (b)) } f('[zeromodal-btn-container="' + g.unique + '"]').append(e) } } else { if (g.ok) { var h = f('"); f('[zeromodal-btn-container="' + g.unique + '"]').append(h); h.click(function() { if (typeof g.okfn === "function") { var j = g.okfn(); if (typeof j === "undefined" || j) { b(g) } } else { b(g) } }) } if (g.cancel) { var i = f('"); f('[zeromodal-btn-container="' + g.unique + '"]').append(i); i.click(function() { if (typeof g.cancelfn === "function") { var j = g.cancelfn(); if (typeof j === "undefined" || j) { b(g) } } else { b(g) } }) } } } } function q(c) { if (typeof c === "undefined" || typeof c.canceltitle === "undefined") { c.canceltitle = "取消" } if (typeof c.width === "undefined") { c.width = "350px" } if (typeof c.height === "undefined") { c.height = "300px" } var d = o(c); d.esc = true; if (typeof c.ok === "undefined") { d.ok = true } d.buttontopline = false; if (typeof _okfn !== "undefined") { d.okfn = _okfn } if (typeof cancelfn !== "undefined") { d.cancelfn = cancelfn } d._content = d.content || ""; d.content = ""; j(d); var b = f('[zero-unique-body="' + d.unique + '"]'); b.append(mustache.render(u, d)); b.removeclass("zeromodal-overflow-y"); f('[zero-unique-body="' + d.unique + '"]').removeclass("zeromodal-overflow-y"); f('[zeromodal-btn-ok="' + d.unique + '"]').focus(); e = true; f(window).resize(function() { if (e) { i(d) } }) } function i(d, c, i) { var e = f('[zero-unique-container="' + d.unique + '"]'); f('[zero-unique-overlay="' + d.unique + '"]').css("width", f(document).width() + "px").css("height", f(document).height() + "px"); var b = f(window).width(); var g = f(window).height(); var f = c !== h ? c.replace("px", "") : d.width.replace("px", ""); var h = i !== h ? i.replace("px", "") : d.height.replace("px", ""); if (f.indexof("%") !== -1) { f = (b * parseint(f.replace("%", "")) / 100) } if (h.indexof("%") !== -1) { h = (g * parseint(h.replace("%", "")) / 100) } if (typeof f === "string") { f = parseint(f) } if (typeof h === "string") { h = parseint(h) } var k = ((b - f) / 2) + "px"; var j = (f(window).scrolltop() + math.ceil((f(window).height() - h) / 3)) + "px"; if (d.left !== h) { k = d.left } if (d.top !== h) { j = d.top } e.css("width", f + "px").css("height", h + "px").css("left", k).css("top", j) } function s(g) { var c = f(window).width(); var e = f(window).height(); var d = f('[zero-unique-container="' + g.unique + '"]'); var b = parseint(d.css("width").replace("px", "")); var f = parseint(d.css("height").replace("px", "")); var h = (c - b) / 2; var i = f(window).scrolltop() + math.ceil((f(window).height() - f) / 3); d.css("left", h + "px").css("top", i + "px") } function p(d) { var c = f('[zeromodal-unqiue-header="' + d.unique + '"]').height(); var e = (d.ok || d.cancel || (d.buttons !== h && d.buttons.length > 0)) ? 60 : 0; var b = f('[zero-unique-container="' + d.unique + '"]').height() - c - 10 - e; f('[zero-unique-body="' + d.unique + '"]').css("height", b) } function x(d) { if (d.length === 0) { return } var c = d.position().left; for (var b = 0; b < 2; b++) { d.animate({ left: c - 2 }, 50); d.animate({ left: c }, 50); d.animate({ left: c + 2 }, 50) } d.animate({ left: c }, 50) } function k(b, d) { for (var c = 0; c < b.length; c++) { if (b[c] === d) { return true } } return false } function c() { var e = []; var b = "0123456789abcdef"; for (var c = 0; c < 36; c++) { e[c] = b.substr(math.floor(math.random() * 16), 1) } e[14] = "4"; e[19] = b.substr((e[19] & 3) | 8, 1); e[8] = e[13] = e[18] = e[23] = ""; var d = e.join(""); return d } function a(h, e) { var i; var c; var b; var f = false; var g = f('[zero-unique-sweep-tee="' + h + '"]')[0]; var d = f('[zero-unique-body="' + h + '"]')[0]; document.onmousemove = function(j) { if (f('[zero-unique-container="' + e.unique + '"]').size() === 0) { return } c = j.pagex; b = j.pagey; if (i !== h) { f = true } }; g.onmousedown = function() { document.onselectstart = function() { return false }; var j = b - g.offsettop; var k = c - g.offsetleft; i = setinterval(function() { if (i && f) { var m = c - k; var l = b - j; f(".zeromodal-container").css("width", m + 3 + "px").css("height", l + 3 + "px") } }, 5) }; document.onmouseup = function() { if (f('[zero-unique-container="' + e.unique + '"]').size() === 0) { return } document.onselectstart = function() { return true }; clearinterval(i); i = h; f = false; s(e); p(e); if (e.resizeafterfn !== h && typeof e.resizeafterfn === "function") { e.resizeafterfn(e) } } } function a() { this.initialize.apply(this, arguments) } a.prototype = { initialize: function(c, b) { this.drag = c; this._x = this._y = 0; this._movedrag = this.bind(this, this.movedrag); this._stopdrag = this.bind(this, this.stopdrag); this.setoptions(b); this.handle = this.options.handle; this.maxcontainer = this.options.maxcontainer; this.maxtop = math.max(this.maxcontainer.clientheight, this.maxcontainer.scrollheight) - this.drag.offsetheight; this.maxleft = math.max(this.maxcontainer.clientwidth, this.maxcontainer.scrollwidth) - this.drag.offsetwidth; this.limit = this.options.limit; this.lockx = this.options.lockx; this.locky = this.options.locky; this.lock = this.options.lock; this.onstart = this.options.onstart; this.onmove = this.options.onmove; this.onstop = this.options.onstop; this.handle.style.cursor = "move"; this.changelayout(); this.addhandler(this.handle, "mousedown", this.bind(this, this.startdrag)) }, changelayout: function() { this.drag.style.top = this.drag.offsettop + "px"; this.drag.style.left = this.drag.offsetleft + "px"; this.drag.style.position = "absolute"; this.drag.style.margin = "0" }, startdrag: function(b) { var c = b || window.event; this._x = c.clientx - this.drag.offsetleft; this._y = c.clienty - this.drag.offsettop; this.addhandler(document, "mousemove", this._movedrag); this.addhandler(document, "mouseup", this._stopdrag); if (c.preventdefault) { c.preventdefault() } if (this.handle.setcapture) { this.handle.setcapture() } this.onstart() }, movedrag: function(b) { var e = b || window.event; var d = e.clienty - this._y; var c = e.clientx - this._x; if (this.lock) { return } if (!this.locky) { this.drag.style.top = d + "px" } if (!this.lockx) { this.drag.style.left = c + "px" } if (e.preventdefault) { e.preventdefault() } this.onmove() }, stopdrag: function() { this.removehandler(document, "mousemove", this._movedrag); this.removehandler(document, "mouseup", this._stopdrag); if (this.handle.releasecapture) { this.handle.releasecapture() } this.onstop() }, setoptions: function(b) { this.options = { handle: this.drag, limit: true, lock: false, lockx: false, locky: false, maxcontainer: document.documentelement || document.body, onstart: function() {}, onmove: function() {}, onstop: function() {} }; for (var c in b) { this.options[c] = b[c] } }, addhandler: function(c, d, b) { return c.addeventlistener ? c.addeventlistener(d, b, false) : c.attachevent("on" + d, b) }, removehandler: function(c, d, b) { return c.removeeventlistener ? c.removeeventlistener(d, b, false) : c.detachevent("on" + d, b) }, bind: function(c, b) { return function() { return b.apply(c, arguments) } } }; return z } (jquery))));