/*! artdialog v6.0.5 | https://github.com/aui/artdialog */ !(function () { var __modules__ = {}; function require(id) { var mod = __modules__[id]; var exports = "exports"; if (typeof mod === "object") { return mod } if (!mod[exports]) { mod[exports] = {}; mod[exports] = mod.call(mod[exports], require, mod[exports], mod) || mod[exports] } return mod[exports] } function define(path, fn) { __modules__[path] = fn } define("jquery", function () { return jquery }); /*! * popupjs * date: 2014-11-09 * https://github.com/aui/popupjs * (c) 2009-2014 tangbin, * * this is licensed under the gnu lgpl, version 2.1 or later. * for details, see: http://www.gnu.org/licenses/lgpl-2.1.html */ define("popup", function (require) { var $ = require("jquery"); var _count = 0; var _isie6 = !("minwidth" in $("html")[0].style); var _isfixed = !_isie6; function popup() { this.destroyed = false; this.__popup = $("
").css({ display: "none", position: "absolute", outline: 0 }).attr("tabindex", "-1").html(this.innerhtml).appendto("body"); this.__backdrop = this.__mask = $("
").css({ opacity: 0.7, background: "#000" }); this.node = this.__popup[0]; this.backdrop = this.__backdrop[0]; _count++ } $.extend(popup.prototype, { node: null, backdrop: null, fixed: false, destroyed: true, open: false, returnvalue: "", autofocus: true, align: "bottom left", innerhtml: "", classname: "ui-popup", show: function (anchor) { if (this.destroyed) { return this } var that = this; var popup = this.__popup; var backdrop = this.__backdrop; this.__activeelement = this.__getactive(); this.open = true; this.follow = anchor || this.follow; if (!this.__ready) { popup.addclass(this.classname).attr("role", this.modal ? "alertdialog" : "dialog").css("position", this.fixed ? "fixed" : "absolute"); if (!_isie6) { $(window).on("resize", $.proxy(this.reset, this)) } if (this.modal) { var backdropcss = { position: "fixed", left: 0, top: 0, width: "100%", height: "100%", overflow: "hidden", userselect: "none", zindex: this.zindex || popup.zindex }; popup.addclass(this.classname + "-modal"); if (!_isfixed) { $.extend(backdropcss, { position: "absolute", width: $(window).width() + "px", height: $(document).height() + "px" }) } backdrop.css(backdropcss).attr({ tabindex: "0" }).on("focus", $.proxy(this.focus, this)); this.__mask = backdrop.clone(true).attr("style", "").insertafter(popup); backdrop.addclass(this.classname + "-backdrop").insertbefore(popup); this.__ready = true } if (!popup.html()) { popup.html(this.innerhtml) } } popup.addclass(this.classname + "-show").show(); backdrop.show(); this.reset().focus(); this.__dispatchevent("show"); return this }, showmodal: function () { this.modal = true; return this.show.apply(this, arguments) }, close: function (result) { if (!this.destroyed && this.open) { if (result !== undefined) { this.returnvalue = result } this.__popup.hide().removeclass(this.classname + "-show"); this.__backdrop.hide(); this.open = false; this.blur(); this.__dispatchevent("close") } return this }, remove: function () { if (this.destroyed) { return this } this.__dispatchevent("beforeremove"); if (popup.current === this) { popup.current = null } this.__popup.remove(); this.__backdrop.remove(); this.__mask.remove(); if (!_isie6) { $(window).off("resize", this.reset) } this.__dispatchevent("remove"); for (var i in this) { delete this[i] } $('[name="test-dialog"]').remove(); return this }, reset: function () { var elem = this.follow; if (elem) { this.__follow(elem) } else { this.__center() } this.__dispatchevent("reset"); return this }, focus: function () { var node = this.node; var popup = this.__popup; var current = popup.current; var index = this.zindex = popup.zindex++; if (current && current !== this) { current.blur(false) } if (!$.contains(node, this.__getactive())) { var autofocus = popup.find("[autofocus]")[0]; if (!this._autofocus && autofocus) { this._autofocus = true } else { autofocus = node } this.__focus(autofocus) } popup.css("zindex", index); popup.current = this; popup.addclass(this.classname + "-focus"); this.__dispatchevent("focus"); return this }, blur: function () { var activeelement = this.__activeelement; var isblur = arguments[0]; if (isblur !== false) { this.__focus(activeelement) } this._autofocus = false; this.__popup.removeclass(this.classname + "-focus"); this.__dispatchevent("blur"); return this }, addeventlistener: function (type, callback) { this.__geteventlistener(type).push(callback); return this }, removeeventlistener: function (type, callback) { var listeners = this.__geteventlistener(type); for (var i = 0; i < listeners.length; i++) { if (callback === listeners[i]) { listeners.splice(i--, 1) } } return this }, __geteventlistener: function (type) { var listener = this.__listener; if (!listener) { listener = this.__listener = {} } if (!listener[type]) { listener[type] = [] } return listener[type] }, __dispatchevent: function (type) { var listeners = this.__geteventlistener(type); if (this["on" + type]) { this["on" + type]() } for (var i = 0; i < listeners.length; i++) { listeners[i].call(this) } }, __focus: function (elem) { try { if (this.autofocus && !/^iframe$/i.test(elem.nodename)) { elem.focus() } } catch (e) { } }, __getactive: function () { try { var activeelement = document.activeelement; var contentdocument = activeelement.contentdocument; var elem = contentdocument && contentdocument.activeelement || activeelement; return elem } catch (e) { } }, __center: function () { var popup = this.__popup; var $window = $(window); var $document = $(document); var fixed = this.fixed; var dl = fixed ? 0 : $document.scrollleft(); var dt = fixed ? 0 : $document.scrolltop(); var ww = $window.width(); var wh = $window.height(); var ow = popup.width(); var oh = popup.height(); var left = (ww - ow) / 2 + dl; var top = (wh - oh) * 382 / 1000 + dt; var style = popup[0].style; style.left = math.max(parseint(left), dl) + "px"; style.top = math.max(parseint(top), dt) + "px" }, __follow: function (anchor) { var $elem = anchor.parentnode && $(anchor); var popup = this.__popup; if (this.__followskin) { popup.removeclass(this.__followskin) } if ($elem) { var o = $elem.offset(); if (o.left * o.top < 0) { return this.__center() } } var that = this; var fixed = this.fixed; var $window = $(window); var $document = $(document); var winwidth = $window.width(); var winheight = $window.height(); var docleft = $document.scrollleft(); var doctop = $document.scrolltop(); var popupwidth = popup.width(); var popupheight = popup.height(); var width = $elem ? $elem.outerwidth() : 0; var height = $elem ? $elem.outerheight() : 0; var offset = this.__offset(anchor); var x = offset.left; var y = offset.top; var left = fixed ? x - docleft : x; var top = fixed ? y - doctop : y; var minleft = fixed ? 0 : docleft; var mintop = fixed ? 0 : doctop; var maxleft = minleft + winwidth - popupwidth; var maxtop = mintop + winheight - popupheight; var css = {}; var align = this.align.split(" "); var classname = this.classname + "-"; var reverse = { top: "bottom", bottom: "top", left: "right", right: "left" }; var name = { top: "top", bottom: "top", left: "left", right: "left" }; var temp = [{ top: top - popupheight, bottom: top + height, left: left - popupwidth, right: left + width }, { top: top, bottom: top - popupheight + height, left: left, right: left - popupwidth + width }]; var center = { left: left + width / 2 - popupwidth / 2, top: top + height / 2 - popupheight / 2 }; var range = { left: [minleft, maxleft], top: [mintop, maxtop] }; $.each(align, function (i, val) { if (temp[i][val] > range[name[val]][1]) { val = align[i] = reverse[val] } if (temp[i][val] < range[name[val]][0]) { align[i] = reverse[val] } }); if (!align[1]) { name[align[1]] = name[align[0]] === "left" ? "top" : "left"; temp[1][align[1]] = center[name[align[1]]] } classname += align.join("-") + " " + this.classname + "-follow"; that.__followskin = classname; if ($elem) { popup.addclass(classname) } css[name[align[0]]] = parseint(temp[0][align[0]]); css[name[align[1]]] = parseint(temp[1][align[1]]); popup.css(css) }, __offset: function (anchor) { var isnode = anchor.parentnode; var offset = isnode ? $(anchor).offset() : { left: anchor.pagex, top: anchor.pagey }; anchor = isnode ? anchor : anchor.target; var ownerdocument = anchor.ownerdocument; var defaultview = ownerdocument.defaultview || ownerdocument.parentwindow; if (defaultview == window) { return offset } var frameelement = defaultview.frameelement; var $ownerdocument = $(ownerdocument); var docleft = $ownerdocument.scrollleft(); var doctop = $ownerdocument.scrolltop(); var frameoffset = $(frameelement).offset(); var frameleft = frameoffset.left; var frametop = frameoffset.top; return { left: offset.left + frameleft - docleft, top: offset.top + frametop - doctop } } }); popup.zindex = 1024; popup.current = null; return popup }); define("dialog-config", { backdropbackground: "#000", backdropopacity: 0.7, content: 'loading..', title: "", statusbar: "", button: null, ok: null, cancel: null, okvalue: "ok", cancelvalue: "cancel", canceldisplay: true, width: "", height: "", padding: "", skin: "", quickclose: false, cssuri: "../css/ui-dialog.css", innerhtml: '
' + '
' + '
' + '' + "" + '" + "" + "" + '" + "" + "" + '" + "" + "
' + '' + '
' + "
' + '
' + "
" + "
" }); /*! * artdialog * date: 2014-11-09 * https://github.com/aui/artdialog * (c) 2009-2014 tangbin, * * this is licensed under the gnu lgpl, version 2.1 or later. * for details, see: http://www.gnu.org/licenses/lgpl-2.1.html */ define("dialog", function (require) { var $ = require("jquery"); var popup = require("popup"); var defaults = require("dialog-config"); var css = defaults.cssuri; if (css) { var fn = require[require.tourl ? "tourl" : "resolve"]; if (fn) { css = fn(css); css = ''; if ($("base")[0]) { $("base").before(css) } else { $("head").append(css) } } } var _count = 0; var _expando = new date() - 0; var _isie6 = !("minwidth" in $("html")[0].style); var _ismobile = "createtouch" in document && !("onmousemove" in document) || /(iphone|ipad|ipod)/i.test(navigator.useragent); var _isfixed = !_isie6 && !_ismobile; var artdialog = function (options, ok, cancel) { var originaloptions = options = options || {}; if (typeof options === "string" || options.nodetype === 1) { options = { content: options, fixed: !_ismobile } } options = $.extend(true, {}, artdialog.defaults, options); options.original = originaloptions; var id = options.id = options.id || _expando + _count; var api = artdialog.get(id); if (api) { return api.focus() } if (!_isfixed) { options.fixed = false } if (options.quickclose) { options.modal = true; options.backdropopacity = 0 } if (!$.isarray(options.button)) { options.button = [] } if (cancel !== undefined) { options.cancel = cancel } if (options.cancel) { options.button.push({ id: "cancel", value: options.cancelvalue, callback: options.cancel, display: options.canceldisplay }) } if (ok !== undefined) { options.ok = ok } if (options.ok) { options.button.push({ id: "ok", value: options.okvalue, callback: options.ok, autofocus: true }) } return artdialog.list[id] = new artdialog.create(options) }; var popup = function () { }; popup.prototype = popup.prototype; var prototype = artdialog.prototype = new popup(); artdialog.create = function (options) { var that = this; $.extend(this, new popup()); var originaloptions = options.original; var $popup = $(this.node).html(options.innerhtml); var $backdrop = $(this.backdrop); this.options = options; this._popup = $popup; $.each(options, function (name, value) { if (typeof that[name] === "function") { that[name](value) } else { that[name] = value } }); if (options.zindex) { popup.zindex = options.zindex } $popup.attr({ "aria-labelledby": this._$("title").attr("id", "title:" + this.id).attr("id"), "aria-describedby": this._$("content").attr("id", "content:" + this.id).attr("id") }); this._$("close").css("display", this.cancel === false ? "none" : "").attr("title", this.cancelvalue).on("click", function (event) { that._trigger("cancel"); event.preventdefault() }); this._$("dialog").addclass(this.skin); this._$("body").css("padding", this.padding); if (options.quickclose) { $backdrop.on("onmousedown" in document ? "mousedown" : "click", function () { that._trigger("cancel"); return false }) } this.addeventlistener("show", function () { $backdrop.css({ opacity: 0, background: options.backdropbackground }).animate({ opacity: options.backdropopacity }, 150) }); this._esc = function (event) { var target = event.target; var nodename = target.nodename; var rinput = /^input|textarea$/i; var istop = popup.current === that; var keycode = event.keycode; if (!istop || rinput.test(nodename) && target.type !== "button") { return } if (keycode === 27) { that._trigger("cancel") } }; $(document).on("keydown", this._esc); this.addeventlistener("remove", function () { $(document).off("keydown", this._esc); delete artdialog.list[this.id] }); _count++; artdialog.oncreate(this); return this }; artdialog.create.prototype = prototype; $.extend(prototype, { content: function (html) { var $content = this._$("content"); if (typeof html === "object") { html = $(html); $content.empty("").append(html.show()); this.addeventlistener("beforeremove", function () { $("body").append(html.hide()) }) } else { $content.html(html) } return this.reset() }, title: function (text) { this._$("title").text(text); this._$("header")[text ? "show" : "hide"](); return this }, width: function (value) { this._$("content").css("width", value); return this.reset() }, height: function (value) { this._$("content").css("height", value); return this.reset() }, button: function (args) { args = args || []; var that = this; var html = ""; var number = 0; this.callbacks = {}; if (typeof args === "string") { html = args; number++ } else { $.each(args, function (i, val) { var id = val.id = val.id || val.value; var style = ""; that.callbacks[id] = val.callback; if (val.display === false) { style = ' style="display:none"' } else { number++ } html += "" + val.value + ""; that._$("button").on("click", "[i-id=" + id + "]", function (event) { var $this = $(this); if (!$this.attr("disabled")) { that._trigger(id) } event.preventdefault() }) }) } this._$("button").html(html); this._$("footer")[number ? "show" : "hide"](); return this }, statusbar: function (html) { this._$("statusbar").html(html)[html ? "show" : "hide"](); return this }, _$: function (i) { return this._popup.find("[i=" + i + "]") }, _trigger: function (id) { var fn = this.callbacks[id]; return typeof fn !== "function" || fn.call(this) !== false ? this.close().remove() : this } }); artdialog.oncreate = $.noop; artdialog.getcurrent = function () { return popup.current }; artdialog.get = function (id) { return id === undefined ? artdialog.list : artdialog.list[id] }; artdialog.list = {}; artdialog.defaults = defaults; return artdialog }); /*! * drag.js * date: 2013-12-06 * https://github.com/aui/artdialog * (c) 2009-2014 tangbin, * * this is licensed under the gnu lgpl, version 2.1 or later. * for details, see: http://www.gnu.org/licenses/lgpl-2.1.html */ define("drag", function (require) { var $ = require("jquery"); var $window = $(window); var $document = $(document); var istouch = "createtouch" in document; var html = document.documentelement; var isie6 = !("minwidth" in html.style); var islosecapture = !isie6 && "onlosecapture" in html; var issetcapture = "setcapture" in html; var types = { start: istouch ? "touchstart" : "mousedown", over: istouch ? "touchmove" : "mousemove", end: istouch ? "touchend" : "mouseup" }; var getevent = istouch ? function (event) { if (!event.touches) { event = event.originalevent.touches.item(0) } return event } : function (event) { return event }; var dragevent = function () { this.start = $.proxy(this.start, this); this.over = $.proxy(this.over, this); this.end = $.proxy(this.end, this); this.onstart = this.onover = this.onend = $.noop }; dragevent.types = types; dragevent.prototype = { start: function (event) { event = this.startfix(event); $document.on(types.over, this.over).on(types.end, this.end); this.onstart(event); return false }, over: function (event) { event = this.overfix(event); this.onover(event); return false }, end: function (event) { event = this.endfix(event); $document.off(types.over, this.over).off(types.end, this.end); this.onend(event); return false }, startfix: function (event) { event = getevent(event); this.target = $(event.target); this.selectstart = function () { return false }; $document.on("selectstart", this.selectstart).on("dblclick", this.end); if (islosecapture) { this.target.on("losecapture", this.end) } else { $window.on("blur", this.end) } if (issetcapture) { this.target[0].setcapture() } return event }, overfix: function (event) { event = getevent(event); return event }, endfix: function (event) { event = getevent(event); $document.off("selectstart", this.selectstart).off("dblclick", this.end); if (islosecapture) { this.target.off("losecapture", this.end) } else { $window.off("blur", this.end) } if (issetcapture) { this.target[0].releasecapture() } return event } }; dragevent.create = function (elem, event) { var $elem = $(elem); var dragevent = new dragevent(); var starttype = dragevent.types.start; var noop = function () { }; var classname = elem.classname.replace(/^\s|\s.*/g, "") + "-drag-start"; var minx; var miny; var maxx; var maxy; var api = { onstart: noop, onover: noop, onend: noop, off: function () { $elem.off(starttype, dragevent.start) } }; dragevent.onstart = function (event) { var isfixed = $elem.css("position") === "fixed"; var dl = $document.scrollleft(); var dt = $document.scrolltop(); var w = $elem.width(); var h = $elem.height(); minx = 0; miny = 0; maxx = isfixed ? $window.width() - w + minx : $document.width() - w; maxy = isfixed ? $window.height() - h + miny : $document.height() - h; var offset = $elem.offset(); var left = this.startleft = isfixed ? offset.left - dl : offset.left; var top = this.starttop = isfixed ? offset.top - dt : offset.top; this.clientx = event.clientx; this.clienty = event.clienty; $elem.addclass(classname); api.onstart.call(elem, event, left, top) }; dragevent.onover = function (event) { var left = event.clientx - this.clientx + this.startleft; var top = event.clienty - this.clienty + this.starttop; var style = $elem[0].style; left = math.max(minx, math.min(maxx, left)); top = math.max(miny, math.min(maxy, top)); style.left = left + "px"; style.top = top + "px"; api.onover.call(elem, event, left, top) }; dragevent.onend = function (event) { var position = $elem.position(); var left = position.left; var top = position.top; $elem.removeclass(classname); api.onend.call(elem, event, left, top) }; dragevent.off = function () { $elem.off(starttype, dragevent.start) }; if (event) { dragevent.start(event) } else { $elem.on(starttype, dragevent.start) } return api }; return dragevent }); /*! * artdialog-plus * date: 2013-11-09 * https://github.com/aui/artdialog * (c) 2009-2014 tangbin, * * this is licensed under the gnu lgpl, version 2.1 or later. * for details, see: http://www.gnu.org/licenses/lgpl-2.1.html */ define("dialog-plus", function (require) { var $ = require("jquery"); var dialog = require("dialog"); var drag = require("drag"); dialog.oncreate = function (api) { var options = api.options; var originaloptions = options.original; var url = options.url; var oniframeload = options.oniframeload; var $iframe; if (url) { this.padding = options.padding = 0; $iframe = $("