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