artDialog.js 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. /*!
  2. * artDialog 4.1.7
  3. * Date: 2013-03-03 08:04
  4. * http://code.google.com/p/artdialog/
  5. * (c) 2009-2012 TangBin, http://www.planeArt.cn
  6. *
  7. * This is licensed under the GNU LGPL, version 2.1 or later.
  8. * For details, see: http://creativecommons.org/licenses/LGPL/2.1/
  9. */
  10. (function (e, t) {
  11. function h(e, t, n) {
  12. t = t || document, n = n || "*";
  13. var r = 0, i = 0, s = [], o = t.getElementsByTagName(n), u = o.length, a = new RegExp("(^|\\s)" + e + "(\\s|$)");
  14. for (; r < u; r++)a.test(o[r].className) && (s[i] = o[r], i++);
  15. return s
  16. }
  17. function p(r) {
  18. var i = n.expando, s = r === e ? 0 : r[i];
  19. return s === t && (r[i] = s = ++n.uuid), s
  20. }
  21. function d() {
  22. if (n.isReady)return;
  23. try {
  24. document.documentElement.doScroll("left")
  25. } catch (e) {
  26. setTimeout(d, 1);
  27. return
  28. }
  29. n.ready()
  30. }
  31. function v(e) {
  32. return n.isWindow(e) ? e : e.nodeType === 9 ? e.defaultView || e.parentWindow : !1
  33. }
  34. var n = e.art = function (e, t) {
  35. return new n.fn.init(e, t)
  36. }, r = !1, i = [], s, o = "opacity" in document.documentElement.style, u = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/, a = /[\n\t]/g, f = /alpha\([^)]*\)/i, l = /opacity=([^)]*)/, c = /^([+-]=)?([\d+-.]+)(.*)$/;
  37. return e.$ === t && (e.$ = n), n.fn = n.prototype = {
  38. constructor: n, ready: function (e) {
  39. return n.bindReady(), n.isReady ? e.call(document, n) : i && i.push(e), this
  40. }, hasClass: function (e) {
  41. var t = " " + e + " ";
  42. return (" " + this[0].className + " ").replace(a, " ").indexOf(t) > -1 ? !0 : !1
  43. }, addClass: function (e) {
  44. return this.hasClass(e) || (this[0].className += " " + e), this
  45. }, removeClass: function (e) {
  46. var t = this[0];
  47. return e ? this.hasClass(e) && (t.className = t.className.replace(e, " ")) : t.className = "", this
  48. }, css: function (e, r) {
  49. var i, s = this[0], o = arguments[0];
  50. if (typeof e == "string") {
  51. if (r === t)return n.css(s, e);
  52. e === "opacity" ? n.opacity.set(s, r) : s.style[e] = r
  53. } else for (i in o)i === "opacity" ? n.opacity.set(s, o[i]) : s.style[i] = o[i];
  54. return this
  55. }, show: function () {
  56. return this.css("display", "block")
  57. }, hide: function () {
  58. return this.css("display", "none")
  59. }, offset: function () {
  60. var e = this[0], t = e.getBoundingClientRect(), n = e.ownerDocument, r = n.body, i = n.documentElement, s = i.clientTop || r.clientTop || 0, o = i.clientLeft || r.clientLeft || 0, u = t.top + (self.pageYOffset || i.scrollTop) - s, a = t.left + (self.pageXOffset || i.scrollLeft) - o;
  61. return {left: a, top: u}
  62. }, html: function (e) {
  63. var r = this[0];
  64. return e === t ? r.innerHTML : (n.cleanData(r.getElementsByTagName("*")), r.innerHTML = e, this)
  65. }, remove: function () {
  66. var e = this[0];
  67. return n.cleanData(e.getElementsByTagName("*")), n.cleanData([e]), e.parentNode.removeChild(e), this
  68. }, bind: function (e, t) {
  69. return n.event.add(this[0], e, t), this
  70. }, unbind: function (e, t) {
  71. return n.event.remove(this[0], e, t), this
  72. }
  73. }, n.fn.init = function (e, t) {
  74. var r, i;
  75. t = t || document;
  76. if (!e)return this;
  77. if (e.nodeType)return this[0] = e, this;
  78. if (e === "body" && t.body)return this[0] = t.body, this;
  79. if (e === "head" || e === "html")return this[0] = t.getElementsByTagName(e)[0], this;
  80. if (typeof e == "string") {
  81. r = u.exec(e);
  82. if (r && r[2])return i = t.getElementById(r[2]), i && i.parentNode && (this[0] = i), this
  83. }
  84. return typeof e == "function" ? n(document).ready(e) : (this[0] = e, this)
  85. }, n.fn.init.prototype = n.fn, n.noop = function () {
  86. }, n.isWindow = function (e) {
  87. return e && typeof e == "object" && "setInterval" in e
  88. }, n.isArray = function (e) {
  89. return Object.prototype.toString.call(e) === "[object Array]"
  90. }, n.fn.find = function (e) {
  91. var t, r = this[0], i = e.split(".")[1];
  92. return i ? document.getElementsByClassName ? t = r.getElementsByClassName(i) : t = h(i, r) : t = r.getElementsByTagName(e), n(t[0])
  93. }, n.each = function (e, n) {
  94. var r, i = 0, s = e.length, o = s === t;
  95. if (o) {
  96. for (r in e)if (n.call(e[r], r, e[r]) === !1)break
  97. } else for (var u = e[0]; i < s && n.call(u, i, u) !== !1; u = e[++i]);
  98. return e
  99. }, n.data = function (e, r, i) {
  100. var s = n.cache, o = p(e);
  101. return r === t ? s[o] : (s[o] || (s[o] = {}), i !== t && (s[o][r] = i), s[o][r])
  102. }, n.removeData = function (e, t) {
  103. var r = !0, i = n.expando, s = n.cache, o = p(e), u = o && s[o];
  104. if (!u)return;
  105. if (t) {
  106. delete u[t];
  107. for (var a in u)r = !1;
  108. r && delete n.cache[o]
  109. } else delete s[o], e.removeAttribute ? e.removeAttribute(i) : e[i] = null
  110. }, n.uuid = 0, n.cache = {}, n.expando = "@cache" + +(new Date), n.event = {
  111. add: function (e, t, r) {
  112. var i, s, o = n.event, u = n.data(e, "@events") || n.data(e, "@events", {});
  113. i = u[t] = u[t] || {}, s = i.listeners = i.listeners || [], s.push(r), i.handler || (i.elem = e, i.handler = o.handler(i), e.addEventListener ? e.addEventListener(t, i.handler, !1) : e.attachEvent("on" + t, i.handler))
  114. }, remove: function (e, t, r) {
  115. var i, s, o, u = n.event, a = !0, f = n.data(e, "@events");
  116. if (!f)return;
  117. if (!t) {
  118. for (i in f)u.remove(e, i);
  119. return
  120. }
  121. s = f[t];
  122. if (!s)return;
  123. o = s.listeners;
  124. if (r)for (i = 0; i < o.length; i++)o[i] === r && o.splice(i--, 1); else s.listeners = [];
  125. if (s.listeners.length === 0) {
  126. e.removeEventListener ? e.removeEventListener(t, s.handler, !1) : e.detachEvent("on" + t, s.handler), delete f[t], s = n.data(e, "@events");
  127. for (var l in s)a = !1;
  128. a && n.removeData(e, "@events")
  129. }
  130. }, handler: function (t) {
  131. return function (r) {
  132. r = n.event.fix(r || e.event);
  133. for (var i = 0, s = t.listeners, o; o = s[i++];)o.call(t.elem, r) === !1 && (r.preventDefault(), r.stopPropagation())
  134. }
  135. }, fix: function (e) {
  136. if (e.target)return e;
  137. var t = {
  138. target: e.srcElement || document, preventDefault: function () {
  139. e.returnValue = !1
  140. }, stopPropagation: function () {
  141. e.cancelBubble = !0
  142. }
  143. };
  144. for (var n in e)t[n] = e[n];
  145. return t
  146. }
  147. }, n.cleanData = function (e) {
  148. var t = 0, r, i = e.length, s = n.event.remove, o = n.removeData;
  149. for (; t < i; t++)r = e[t], s(r), o(r)
  150. }, n.isReady = !1, n.ready = function () {
  151. if (!n.isReady) {
  152. if (!document.body)return setTimeout(n.ready, 13);
  153. n.isReady = !0;
  154. if (i) {
  155. var e, t = 0;
  156. while (e = i[t++])e.call(document, n);
  157. i = null
  158. }
  159. }
  160. }, n.bindReady = function () {
  161. if (r)return;
  162. r = !0;
  163. if (document.readyState === "complete")return n.ready();
  164. if (document.addEventListener)document.addEventListener("DOMContentLoaded", s, !1), e.addEventListener("load", n.ready, !1); else if (document.attachEvent) {
  165. document.attachEvent("onreadystatechange", s), e.attachEvent("onload", n.ready);
  166. var t = !1;
  167. try {
  168. t = e.frameElement == null
  169. } catch (i) {
  170. }
  171. document.documentElement.doScroll && t && d()
  172. }
  173. }, document.addEventListener ? s = function () {
  174. document.removeEventListener("DOMContentLoaded", s, !1), n.ready()
  175. } : document.attachEvent && (s = function () {
  176. document.readyState === "complete" && (document.detachEvent("onreadystatechange", s), n.ready())
  177. }), n.css = "defaultView" in document && "getComputedStyle" in document.defaultView ? function (e, t) {
  178. return document.defaultView.getComputedStyle(e, !1)[t]
  179. } : function (e, t) {
  180. var r = t === "opacity" ? n.opacity.get(e) : e.currentStyle[t];
  181. return r || ""
  182. }, n.opacity = {
  183. get: function (e) {
  184. return o ? document.defaultView.getComputedStyle(e, !1).opacity : l.test((e.currentStyle ? e.currentStyle.filter : e.style.filter) || "") ? parseFloat(RegExp.$1) / 100 + "" : 1
  185. }, set: function (e, t) {
  186. if (o)return e.style.opacity = t;
  187. var n = e.style;
  188. n.zoom = 1;
  189. var r = "alpha(opacity=" + t * 100 + ")", i = n.filter || "";
  190. n.filter = f.test(i) ? i.replace(f, r) : n.filter + " " + r
  191. }
  192. }, n.each(["Left", "Top"], function (e, t) {
  193. var r = "scroll" + t;
  194. n.fn[r] = function () {
  195. var t = this[0], n;
  196. return n = v(t), n ? "pageXOffset" in n ? n[e ? "pageYOffset" : "pageXOffset"] : n.document.documentElement[r] || n.document.body[r] : t[r]
  197. }
  198. }), n.each(["Height", "Width"], function (e, t) {
  199. var r = t.toLowerCase();
  200. n.fn[r] = function (e) {
  201. var r = this[0];
  202. return r ? n.isWindow(r) ? r.document.documentElement["client" + t] || r.document.body["client" + t] : r.nodeType === 9 ? Math.max(r.documentElement["client" + t], r.body["scroll" + t], r.documentElement["scroll" + t], r.body["offset" + t], r.documentElement["offset" + t]) : null : e == null ? null : this
  203. }
  204. }), n.ajax = function (t) {
  205. var r = e.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP"), i = t.url;
  206. if (t.cache === !1) {
  207. var s = +(new Date), o = i.replace(/([?&])_=[^&]*/, "$1_=" + s);
  208. i = o + (o === i ? (/\?/.test(i) ? "&" : "?") + "_=" + s : "")
  209. }
  210. r.onreadystatechange = function () {
  211. r.readyState === 4 && r.status === 200 && (t.success && t.success(r.responseText), r.onreadystatechange = n.noop)
  212. }, r.open("GET", i, 1), r.send(null)
  213. }, n.fn.animate = function (e, t, r, i) {
  214. t = t || 400, typeof r == "function" && (i = r), r = r && n.easing[r] ? r : "swing";
  215. var s = this[0], o, u, a, f, l, h, p = {
  216. speed: t, easing: r, callback: function () {
  217. o != null && (s.style.overflow = ""), i && i()
  218. }
  219. };
  220. return p.curAnim = {}, n.each(e, function (e, t) {
  221. p.curAnim[e] = t
  222. }), n.each(e, function (e, t) {
  223. u = new n.fx(s, p, e), a = c.exec(t), f = parseFloat(e === "opacity" || s.style && s.style[e] != null ? n.css(s, e) : s[e]), l = parseFloat(a[2]), h = a[3];
  224. if (e === "height" || e === "width")l = Math.max(0, l), o = [s.style.overflow, s.style.overflowX, s.style.overflowY];
  225. u.custom(f, l, h)
  226. }), o != null && (s.style.overflow = "hidden"), this
  227. }, n.timers = [], n.fx = function (e, t, n) {
  228. this.elem = e, this.options = t, this.prop = n
  229. }, n.fx.prototype = {
  230. custom: function (e, t, r) {
  231. function s() {
  232. return i.step()
  233. }
  234. var i = this;
  235. i.startTime = n.fx.now(), i.start = e, i.end = t, i.unit = r, i.now = i.start, i.state = i.pos = 0, s.elem = i.elem, s(), n.timers.push(s), n.timerId || (n.timerId = setInterval(n.fx.tick, 13))
  236. }, step: function () {
  237. var e = this, t = n.fx.now(), r = !0;
  238. if (t >= e.options.speed + e.startTime) {
  239. e.now = e.end, e.state = e.pos = 1, e.update(), e.options.curAnim[e.prop] = !0;
  240. for (var i in e.options.curAnim)e.options.curAnim[i] !== !0 && (r = !1);
  241. return r && e.options.callback.call(e.elem), !1
  242. }
  243. var s = t - e.startTime;
  244. return e.state = s / e.options.speed, e.pos = n.easing[e.options.easing](e.state, s, 0, 1, e.options.speed), e.now = e.start + (e.end - e.start) * e.pos, e.update(), !0
  245. }, update: function () {
  246. var e = this;
  247. e.prop === "opacity" ? n.opacity.set(e.elem, e.now) : e.elem.style && e.elem.style[e.prop] != null ? e.elem.style[e.prop] = e.now + e.unit : e.elem[e.prop] = e.now
  248. }
  249. }, n.fx.now = function () {
  250. return +(new Date)
  251. }, n.easing = {
  252. linear: function (e, t, n, r) {
  253. return n + r * e
  254. }, swing: function (e, t, n, r) {
  255. return (-Math.cos(e * Math.PI) / 2 + .5) * r + n
  256. }
  257. }, n.fx.tick = function () {
  258. var e = n.timers;
  259. for (var t = 0; t < e.length; t++)!e[t]() && e.splice(t--, 1);
  260. !e.length && n.fx.stop()
  261. }, n.fx.stop = function () {
  262. clearInterval(n.timerId), n.timerId = null
  263. }, n.fn.stop = function () {
  264. var e = n.timers;
  265. for (var t = e.length - 1; t >= 0; t--)e[t].elem === this[0] && e.splice(t, 1);
  266. return this
  267. }, n
  268. })(window), function (e, t, n) {
  269. e.noop = e.noop || function () {
  270. };
  271. var r, i, s, o, u = 0, a = e(t), f = e(document), l = e("html"), c = document.documentElement, h = t.VBArray && !t.XMLHttpRequest, p = "createTouch" in document && !("onmousemove" in c) || /(iPhone|iPad|iPod)/i.test(navigator.userAgent), d = "artDialog" + +(new Date), v = function (t, i, s) {
  272. t = t || {};
  273. if (typeof t == "string" || t.nodeType === 1)t = {content: t, fixed: !p};
  274. var o, a = v.defaults, f = t.follow = this.nodeType === 1 && this || t.follow;
  275. for (var l in a)t[l] === n && (t[l] = a[l]);
  276. return e.each({
  277. ok: "yesFn",
  278. cancel: "noFn",
  279. close: "closeFn",
  280. init: "initFn",
  281. okVal: "yesText",
  282. cancelVal: "noText"
  283. }, function (e, r) {
  284. t[e] = t[e] !== n ? t[e] : t[r]
  285. }), typeof f == "string" && (f = e(f)[0]), t.id = f && f[d + "follow"] || t.id || d + u, o = v.list[t.id], f && o ? o.follow(f).zIndex().focus() : o ? o.zIndex().focus() : (p && (t.fixed = !1), e.isArray(t.button) || (t.button = t.button ? [t.button] : []), i !== n && (t.ok = i), s !== n && (t.cancel = s), t.ok && t.button.push({
  286. name: t.okVal,
  287. callback: t.ok,
  288. focus: !0
  289. }), t.cancel && t.button.push({
  290. name: t.cancelVal,
  291. callback: t.cancel
  292. }), v.defaults.zIndex = t.zIndex, u++, v.list[t.id] = r ? r._init(t) : new v.fn._init(t))
  293. };
  294. v.fn = v.prototype = {
  295. version: "4.1.7", closed: !0, _init: function (e) {
  296. var n = this, i, s = e.icon, o = s && (h ? {png: "icons/" + s + ".png"} : {backgroundImage: "url('" + e.path + "/skins/icons/" + s + ".png')"});
  297. return n.closed = !1, n.config = e, n.DOM = i = n.DOM || n._getDOM(), i.wrap.addClass(e.skin), i.close[e.cancel === !1 ? "hide" : "show"](), i.icon[0].style.display = s ? "" : "none", i.iconBg.css(o || {background: "none"}), i.se.css("cursor", e.resize ? "se-resize" : "auto"), i.title.css("cursor", e.drag ? "move" : "auto"), i.content.css("padding", e.padding), n[e.show ? "show" : "hide"](!0), n.button(e.button).title(e.title).content(e.content, !0).size(e.width, e.height).time(e.time), e.follow ? n.follow(e.follow) : n.position(e.left, e.top), n.zIndex().focus(), e.lock && n.lock(), n._addEvent(), n._ie6PngFix(), r = null, e.init && e.init.call(n, t), n
  298. }, content: function (e) {
  299. var t, r, i, s, o = this, u = o.DOM, a = u.wrap[0], f = a.offsetWidth, l = a.offsetHeight, c = parseInt(a.style.left), h = parseInt(a.style.top), p = a.style.width, d = u.content, v = d[0];
  300. return o._elemBack && o._elemBack(), a.style.width = "auto", e === n ? v : (typeof e == "string" ? d.html(e) : e && e.nodeType === 1 && (s = e.style.display, t = e.previousSibling, r = e.nextSibling, i = e.parentNode, o._elemBack = function () {
  301. t && t.parentNode ? t.parentNode.insertBefore(e, t.nextSibling) : r && r.parentNode ? r.parentNode.insertBefore(e, r) : i && i.appendChild(e), e.style.display = s, o._elemBack = null
  302. }, d.html(""), v.appendChild(e), e.style.display = "block"), arguments[1] || (o.config.follow ? o.follow(o.config.follow) : (f = a.offsetWidth - f, l = a.offsetHeight - l, c -= f / 2, h -= l / 2, a.style.left = Math.max(c, 0) + "px", a.style.top = Math.max(h, 0) + "px"), p && p !== "auto" && (a.style.width = a.offsetWidth + "px"), o._autoPositionType()), o._ie6SelectFix(), o._runScript(v), o)
  303. }, title: function (e) {
  304. var t = this.DOM, r = t.wrap, i = t.title, s = "aui_state_noTitle";
  305. return e === n ? i[0] : (e === !1 ? (i.hide().html(""), r.addClass(s)) : (i.show().html(e || ""), r.removeClass(s)), this)
  306. }, position: function (e, t) {
  307. var r = this, i = r.config, s = r.DOM.wrap[0], o = h ? !1 : i.fixed, u = h && r.config.fixed, l = f.scrollLeft(), c = f.scrollTop(), p = o ? 0 : l, d = o ? 0 : c, v = a.width(), m = a.height(), g = s.offsetWidth, y = s.offsetHeight, b = s.style;
  308. if (e || e === 0)r._left = e.toString().indexOf("%") !== -1 ? e : null, e = r._toNumber(e, v - g), typeof e == "number" ? (e = u ? e += l : e + p, b.left = Math.max(e, p) + "px") : typeof e == "string" && (b.left = e);
  309. if (t || t === 0)r._top = t.toString().indexOf("%") !== -1 ? t : null, t = r._toNumber(t, m - y), typeof t == "number" ? (t = u ? t += c : t + d, b.top = Math.max(t, d) + "px") : typeof t == "string" && (b.top = t);
  310. return e !== n && t !== n && (r._follow = null, r._autoPositionType()), r
  311. }, size: function (e, t) {
  312. var n, r, i, s, o = this, u = o.config, f = o.DOM, l = f.wrap, c = f.main, h = l[0].style, p = c[0].style;
  313. return e && (o._width = e.toString().indexOf("%") !== -1 ? e : null, n = a.width() - l[0].offsetWidth + c[0].offsetWidth, i = o._toNumber(e, n), e = i, typeof e == "number" ? (h.width = "auto", p.width = Math.max(o.config.minWidth, e) + "px", h.width = l[0].offsetWidth + "px") : typeof e == "string" && (p.width = e, e === "auto" && l.css("width", "auto"))), t && (o._height = t.toString().indexOf("%") !== -1 ? t : null, r = a.height() - l[0].offsetHeight + c[0].offsetHeight, s = o._toNumber(t, r), t = s, typeof t == "number" ? p.height = Math.max(o.config.minHeight, t) + "px" : typeof t == "string" && (p.height = t)), o._ie6SelectFix(), o
  314. }, follow: function (t) {
  315. var n, r = this, i = r.config;
  316. if (typeof t == "string" || t && t.nodeType === 1)n = e(t), t = n[0];
  317. if (!t || !t.offsetWidth && !t.offsetHeight)return r.position(r._left, r._top);
  318. var s = d + "follow", o = a.width(), u = a.height(), l = f.scrollLeft(), c = f.scrollTop(), p = n.offset(), v = t.offsetWidth, m = t.offsetHeight, g = h ? !1 : i.fixed, y = g ? p.left - l : p.left, b = g ? p.top - c : p.top, w = r.DOM.wrap[0], E = w.style, S = w.offsetWidth, x = w.offsetHeight, T = y - (S - v) / 2, N = b + m, C = g ? 0 : l, k = g ? 0 : c;
  319. return T = T < C ? y : T + S > o && y - S > C ? y - S + v : T, N = N + x > u + k && b - x > k ? b - x : N, E.left = T + "px", E.top = N + "px", r._follow && r._follow.removeAttribute(s), r._follow = t, t[s] = i.id, r._autoPositionType(), r
  320. }, button: function () {
  321. var t = this, r = arguments, i = t.DOM, s = i.buttons, o = s[0], u = "aui_state_highlight", a = t._listeners = t._listeners || {}, f = e.isArray(r[0]) ? r[0] : [].slice.call(r);
  322. return r[0] === n ? o : (e.each(f, function (n, r) {
  323. var i = r.name, s = !a[i], f = s ? document.createElement("button") : a[i].elem;
  324. a[i] || (a[i] = {}), r.callback && (a[i].callback = r.callback), r.className && (f.className = r.className), r.focus && (t._focus && t._focus.removeClass(u), t._focus = e(f).addClass(u), t.focus()), f.setAttribute("type", "button"), f[d + "callback"] = i, f.disabled = !!r.disabled, s && (f.innerHTML = i, a[i].elem = f, o.appendChild(f))
  325. }), s[0].style.display = f.length ? "" : "none", t._ie6SelectFix(), t)
  326. }, show: function () {
  327. return this.DOM.wrap.show(), !arguments[0] && this._lockMaskWrap && this._lockMaskWrap.show(), this
  328. }, hide: function () {
  329. return this.DOM.wrap.hide(), !arguments[0] && this._lockMaskWrap && this._lockMaskWrap.hide(), this
  330. }, close: function () {
  331. if (this.closed)return this;
  332. var e = this, n = e.DOM, i = n.wrap, s = v.list, o = e.config.close, u = e.config.follow;
  333. e.time();
  334. if (typeof o == "function" && o.call(e, t) === !1)return e;
  335. e.unlock(), e._elemBack && e._elemBack(), i[0].className = i[0].style.cssText = "", n.title.html(""), n.content.html(""), n.buttons.html(""), v.focus === e && (v.focus = null), u && u.removeAttribute(d + "follow"), delete s[e.config.id], e._removeEvent(), e.hide(!0)._setAbsolute();
  336. for (var a in e)e.hasOwnProperty(a) && a !== "DOM" && delete e[a];
  337. return r ? i.remove() : r = e, e
  338. }, time: function (e) {
  339. var t = this, n = t.config.cancelVal, r = t._timer;
  340. return r && clearTimeout(r), e && (t._timer = setTimeout(function () {
  341. t._click(n)
  342. }, 1e3 * e)), t
  343. }, focus: function () {
  344. try {
  345. if (this.config.focus) {
  346. var e = this._focus && this._focus[0] || this.DOM.close[0];
  347. e && e.focus()
  348. }
  349. } catch (t) {
  350. }
  351. return this
  352. }, zIndex: function () {
  353. var e = this, t = e.DOM, n = t.wrap, r = v.focus, i = v.defaults.zIndex++;
  354. return n.css("zIndex", i), e._lockMask && e._lockMask.css("zIndex", i - 1), r && r.DOM.wrap.removeClass("aui_state_focus"), v.focus = e, n.addClass("aui_state_focus"), e
  355. }, lock: function () {
  356. if (this._lock)return this;
  357. var t = this, n = v.defaults.zIndex - 1, r = t.DOM.wrap, i = t.config, s = f.width(), o = f.height(), u = t._lockMaskWrap || e(document.body.appendChild(document.createElement("div"))), a = t._lockMask || e(u[0].appendChild(document.createElement("div"))), l = "(document).documentElement", c = p ? "width:" + s + "px;height:" + o + "px" : "width:100%;height:100%", d = h ? "position:absolute;left:expression(" + l + ".scrollLeft);top:expression(" + l + ".scrollTop);width:expression(" + l + ".clientWidth);height:expression(" + l + ".clientHeight)" : "";
  358. return t.zIndex(), r.addClass("aui_state_lock"), u[0].style.cssText = c + ";position:fixed;z-index:" + n + ";top:0;left:0;overflow:hidden;" + d, a[0].style.cssText = "height:100%;background:" + i.background + ";filter:alpha(opacity=0);opacity:0", h && a.html('<iframe src="about:blank" style="width:100%;height:100%;position:absolute;top:0;left:0;z-index:-1;filter:alpha(opacity=0)"></iframe>'), a.stop(), a.bind("click", function () {
  359. t._reset()
  360. }).bind("dblclick", function () {
  361. t._click(t.config.cancelVal)
  362. }), i.duration === 0 ? a.css({opacity: i.opacity}) : a.animate({opacity: i.opacity}, i.duration), t._lockMaskWrap = u, t._lockMask = a, t._lock = !0, t
  363. }, unlock: function () {
  364. var e = this, t = e._lockMaskWrap, n = e._lockMask;
  365. if (!e._lock)return e;
  366. var i = t[0].style, s = function () {
  367. h && (i.removeExpression("width"), i.removeExpression("height"), i.removeExpression("left"), i.removeExpression("top")), i.cssText = "display:none", r && t.remove()
  368. };
  369. return n.stop().unbind(), e.DOM.wrap.removeClass("aui_state_lock"), e.config.duration ? n.animate({opacity: 0}, e.config.duration, s) : s(), e._lock = !1, e
  370. }, _getDOM: function () {
  371. var t = document.createElement("div"), n = document.body;
  372. t.style.cssText = "position:absolute;left:0;top:0", t.innerHTML = v._templates, n.insertBefore(t, n.firstChild);
  373. var r, i = 0, s = {wrap: e(t)}, o = t.getElementsByTagName("*"), u = o.length;
  374. for (; i < u; i++)r = o[i].className.split("aui_")[1], r && (s[r] = e(o[i]));
  375. return s
  376. }, _toNumber: function (e, t) {
  377. if (!e && e !== 0 || typeof e == "number")return e;
  378. var n = e.length - 1;
  379. return e.lastIndexOf("px") === n ? e = parseInt(e) : e.lastIndexOf("%") === n && (e = parseInt(t * e.split("%")[0] / 100)), e
  380. }, _ie6PngFix: h ? function () {
  381. var e = 0, t, n, r, i, s = v.defaults.path + "/skins/", o = this.DOM.wrap[0].getElementsByTagName("*");
  382. for (; e < o.length; e++)t = o[e], n = t.currentStyle.png, n && (r = s + n, i = t.runtimeStyle, i.backgroundImage = "none", i.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + r + "',sizingMethod='crop')")
  383. } : e.noop, _ie6SelectFix: h ? function () {
  384. var e = this.DOM.wrap, t = e[0], n = d + "iframeMask", r = e[n], i = t.offsetWidth, s = t.offsetHeight;
  385. i += "px", s += "px", r ? (r.style.width = i, r.style.height = s) : (r = t.appendChild(document.createElement("iframe")), e[n] = r, r.src = "about:blank", r.style.cssText = "position:absolute;z-index:-1;left:0;top:0;filter:alpha(opacity=0);width:" + i + ";height:" + s)
  386. } : e.noop, _runScript: function (e) {
  387. var t, n = 0, r = 0, i = e.getElementsByTagName("script"), s = i.length, o = [];
  388. for (; n < s; n++)i[n].type === "text/dialog" && (o[r] = i[n].innerHTML, r++);
  389. o.length && (o = o.join(""), t = new Function(o), t.call(this))
  390. }, _autoPositionType: function () {
  391. this[this.config.fixed ? "_setFixed" : "_setAbsolute"]()
  392. }, _setFixed: function () {
  393. return h && e(function () {
  394. var t = "backgroundAttachment";
  395. l.css(t) !== "fixed" && e("body").css(t) !== "fixed" && l.css({
  396. zoom: 1,
  397. backgroundImage: "url(about:blank)",
  398. backgroundAttachment: "fixed"
  399. })
  400. }), function () {
  401. var e = this.DOM.wrap, t = e[0].style;
  402. if (h) {
  403. var n = parseInt(e.css("left")), r = parseInt(e.css("top")), i = f.scrollLeft(), s = f.scrollTop(), o = "(document.documentElement)";
  404. this._setAbsolute(), t.setExpression("left", "eval(" + o + ".scrollLeft + " + (n - i) + ') + "px"'), t.setExpression("top", "eval(" + o + ".scrollTop + " + (r - s) + ') + "px"')
  405. } else t.position = "fixed"
  406. }
  407. }(), _setAbsolute: function () {
  408. var e = this.DOM.wrap[0].style;
  409. h && (e.removeExpression("left"), e.removeExpression("top")), e.position = "absolute"
  410. }, _click: function (e) {
  411. var n = this, r = n._listeners[e] && n._listeners[e].callback;
  412. return typeof r != "function" || r.call(n, t) !== !1 ? n.close() : n
  413. }, _reset: function (e) {
  414. var t, n = this, r = n._winSize || a.width() * a.height(), i = n._follow, s = n._width, o = n._height, u = n._left, f = n._top;
  415. if (e) {
  416. t = n._winSize = a.width() * a.height();
  417. if (r === t)return
  418. }
  419. (s || o) && n.size(s, o), i ? n.follow(i) : (u || f) && n.position(u, f)
  420. }, _addEvent: function () {
  421. var e, n = this, r = n.config, i = "CollectGarbage" in t, s = n.DOM;
  422. n._winResize = function () {
  423. e && clearTimeout(e), e = setTimeout(function () {
  424. n._reset(i)
  425. }, 40)
  426. }, a.bind("resize", n._winResize), s.wrap.bind("click", function (e) {
  427. var t = e.target, i;
  428. if (t.disabled)return !1;
  429. if (t === s.close[0])return n._click(r.cancelVal), !1;
  430. i = t[d + "callback"], i && n._click(i), n._ie6SelectFix()
  431. }).bind("mousedown", function () {
  432. n.zIndex()
  433. })
  434. }, _removeEvent: function () {
  435. var e = this, t = e.DOM;
  436. t.wrap.unbind(), a.unbind("resize", e._winResize)
  437. }
  438. }, v.fn._init.prototype = v.fn, e.fn.dialog = e.fn.artDialog = function () {
  439. var e = arguments;
  440. return this[this.live ? "live" : "bind"]("click", function () {
  441. return v.apply(this, e), !1
  442. }), this
  443. }, v.focus = null, v.get = function (e) {
  444. return e === n ? v.list : v.list[e]
  445. }, v.list = {}, f.bind("keydown", function (e) {
  446. var t = e.target, n = t.nodeName, r = /^INPUT|TEXTAREA$/, i = v.focus, s = e.keyCode;
  447. if (!i || !i.config.esc || r.test(n))return;
  448. s === 27 && i._click(i.config.cancelVal)
  449. }), o = t._artDialog_path || function (e, t, n) {
  450. for (t in e)e[t].src && e[t].src.indexOf("artDialog") !== -1 && (n = e[t]);
  451. return i = n || e[e.length - 1], n = i.src.replace(/\\/g, "/"), n.lastIndexOf("/") < 0 ? "." : n.substring(0, n.lastIndexOf("/"))
  452. }(document.getElementsByTagName("script")), s = i.src.split("skin=")[1];
  453. if (s) {
  454. var m = document.createElement("link");
  455. m.rel = "stylesheet", m.href = o + "/skins/" + s + ".css?" + v.fn.version, i.parentNode.insertBefore(m, i)
  456. }
  457. a.bind("load", function () {
  458. setTimeout(function () {
  459. if (u)return;
  460. v({left: "-9999em", time: 9, fixed: !1, lock: !1, focus: !1})
  461. }, 150)
  462. });
  463. try {
  464. document.execCommand("BackgroundImageCache", !1, !0)
  465. } catch (g) {
  466. }
  467. v._templates = '<div class="aui_outer"><table class="aui_border"><tbody><tr><td class="aui_nw"></td><td class="aui_n"></td><td class="aui_ne"></td></tr><tr><td class="aui_w"></td><td class="aui_c"><div class="aui_inner"><table class="aui_dialog"><tbody><tr><td colspan="2" class="aui_header"><div class="aui_titleBar"><div class="aui_title"></div><a class="aui_close" href="javascript:/*artDialog*/;">\u00d7</a></div></td></tr><tr><td class="aui_icon"><div class="aui_iconBg"></div></td><td class="aui_main"><div class="aui_content"></div></td></tr><tr><td colspan="2" class="aui_footer"><div class="aui_buttons"></div></td></tr></tbody></table></div></td><td class="aui_e"></td></tr><tr><td class="aui_sw"></td><td class="aui_s"></td><td class="aui_se"></td></tr></tbody></table></div>', v.defaults = {
  468. content: '<div class="aui_loading"><span>loading..</span></div>',
  469. title: "\u6d88\u606f",
  470. button: null,
  471. ok: null,
  472. cancel: null,
  473. init: null,
  474. close: null,
  475. okVal: "\u786e\u5b9a",
  476. cancelVal: "\u53d6\u6d88",
  477. width: "auto",
  478. height: "auto",
  479. minWidth: 96,
  480. minHeight: 32,
  481. padding: "20px 25px",
  482. skin: "",
  483. icon: null,
  484. time: null,
  485. esc: !0,
  486. focus: !0,
  487. show: !0,
  488. follow: null,
  489. path: o,
  490. lock: !1,
  491. background: "#000",
  492. opacity: .7,
  493. duration: 300,
  494. fixed: !1,
  495. left: "50%",
  496. top: "38.2%",
  497. zIndex: 1987,
  498. resize: !0,
  499. drag: !0
  500. }, t.artDialog = e.dialog = e.artDialog = v
  501. }(this.art || this.jQuery && (this.art = jQuery), this), function (e) {
  502. var t, n, r = e(window), i = e(document), s = document.documentElement, o = !("minWidth" in s.style), u = "onlosecapture" in s, a = "setCapture" in s;
  503. artDialog.dragEvent = function () {
  504. var e = this, t = function (t) {
  505. var n = e[t];
  506. e[t] = function () {
  507. return n.apply(e, arguments)
  508. }
  509. };
  510. t("start"), t("move"), t("end")
  511. }, artDialog.dragEvent.prototype = {
  512. onstart: e.noop, start: function (e) {
  513. return i.bind("mousemove", this.move).bind("mouseup", this.end), this._sClientX = e.clientX, this._sClientY = e.clientY, this.onstart(e.clientX, e.clientY), !1
  514. }, onmove: e.noop, move: function (e) {
  515. return this._mClientX = e.clientX, this._mClientY = e.clientY, this.onmove(e.clientX - this._sClientX, e.clientY - this._sClientY), !1
  516. }, onend: e.noop, end: function (e) {
  517. return i.unbind("mousemove", this.move).unbind("mouseup", this.end), this.onend(e.clientX, e.clientY), !1
  518. }
  519. }, n = function (e) {
  520. var n, s, f, l, c, h, p = artDialog.focus, d = p.DOM, v = d.wrap, m = d.title, g = d.main, y = "getSelection" in window ? function () {
  521. window.getSelection().removeAllRanges()
  522. } : function () {
  523. try {
  524. document.selection.empty()
  525. } catch (e) {
  526. }
  527. };
  528. t.onstart = function (e, n) {
  529. h ? (s = g[0].offsetWidth, f = g[0].offsetHeight) : (l = v[0].offsetLeft, c = v[0].offsetTop), i.bind("dblclick", t.end), !o && u ? m.bind("losecapture", t.end) : r.bind("blur", t.end), a && m[0].setCapture(), v.addClass("aui_state_drag"), p.focus()
  530. }, t.onmove = function (e, t) {
  531. if (h) {
  532. var r = v[0].style, i = g[0].style, o = e + s, u = t + f;
  533. r.width = "auto", i.width = Math.max(0, o) + "px", r.width = v[0].offsetWidth + "px", i.height = Math.max(0, u) + "px"
  534. } else {
  535. var i = v[0].style, a = Math.max(n.minX, Math.min(n.maxX, e + l)), d = Math.max(n.minY, Math.min(n.maxY, t + c));
  536. i.left = a + "px", i.top = d + "px"
  537. }
  538. y(), p._ie6SelectFix()
  539. }, t.onend = function (e, n) {
  540. i.unbind("dblclick", t.end), !o && u ? m.unbind("losecapture", t.end) : r.unbind("blur", t.end), a && m[0].releaseCapture(), o && !p.closed && p._autoPositionType(), v.removeClass("aui_state_drag")
  541. }, h = e.target === d.se[0] ? !0 : !1, n = function () {
  542. var e, t, n = p.DOM.wrap[0], s = n.style.position === "fixed", o = n.offsetWidth, u = n.offsetHeight, a = r.width(), f = r.height(), l = s ? 0 : i.scrollLeft(), c = s ? 0 : i.scrollTop(), e = a - o + l;
  543. return t = f - u + c, {minX: l, minY: c, maxX: e, maxY: t}
  544. }(), t.start(e)
  545. }, i.bind("mousedown", function (e) {
  546. var r = artDialog.focus;
  547. if (!r)return;
  548. var i = e.target, s = r.config, o = r.DOM;
  549. if (s.drag !== !1 && i === o.title[0] || s.resize !== !1 && i === o.se[0])return t = t || new artDialog.dragEvent, n(e), !1
  550. })
  551. }(this.art || this.jQuery && (this.art = jQuery))