index.js 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. 
  2. function GetDate(n, t) {
  3. if (n == null) return "";
  4. var i = new Date(parseInt(n.replace("/Date(", "").replace(")/", ""), 10));
  5. return i.format(t)
  6. }
  7. var dig, dateFormat; !
  8. function () {
  9. function t(n) {
  10. var r = i[n],
  11. u = "exports";
  12. return "object" == typeof r ? r : (r[u] || (r[u] = {},
  13. r[u] = r.call(r[u], t, r[u], r) || r[u]), r[u])
  14. }
  15. function n(n, t) {
  16. i[n] = t
  17. }
  18. var i = {};
  19. n("jquery",
  20. function () {
  21. return jQuery
  22. });
  23. n("popup",
  24. function (n) {
  25. function i() {
  26. this.destroyed = !1;
  27. this.__popup = t("<div />").css({
  28. display: "none",
  29. position: "absolute",
  30. outline: 0
  31. }).attr("tabindex", "-1").html(this.innerHTML).appendTo("body");
  32. this.__backdrop = this.__mask = t("<div />").css({
  33. opacity: .5,
  34. background: "#000"
  35. });
  36. this.node = this.__popup[0];
  37. this.backdrop = this.__backdrop[0];
  38. u++
  39. }
  40. var t = n("jquery"),
  41. u = 0,
  42. r = !("minWidth" in t("html")[0].style),
  43. f = !r;
  44. return t.extend(i.prototype, {
  45. node: null,
  46. backdrop: null,
  47. fixed: !1,
  48. destroyed: !0,
  49. open: !1,
  50. returnValue: "",
  51. returnParas: null,
  52. isFirstMax: false,
  53. autofocus: !0,
  54. align: "bottom left",
  55. innerHTML: "",
  56. className: "ui-popup",
  57. show: function (n) {
  58. //debugger;
  59. var _isFirstMax = this.options.isFirstMax;
  60. var _isMax = false;
  61. var u, e, o;
  62. var obj = this.destroyed ? this : (u = this.__popup, e = this.__backdrop, (this.__activeElement = this.__getActive(), this.open = !0, this.follow = n || this.follow, this.__ready) || ((u.addClass(this.className).attr("role", this.modal ? "alertdialog" : "dialog").css("position", this.fixed ? "fixed" : "absolute"), r || t(window).on("resize", t.proxy(this.reset, this)), this.modal) && (o = {
  63. position: "fixed",
  64. left: 0,
  65. top: 0,
  66. width: "100%",
  67. height: "100%",
  68. overflow: "hidden",
  69. userSelect: "none",
  70. zIndex: this.zIndex || i.zIndex
  71. },
  72. u.addClass(this.className + "-modal"), f || t.extend(o, {
  73. position: "absolute",
  74. width: t(window).width() + "px",
  75. height: t(document).height() + "px"
  76. }), e.css(o).attr({
  77. tabindex: "0"
  78. }).on("focus", t.proxy(this.focus, this)), this.__mask = e.clone(!0).attr("style", "").insertAfter(u), e.addClass(this.className + "-backdrop").insertBefore(u), this.__ready = !0), u.html() || u.html(this.innerHTML)), u.addClass(this.className + "-show").show(), e.show(), this.reset().focus(), this.__dispatchEvent("show"), this)
  79. var _this = this;
  80. this._popup.find("[i='min']").click(function () {
  81. if (_isMax) {
  82. _this._popup.find(".ui-dialog-grid").width("auto");
  83. _this._popup.find(".ui-dialog-grid").height("auto");
  84. _this._popup.find("[i='content']").width(_this.options.width);
  85. _this._popup.find("[i='content']").height(_this.options.height);
  86. _this.__center();
  87. _isMax = false;
  88. }
  89. });
  90. this._popup.find("[i='max']").click(function () {
  91. if (!_isMax) {
  92. _this._popup.find(".ui-dialog-grid").width(t(window).width() - 20);
  93. _this._popup.find(".ui-dialog-grid").height(t(document).height());
  94. _this._popup.find("[i='content']").width(t(window).width() - 20);
  95. _this._popup.find("[i='content']").height(t(document).height() - 80);
  96. _this.__center();
  97. _isMax = true;
  98. }
  99. });
  100. if (_isFirstMax) {
  101. this._popup.find("[i='max']").click();
  102. }
  103. return obj;
  104. },
  105. showModal: function () {
  106. return this.modal = !0,
  107. this.show.apply(this, arguments)
  108. },
  109. close: function (n, o) {
  110. //debugger;
  111. this.returnParas = o;
  112. return !this.destroyed && this.open && (void 0 !== n && (this.returnValue = n), this.__popup.hide().removeClass(this.className + "-show"), this.__backdrop.hide(), this.open = !1, this.blur(), this.__dispatchEvent("close")),
  113. this
  114. },
  115. remove: function () {
  116. if (this.destroyed) return this;
  117. this.__dispatchEvent("beforeremove");
  118. i.current === this && (i.current = null);
  119. this.__popup.remove();
  120. this.__backdrop.remove();
  121. this.__mask.remove();
  122. r || t(window).off("resize", this.reset);
  123. this.__dispatchEvent("remove");
  124. for (var n in this) delete this[n];
  125. return this
  126. },
  127. reset: function () {
  128. var n = this.follow;
  129. return n ? this.__follow(n) : this.__center(),
  130. this.__dispatchEvent("reset"),
  131. this
  132. },
  133. focus: function () {
  134. var f = this.node,
  135. r = this.__popup,
  136. u = i.current,
  137. e = this.zIndex = i.zIndex++,
  138. n;
  139. return (u && u !== this && u.blur(!1), t.contains(f, this.__getActive())) || (n = r.find("[autofocus]")[0], !this._autofocus && n ? this._autofocus = !0 : n = f, this.__focus(n)),
  140. r.css("zIndex", e),
  141. i.current = this,
  142. r.addClass(this.className + "-focus"),
  143. this.__dispatchEvent("focus"),
  144. this
  145. },
  146. blur: function () {
  147. var n = this.__activeElement,
  148. t = arguments[0];
  149. return t !== !1 && this.__focus(n),
  150. this._autofocus = !1,
  151. this.__popup.removeClass(this.className + "-focus"),
  152. this.__dispatchEvent("blur"),
  153. this
  154. },
  155. addEventListener: function (n, t) {
  156. return this.__getEventListener(n).push(t),
  157. this
  158. },
  159. removeEventListener: function (n, t) {
  160. for (var r = this.__getEventListener(n), i = 0; i < r.length; i++) t === r[i] && r.splice(i--, 1);
  161. return this
  162. },
  163. __getEventListener: function (n) {
  164. var t = this.__listener;
  165. return t || (t = this.__listener = {}),
  166. t[n] || (t[n] = []),
  167. t[n]
  168. },
  169. __dispatchEvent: function (n) {
  170. var i = this.__getEventListener(n),
  171. t;
  172. for (this["on" + n] && this["on" + n](), t = 0; t < i.length; t++) i[t].call(this)
  173. },
  174. __focus: function (n) {
  175. try {
  176. this.autofocus && !/^iframe$/i.test(n.nodeName) && n.focus()
  177. } catch (t) { }
  178. },
  179. __getActive: function () {
  180. try {
  181. var n = document.activeElement,
  182. t = n.contentDocument;
  183. return t && t.activeElement || n
  184. } catch (r) { }
  185. },
  186. __center: function () {
  187. var n = this.__popup,
  188. i = t(window),
  189. r = t(document),
  190. u = this.fixed,
  191. f = u ? 0 : r.scrollLeft(),
  192. e = u ? 0 : r.scrollTop(),
  193. s = i.width(),
  194. h = i.height(),
  195. c = n.width(),
  196. l = n.height(),
  197. a = (s - c) / 2 + f,
  198. v = 382 * (h - l) / 1e3 + e,
  199. o = n[0].style;
  200. o.left = Math.max(parseInt(a), f) + "px";
  201. o.top = Math.max(parseInt(v), e) + "px"
  202. },
  203. __follow: function (n) {
  204. var r = n.parentNode && t(n),
  205. f = this.__popup,
  206. a;
  207. if ((this.__followSkin && f.removeClass(this.__followSkin), r) && (a = r.offset(), a.left * a.top < 0)) return this.__center();
  208. var ot = this,
  209. h = this.fixed,
  210. b = t(window),
  211. k = t(document),
  212. st = b.width(),
  213. ht = b.height(),
  214. d = k.scrollLeft(),
  215. g = k.scrollTop(),
  216. c = f.width(),
  217. l = f.height(),
  218. v = r ? r.outerWidth() : 0,
  219. y = r ? r.outerHeight() : 0,
  220. nt = this.__offset(n),
  221. tt = nt.left,
  222. it = nt.top,
  223. e = h ? tt - d : tt,
  224. o = h ? it - g : it,
  225. rt = h ? 0 : d,
  226. ut = h ? 0 : g,
  227. ct = rt + st - c,
  228. lt = ut + ht - l,
  229. p = {},
  230. i = this.align.split(" "),
  231. w = this.className + "-",
  232. ft = {
  233. top: "bottom",
  234. bottom: "top",
  235. left: "right",
  236. right: "left"
  237. },
  238. u = {
  239. top: "top",
  240. bottom: "top",
  241. left: "left",
  242. right: "left"
  243. },
  244. s = [{
  245. top: o - l,
  246. bottom: o + y,
  247. left: e - c,
  248. right: e + v
  249. },
  250. {
  251. top: o,
  252. bottom: o - l + y,
  253. left: e,
  254. right: e - c + v
  255. }],
  256. at = {
  257. left: e + v / 2 - c / 2,
  258. top: o + y / 2 - l / 2
  259. },
  260. et = {
  261. left: [rt, ct],
  262. top: [ut, lt]
  263. };
  264. t.each(i,
  265. function (n, t) {
  266. s[n][t] > et[u[t]][1] && (t = i[n] = ft[t]);
  267. s[n][t] < et[u[t]][0] && (i[n] = ft[t])
  268. });
  269. i[1] || (u[i[1]] = "left" === u[i[0]] ? "top" : "left", s[1][i[1]] = at[u[i[1]]]);
  270. w += i.join("-") + " " + this.className + "-follow";
  271. ot.__followSkin = w;
  272. r && f.addClass(w);
  273. p[u[i[0]]] = parseInt(s[0][i[0]]);
  274. p[u[i[1]]] = parseInt(s[1][i[1]]);
  275. f.css(p)
  276. },
  277. __offset: function (n) {
  278. var f = n.parentNode,
  279. r = f ? t(n).offset() : {
  280. left: n.pageX,
  281. top: n.pageY
  282. },
  283. i,
  284. u;
  285. if (n = f ? n : n.target, i = n.ownerDocument, u = i.defaultView || i.parentWindow, u == window) return r;
  286. var s = u.frameElement,
  287. e = t(i),
  288. h = e.scrollLeft(),
  289. c = e.scrollTop(),
  290. o = t(s).offset(),
  291. l = o.left,
  292. a = o.top;
  293. return {
  294. left: r.left + l - h,
  295. top: r.top + a - c
  296. }
  297. }
  298. }),
  299. i.zIndex = 1024,
  300. i.current = null,
  301. i
  302. });
  303. n("dialog-config", {
  304. backdropBackground: "#000",
  305. backdropOpacity: .5,
  306. content: '<span class="ui-dialog-loading">Loading..<\/span>',
  307. title: "",
  308. statusbar: "",
  309. button: null,
  310. ok: null,
  311. cancel: null,
  312. okValue: "ok",
  313. cancelValue: "cancel",
  314. cancelDisplay: !0,
  315. width: "",
  316. height: "",
  317. padding: "",
  318. skin: "",
  319. quickClose: !1,
  320. cssUri: "../css/ui-dialog.css",
  321. innerHTML: '<div i="dialog" class="ui-dialog"><div class="ui-dialog-arrow-a"><\/div><div class="ui-dialog-arrow-b"><\/div><div class="morph-shape"><svg width="100%" height="100%" viewBox="0 0 560 280" preserveAspectRatio="none"><rect x="3" y="3" fill="none" width="556" height="276"></rect></svg></div><table class="ui-dialog-grid"><tr><td i="header" class="ui-dialog-header"><button i="close" class="ui-dialog-close">&#215;<\/button><button i="max" class="ui-dialog-max">最大<\/button><button i="min" class="ui-dialog-min">最小<\/button><div i="title" class="ui-dialog-title"><\/div><\/td><\/tr><tr><td i="body" class="ui-dialog-body"><div i="content" class="ui-dialog-content"><\/div><\/td><\/tr><tr><td i="footer" class="ui-dialog-footer"><div i="statusbar" class="ui-dialog-statusbar"><\/div><div i="button" class="ui-dialog-button"><\/div><\/td><\/tr><\/table><\/div>'
  322. });
  323. n("dialog",
  324. function (n) {
  325. var t = n("jquery"),
  326. u = n("popup"),
  327. o = n("dialog-config"),
  328. r = o.cssUri,
  329. f,
  330. e;
  331. r && (f = n[n.toUrl ? "toUrl" : "resolve"], f && (r = f(r), r = '<link rel="stylesheet" href="' + r + '" />', t("base")[0] ? t("base").before(r) : t("head").append(r)));
  332. var s = 0,
  333. l = new Date - 0,
  334. a = !("minWidth" in t("html")[0].style),
  335. h = "createTouch" in document && !("onmousemove" in document) || /(iPhone|iPad|iPod)/i.test(navigator.userAgent),
  336. v = !a && !h,
  337. i = function (n, r, u) {
  338. var o = n = n || {},
  339. f, e;
  340. return ("string" == typeof n || 1 === n.nodeType) && (n = {
  341. content: n,
  342. fixed: !h
  343. }),
  344. n = t.extend(!0, {},
  345. i.defaults, n),
  346. n.original = o,
  347. f = n.id = n.id || l + s,
  348. e = i.get(f),
  349. e ? e.focus() : (v || (n.fixed = !1), n.quickClose && (n.modal = !0, n.backdropOpacity = 0), t.isArray(n.button) || (n.button = []), void 0 !== u && (n.cancel = u), n.cancel && n.button.push({
  350. id: "cancel",
  351. value: n.cancelValue,
  352. callback: n.cancel,
  353. display: n.cancelDisplay
  354. }), void 0 !== r && (n.ok = r), n.ok && n.button.push({
  355. id: "ok",
  356. value: n.okValue,
  357. callback: n.ok,
  358. autofocus: !0
  359. }), i.list[f] = new i.create(n))
  360. },
  361. c = function () { };
  362. return c.prototype = u.prototype,
  363. e = i.prototype = new c,
  364. i.create = function (n) {
  365. var r = this,
  366. f, e;
  367. return t.extend(this, new u),
  368. f = (n.original, t(this.node).html(n.innerHTML)),
  369. e = t(this.backdrop),
  370. this.options = n,
  371. this._popup = f,
  372. t.each(n,
  373. function (n, t) {
  374. "function" == typeof r[n] ? r[n](t) : r[n] = t
  375. }),
  376. n.zIndex && (u.zIndex = n.zIndex),
  377. f.attr({
  378. "aria-labelledby": this._$("title").attr("id", "title:" + this.id).attr("id"),
  379. "aria-describedby": this._$("content").attr("id", "content:" + this.id).attr("id")
  380. }),
  381. this._$("close").css("display", this.cancel === !1 ? "none" : "").attr("title", this.cancelValue).on("click",
  382. function (n) {
  383. r._trigger("cancel");
  384. n.preventDefault()
  385. }),
  386. this._$("dialog").addClass(this.skin),
  387. this._$("body").css("padding", this.padding),
  388. n.quickClose && e.on("onmousedown" in document ? "mousedown" : "click",
  389. function () {
  390. return r._trigger("cancel"),
  391. !1
  392. }),
  393. this.addEventListener("show",
  394. function () {
  395. e.css({
  396. opacity: 0,
  397. background: n.backdropBackground
  398. }).animate({
  399. opacity: n.backdropOpacity
  400. },
  401. 150)
  402. }),
  403. this._esc = function (n) {
  404. var t = n.target,
  405. i = t.nodeName,
  406. f = u.current === r,
  407. e = n.keyCode; !f || /^input|textarea$/i.test(i) && "button" !== t.type || 27 === e && r._trigger("cancel")
  408. },
  409. t(document).on("keydown", this._esc),
  410. this.addEventListener("remove",
  411. function () {
  412. t(document).off("keydown", this._esc);
  413. delete i.list[this.id]
  414. }),
  415. s++,
  416. i.oncreate(this),
  417. this
  418. },
  419. i.create.prototype = e,
  420. t.extend(e, {
  421. content: function (n) {
  422. var i = this._$("content");
  423. return "object" == typeof n ? (n = t(n), i.empty("").append(n.show()), this.addEventListener("beforeremove",
  424. function () {
  425. t("body").append(n.hide())
  426. })) : i.html(n),
  427. this.reset()
  428. },
  429. title: function (n) {
  430. return this._$("title").text(n),
  431. this._$("header")[n ? "show" : "hide"](),
  432. this
  433. },
  434. width: function (n) {
  435. return this._$("content").css("width", n),
  436. this.reset()
  437. },
  438. height: function (n) {
  439. return this._$("content").css("height", n),
  440. this.reset()
  441. },
  442. button: function (n) {
  443. n = n || [];
  444. var i = this,
  445. r = "",
  446. u = 0;
  447. return this.callbacks = {},
  448. "string" == typeof n ? (r = n, u++) : t.each(n,
  449. function (n, f) {
  450. var e = f.id = f.id || f.value,
  451. o = "";
  452. i.callbacks[e] = f.callback;
  453. f.display === !1 ? o = ' style="display:none"' : u++;
  454. r += '<button type="button" i-id="' + e + '"' + o + (f.disabled ? " disabled" : "") + (f.autofocus ? ' autofocus class="ui-dialog-autofocus"' : "") + ">" + f.value + "<\/button>";
  455. i._$("button").on("click", "[i-id=" + e + "]",
  456. function (n) {
  457. var r = t(this);
  458. r.attr("disabled") || i._trigger(e);
  459. n.preventDefault()
  460. })
  461. }),
  462. this._$("button").html(r),
  463. this._$("footer")[u ? "show" : "hide"](),
  464. this
  465. },
  466. statusbar: function (n) {
  467. return this._$("statusbar").html(n)[n ? "show" : "hide"](),
  468. this
  469. },
  470. _$: function (n) {
  471. return this._popup.find("[i=" + n + "]")
  472. },
  473. _trigger: function (n) {
  474. var t = this.callbacks[n];
  475. return "function" != typeof t || t.call(this) !== !1 ? this.close().remove() : this
  476. }
  477. }),
  478. i.oncreate = t.noop,
  479. i.getCurrent = function () {
  480. return u.current
  481. },
  482. i.get = function (n) {
  483. return void 0 === n ? i.list : i.list[n]
  484. },
  485. i.list = {},
  486. i.defaults = o,
  487. i
  488. });
  489. n("drag",
  490. function (n) {
  491. var t = n("jquery"),
  492. f = t(window),
  493. i = t(document),
  494. e = "createTouch" in document,
  495. o = document.documentElement,
  496. l = !("minWidth" in o.style),
  497. h = !l && "onlosecapture" in o,
  498. c = "setCapture" in o,
  499. u = {
  500. start: e ? "touchstart" : "mousedown",
  501. over: e ? "touchmove" : "mousemove",
  502. end: e ? "touchend" : "mouseup"
  503. },
  504. s = e ?
  505. function (n) {
  506. return n.touches || (n = n.originalEvent.touches.item(0)),
  507. n
  508. } : function (n) {
  509. return n
  510. },
  511. r = function () {
  512. this.start = t.proxy(this.start, this);
  513. this.over = t.proxy(this.over, this);
  514. this.end = t.proxy(this.end, this);
  515. this.onstart = this.onover = this.onend = t.noop
  516. };
  517. return r.types = u,
  518. r.prototype = {
  519. start: function (n) {
  520. return n = this.startFix(n),
  521. i.on(u.over, this.over).on(u.end, this.end),
  522. this.onstart(n),
  523. !1
  524. },
  525. over: function (n) {
  526. return n = this.overFix(n),
  527. this.onover(n),
  528. !1
  529. },
  530. end: function (n) {
  531. return n = this.endFix(n),
  532. i.off(u.over, this.over).off(u.end, this.end),
  533. this.onend(n),
  534. !1
  535. },
  536. startFix: function (n) {
  537. return n = s(n),
  538. this.target = t(n.target),
  539. this.selectstart = function () {
  540. return !1
  541. },
  542. i.on("selectstart", this.selectstart).on("dblclick", this.end),
  543. h ? this.target.on("losecapture", this.end) : f.on("blur", this.end),
  544. c && this.target[0].setCapture(),
  545. n
  546. },
  547. overFix: function (n) {
  548. return s(n)
  549. },
  550. endFix: function (n) {
  551. return n = s(n),
  552. i.off("selectstart", this.selectstart).off("dblclick", this.end),
  553. h ? this.target.off("losecapture", this.end) : f.off("blur", this.end),
  554. c && this.target[0].releaseCapture(),
  555. n
  556. }
  557. },
  558. r.create = function (n, u) {
  559. var h, c, v, y, e = t(n),
  560. o = new r,
  561. l = r.types.start,
  562. a = function () { },
  563. p = n.className.replace(/^\s|\s.*/g, "") + "-drag-start",
  564. s = {
  565. onstart: a,
  566. onover: a,
  567. onend: a,
  568. off: function () {
  569. e.off(l, o.start)
  570. }
  571. };
  572. return o.onstart = function (t) {
  573. var r = "fixed" === e.css("position"),
  574. a = i.scrollLeft(),
  575. w = i.scrollTop(),
  576. o = e.width(),
  577. l = e.height();
  578. h = 0;
  579. c = 0;
  580. v = r ? f.width() - o + h : i.width() - o;
  581. y = r ? f.height() - l + c : i.height() - l;
  582. var u = e.offset(),
  583. b = this.startLeft = r ? u.left - a : u.left,
  584. k = this.startTop = r ? u.top - w : u.top;
  585. this.clientX = t.clientX;
  586. this.clientY = t.clientY;
  587. e.addClass(p);
  588. s.onstart.call(n, t, b, k)
  589. },
  590. o.onover = function (t) {
  591. var i = t.clientX - this.clientX + this.startLeft,
  592. r = t.clientY - this.clientY + this.startTop,
  593. u = e[0].style;
  594. i = Math.max(h, Math.min(v, i));
  595. r = Math.max(c, Math.min(y, r));
  596. u.left = i + "px";
  597. u.top = r + "px";
  598. s.onover.call(n, t, i, r)
  599. },
  600. o.onend = function (t) {
  601. var i = e.position(),
  602. r = i.left,
  603. u = i.top;
  604. e.removeClass(p);
  605. s.onend.call(n, t, r, u)
  606. },
  607. o.off = function () {
  608. e.off(l, o.start)
  609. },
  610. u ? o.start(u) : e.on(l, o.start),
  611. s
  612. },
  613. r
  614. });
  615. n("dialog-plus",
  616. function (n) {
  617. var i = n("jquery"),
  618. t = n("dialog"),
  619. r = n("drag");
  620. return t.oncreate = function (n) {
  621. var t, u = n.options,
  622. e = u.original,
  623. o = u.url,
  624. s = u.oniframeload,
  625. h, f;
  626. if (o && (this.padding = u.padding = 0, t = i("<iframe />"), t.attr({
  627. src: o,
  628. name: n.id,
  629. width: "100%",
  630. height: "100%",
  631. allowtransparency: "yes",
  632. frameborder: "no",
  633. scrolling: "yes"
  634. }).on("load",
  635. function () {
  636. var i;
  637. try {
  638. i = t[0].contentWindow.frameElement
  639. } catch (r) { }
  640. i && (u.width || n.width(t.contents().width()), u.height || n.height(t.contents().height()));
  641. s && s.call(n)
  642. }), n.addEventListener("beforeremove",
  643. function () {
  644. t.attr("src", "about:blank").remove()
  645. },
  646. !1), n.content(t[0]), n.iframeNode = t[0]), !(e instanceof Object)) for (h = function () {
  647. n.close().remove()
  648. },
  649. f = 0; f < frames.length; f++) try {
  650. if (e instanceof frames[f].Object) {
  651. i(frames[f]).one("unload", h);
  652. break
  653. }
  654. } catch (c) { }
  655. i(n.node).on(r.types.start, "[i=title]",
  656. function (t) {
  657. n.follow || (n.focus(), r.create(n.node, t))
  658. })
  659. },
  660. t.get = function (n) {
  661. var i, u, r, f;
  662. if (n && n.frameElement) {
  663. u = n.frameElement;
  664. r = t.list;
  665. for (f in r) if (i = r[f], i.node.getElementsByTagName("iframe")[0] === u) return i
  666. } else if (n) return t.list[n]
  667. },
  668. t
  669. });
  670. window.dialog = t("dialog-plus")
  671. }(),
  672. function (n) {
  673. n.gritter = {};
  674. n.gritter.options = {
  675. position: "",
  676. class_name: "",
  677. fade_in_speed: "medium",
  678. fade_out_speed: 1e3,
  679. time: 6e3
  680. };
  681. n.gritter.add = function (n) {
  682. try {
  683. return t.add(n || {})
  684. } catch (r) {
  685. var i = "Gritter Error: " + r;
  686. typeof console != "undefined" && console.error ? console.error(i, n) : alert(i)
  687. }
  688. };
  689. n.gritter.remove = function (n, i) {
  690. t.removeSpecific(n, i || {})
  691. };
  692. n.gritter.removeAll = function (n) {
  693. t.stop(n || {})
  694. };
  695. var t = {
  696. position: "",
  697. fade_in_speed: "",
  698. fade_out_speed: "",
  699. time: "",
  700. _custom_timer: 0,
  701. _item_count: 0,
  702. _is_setup: 0,
  703. _tpl_close: '<a class="gritter-close" href="#" tabindex="1">Close Notification<\/a>',
  704. _tpl_title: '<span class="gritter-title">[[title]]<\/span>',
  705. _tpl_item: '<div id="gritter-item-[[number]]" class="gritter-item-wrapper [[item_class]]" style="display:none" role="alert"><div class="gritter-top"><\/div><div class="gritter-item">[[close]][[image]]<div class="[[class_name]]">[[title]]<p>[[text]]<\/p><\/div><div style="clear:both"><\/div><\/div><div class="gritter-bottom"><\/div><\/div>',
  706. _tpl_wrap: '<div id="gritter-notice-wrapper"><\/div>',
  707. add: function (i) {
  708. var r, e, c, l, u;
  709. if (typeof i == "string" && (i = {
  710. text: i
  711. }), i.text === null) throw 'You must supply "text" parameter.';
  712. this._is_setup || this._runSetup();
  713. var f = i.title,
  714. a = i.text,
  715. o = i.image || "",
  716. s = i.sticky || !1,
  717. v = i.class_name || n.gritter.options.class_name,
  718. y = n.gritter.options.position,
  719. h = i.time || "";
  720. return (this._verifyWrapper(), this._item_count++, r = this._item_count, e = this._tpl_item, n(["before_open", "after_open", "before_close", "after_close"]).each(function (u, f) {
  721. t["_" + f + "_" + r] = n.isFunction(i[f]) ? i[f] : function () { }
  722. }), this._custom_timer = 0, h && (this._custom_timer = h), c = o != "" ? '<img alt="image" src="' + o + '" class="gritter-image" />' : "", l = o != "" ? "gritter-with-image" : "gritter-without-image", f = f ? this._str_replace("[[title]]", f, this._tpl_title) : "", e = this._str_replace(["[[title]]", "[[text]]", "[[close]]", "[[image]]", "[[number]]", "[[class_name]]", "[[item_class]]"], [f, a, this._tpl_close, c, this._item_count, l, v], e), this["_before_open_" + r]() === !1) ? !1 : (n("#gritter-notice-wrapper").addClass(y).append(e), u = n("#gritter-item-" + this._item_count), u.fadeIn(this.fade_in_speed,
  723. function () {
  724. t["_after_open_" + r](n(this))
  725. }), s || this._setFadeTimer(u, r), n(u).bind("mouseenter mouseleave",
  726. function (i) {
  727. i.type == "mouseenter" ? s || t._restoreItemIfFading(n(this), r) : s || t._setFadeTimer(n(this), r);
  728. t._hoverState(n(this), i.type)
  729. }), n(u).find(".gritter-close").click(function () {
  730. return t.removeSpecific(r, {},
  731. null, !0),
  732. !1
  733. }), r)
  734. },
  735. _countRemoveWrapper: function (t, i, r) {
  736. i.remove();
  737. this["_after_close_" + t](i, r);
  738. n(".gritter-item-wrapper").length == 0 && n("#gritter-notice-wrapper").remove()
  739. },
  740. _fade: function (n, i, r, u) {
  741. var r = r || {},
  742. e = typeof r.fade != "undefined" ? r.fade : !0,
  743. o = r.speed || this.fade_out_speed,
  744. f = u;
  745. this["_before_close_" + i](n, f);
  746. u && n.unbind("mouseenter mouseleave");
  747. e ? n.animate({
  748. opacity: 0
  749. },
  750. o,
  751. function () {
  752. n.animate({
  753. height: 0
  754. },
  755. 300,
  756. function () {
  757. t._countRemoveWrapper(i, n, f)
  758. })
  759. }) : this._countRemoveWrapper(i, n)
  760. },
  761. _hoverState: function (n, t) {
  762. t == "mouseenter" ? (n.addClass("hover"), n.find(".gritter-close").show()) : (n.removeClass("hover"), n.find(".gritter-close").hide())
  763. },
  764. removeSpecific: function (t, i, r, u) {
  765. if (!r) var r = n("#gritter-item-" + t);
  766. this._fade(r, t, i || {},
  767. u)
  768. },
  769. _restoreItemIfFading: function (n, t) {
  770. clearTimeout(this["_int_id_" + t]);
  771. n.stop().css({
  772. opacity: "",
  773. height: ""
  774. })
  775. },
  776. _runSetup: function () {
  777. for (opt in n.gritter.options) this[opt] = n.gritter.options[opt];
  778. this._is_setup = 1
  779. },
  780. _setFadeTimer: function (n, i) {
  781. var r = this._custom_timer ? this._custom_timer : this.time;
  782. this["_int_id_" + i] = setTimeout(function () {
  783. t._fade(n, i)
  784. },
  785. r)
  786. },
  787. stop: function (t) {
  788. var r = n.isFunction(t.before_close) ? t.before_close : function () { },
  789. u = n.isFunction(t.after_close) ? t.after_close : function () { },
  790. i = n("#gritter-notice-wrapper");
  791. r(i);
  792. i.fadeOut(function () {
  793. n(this).remove();
  794. u()
  795. })
  796. },
  797. _str_replace: function (n, t, i, r) {
  798. var f = 0,
  799. e = 0,
  800. o = "",
  801. c = "",
  802. l = 0,
  803. a = 0,
  804. h = [].concat(n),
  805. s = [].concat(t),
  806. u = i,
  807. v = s instanceof Array,
  808. y = u instanceof Array;
  809. for (u = [].concat(u), r && (this.window[r] = 0), f = 0, l = u.length; f < l; f++) if (u[f] !== "") for (e = 0, a = h.length; e < a; e++) o = u[f] + "",
  810. c = v ? s[e] !== undefined ? s[e] : "" : s[0],
  811. u[f] = o.split(h[e]).join(c),
  812. r && u[f] !== o && (this.window[r] += (o.length - u[f].length) / h[e].length);
  813. return y ? u : u[0]
  814. },
  815. _verifyWrapper: function () {
  816. n("#gritter-notice-wrapper").length == 0 && n("body").append(this._tpl_wrap)
  817. }
  818. }
  819. }(jQuery);
  820. dig = {
  821. addModel: function (n, t, i, r, u, v) {
  822. top.dialog({
  823. title: n,
  824. url: t,
  825. width: i,
  826. height: r,
  827. onremove: function () {
  828. },
  829. onclose: u,
  830. isFirstMax: !!v
  831. }).showModal();
  832. return false;
  833. },
  834. /**
  835. * show: 打开弹窗并传值
  836. * @example
  837. * data,title,url,width,height,function
  838. */
  839. show: function (d, n, t, i, r, u, v) {
  840. top.dialog({
  841. title: n,
  842. url: t,
  843. data: d,
  844. width: i,
  845. height: r,
  846. onremove: function () {
  847. },
  848. onclose: u,
  849. isFirstMax: !!v
  850. }).showModal();
  851. return false;
  852. },
  853. remove: function () {
  854. var n = top.dialog.get(window);
  855. n.close().remove();
  856. },
  857. close: function (a, b) {
  858. var n = top.dialog.get(window);
  859. n.close(a, b);
  860. },
  861. alertSuccess: function (n, t, i) {
  862. top.dialog({
  863. title: n,
  864. content: '<p style="padding:50px 100px; max-width:600px; margin-bottom:0px;font-size:18px;font-family:Microsoft YaHei,Helvetica,arial,sans-serif;color:#18a689;"><img src="/Content/themes/images/icon/success-32-32.png" style="margin-right:15px;" />' + t + "<\/p>",
  865. okValue: "确定",
  866. ok: function () {
  867. i && i()
  868. }
  869. }).showModal()
  870. },
  871. alertError: function (n, t, i) {
  872. top.dialog({
  873. title: n,
  874. content: '<p style="padding:50px 100px; max-width:600px; margin-bottom:0px;font-size:18px;font-family:Microsoft YaHei,Helvetica,arial,sans-serif;color:#c94e50;"><img src="/Content/themes/images/icon/error32-32.png" style="margin-right:15px;" />' + t + "<\/p>",
  875. okValue: " 关闭 ",
  876. ok: function () {
  877. i && i()
  878. }
  879. }).showModal()
  880. },
  881. confirm: function (n, t, i, r) {
  882. var u = top.dialog({
  883. title: n,
  884. content: '<p style="padding:50px 100px; max-width:600px; margin-bottom:0px;font-size:18px;font-family:Microsoft YaHei,Helvetica,arial,sans-serif;"><img src="/Content/themes/images/icon/warning32-32.png" style="margin-right:15px;" />' + t + "<\/p>",
  885. okValue: " 确定 ",
  886. ok: function () {
  887. i && i()
  888. },
  889. cancelValue: " 取消 ",
  890. cancel: function () {
  891. r && r()
  892. }
  893. }).showModal()
  894. },
  895. msg: function (n) {
  896. var t = top.dialog({
  897. content: '<p style="padding:50px 100px; max-width:600px; margin-bottom:0px;font-size:18px;font-family:Microsoft YaHei,Helvetica,arial,sans-serif;"><img src="/Content/themes/images/icon/success-32-32.png" style="margin-right:15px;" />' + n + "<\/p>"
  898. }).show();
  899. setTimeout(function () {
  900. t.close().remove()
  901. },
  902. 1500)
  903. },
  904. upload: function (o, t) {
  905. top.dialog({
  906. title: '选择文件',
  907. url: '/Com/Upload/FileMain',
  908. width: 800,
  909. height: 480,
  910. data: o, // 给 iframe 的数据
  911. onclose: t,
  912. oniframeload: function () {
  913. }
  914. }).showModal();
  915. return false;
  916. }
  917. },
  918. function (n) {
  919. n.fn.checkall = function (t) {
  920. var f = {
  921. chname: "checkname[]",
  922. callback: function () { }
  923. },
  924. t = n.extend(f, t),
  925. u = n(this),
  926. i = n("input[name='" + t.chname + "']"),
  927. r = 0;
  928. return i.click(function () {
  929. i.filter(":checked").length === i.length ? u.attr("checked", !0) : u.removeAttr("checked");
  930. r = i.filter(":checked").length;
  931. typeof t.callback == "function" && t.callback(r)
  932. }),
  933. u.each(function () {
  934. n(this).click(function () {
  935. n(this).prop("checked") ? (i.prop("checked", !0), i.parent().parent().addClass("selected")) : (i.removeAttr("checked"), i.parent().parent().removeClass("selected"));
  936. r = i.filter(":checked").length;
  937. typeof t.callback == "function" && t.callback(r)
  938. })
  939. })
  940. }
  941. }(jQuery);
  942. dateFormat = function () {
  943. var t = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
  944. i = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
  945. r = /[^-+\dA-Z]/g,
  946. n = function (n, t) {
  947. for (n = String(n), t = t || 2; n.length < t;) n = "0" + n;
  948. return n
  949. };
  950. return function (u, f, e) {
  951. var h = dateFormat;
  952. if (arguments.length != 1 || Object.prototype.toString.call(u) != "[object String]" || /\d/.test(u) || (f = u, u = undefined), u = u ? new Date(u) : new Date, isNaN(u)) throw SyntaxError("invalid date");
  953. f = String(h.masks[f] || f || h.masks["default"]);
  954. f.slice(0, 4) == "UTC:" && (f = f.slice(4), e = !0);
  955. var o = e ? "getUTC" : "get",
  956. c = u[o + "Date"](),
  957. y = u[o + "Day"](),
  958. l = u[o + "Month"](),
  959. p = u[o + "FullYear"](),
  960. s = u[o + "Hours"](),
  961. w = u[o + "Minutes"](),
  962. b = u[o + "Seconds"](),
  963. a = u[o + "Milliseconds"](),
  964. v = e ? 0 : u.getTimezoneOffset(),
  965. k = {
  966. d: c,
  967. dd: n(c),
  968. ddd: h.i18n.dayNames[y],
  969. dddd: h.i18n.dayNames[y + 7],
  970. m: l + 1,
  971. mm: n(l + 1),
  972. mmm: h.i18n.monthNames[l],
  973. mmmm: h.i18n.monthNames[l + 12],
  974. yy: String(p).slice(2),
  975. yyyy: p,
  976. h: s % 12 || 12,
  977. hh: n(s % 12 || 12),
  978. H: s,
  979. HH: n(s),
  980. M: w,
  981. MM: n(w),
  982. s: b,
  983. ss: n(b),
  984. l: n(a, 3),
  985. L: n(a > 99 ? Math.round(a / 10) : a),
  986. t: s < 12 ? "a" : "p",
  987. tt: s < 12 ? "am" : "pm",
  988. T: s < 12 ? "A" : "P",
  989. TT: s < 12 ? "AM" : "PM",
  990. Z: e ? "UTC" : (String(u).match(i) || [""]).pop().replace(r, ""),
  991. o: (v > 0 ? "-" : "+") + n(Math.floor(Math.abs(v) / 60) * 100 + Math.abs(v) % 60, 4),
  992. S: ["th", "st", "nd", "rd"][c % 10 > 3 ? 0 : (c % 100 - c % 10 != 10) * c % 10]
  993. };
  994. return f.replace(t,
  995. function (n) {
  996. return n in k ? k[n] : n.slice(1, n.length - 1)
  997. })
  998. }
  999. }();
  1000. dateFormat.masks = {
  1001. "default": "ddd mmm dd yyyy HH:MM:ss",
  1002. shortDate: "m/d/yy",
  1003. mediumDate: "mmm d, yyyy",
  1004. longDate: "mmmm d, yyyy",
  1005. fullDate: "dddd, mmmm d, yyyy",
  1006. shortTime: "h:MM TT",
  1007. mediumTime: "h:MM:ss TT",
  1008. longTime: "h:MM:ss TT Z",
  1009. isoDate: "yyyy-mm-dd",
  1010. isoTime: "HH:MM:ss",
  1011. isoDateTime: "yyyy-mm-dd' 'HH:MM:ss",
  1012. isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
  1013. };
  1014. dateFormat.i18n = {
  1015. dayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  1016. monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
  1017. };
  1018. Date.prototype.format = function (n, t) {
  1019. return dateFormat(this, n, t)
  1020. };
  1021. $.fn.initValidform = function () {
  1022. var n = function (n) {
  1023. $(n).Validform({
  1024. tiptype: function (n, t, i) {
  1025. if (!t.obj.is("form")) {
  1026. t.obj.parent("div").find(".Validform_checktip").length == 0 && (t.obj.parent("div").append("<label class='Validform_checktip' />"), t.obj.parent("div").next().find(".Validform_checktip").remove());
  1027. var r = t.obj.parent("div").find(".Validform_checktip");
  1028. i(r, t.type);
  1029. r.text(n)
  1030. }
  1031. },
  1032. showAllError: !0
  1033. })
  1034. };
  1035. return $(this).each(function () {
  1036. n($(this))
  1037. })
  1038. }