zhao
2021-07-19 8347f2fbddbd25369359dcb2da1233ac48a19fdc
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
(function(a) {
    a.alerts = {
        verticalOffset: 0,
        horizontalOffset: 0,
        repositionOnResize: true,
        overlayOpacity: 0.50,
        overlayColor: "#FFF",
        draggable: true,
        okButton: " \u786e\u5b9a ",
        cancelButton: " \u53d6\u6d88 ",
        dialogClass: null,
        alert: function(b, c, d) {
            if (c == null) {
                c = "\u63d0\u793a"
            }
            a.alerts._show(c, b, null, "alert",
            function(e) {
                if (d) {
                    d(e)
                }
            },
            null, null, null, null)
        },
        confirm: function(b, c, d) {
            if (c == null) {
                c = "\u8bf7\u786e\u8ba4"
            }
            a.alerts._show(c, b, null, "confirm",
            function(e) {
                if (d) {
                    d(e)
                }
            },
            null, null, null, null)
        },
        prompt: function(b, c, d, e) {
            if (d == null) {
                d = "\u8bf7\u586b\u5199"
            }
            a.alerts._show(d, b, c, "prompt",
            function(f) {
                if (e) {
                    e(f)
                }
            },
            null, null, null, null)
        },
        openBox: function(f, g, b, c, e, d, i) {
            if (g == null) {
                g = "\u63d0\u793a"
            }
            a.alerts._show(g, f, null, "openBox",
            function(h) {
                if (i) {
                    i(h)
                }
            },
            b, c, e, d)
        },
        overAlert: function(c, b) {
            a.alerts._overShow(c, b)
        },
        _overShow: function(d, c) {
            if (c == null) {
                c = 3000
            }
            var b = c + 600;
            a("body").append('<div id="over_container" style="display:none"><div id="over_message"></div></div>');
            a("#over_message").text(d).html(a("#over_message").text().replace(/\n/g, "<br />"));
            if (a.alerts.dialogClass) {
                a("#over_container").addClass(a.alerts.dialogClass)
            }
            var e = (a.browser.msie && parseInt(a.browser.version) <= 6) ? "absolute" : "fixed";
            a("#over_container").css({
                position: e,
                zIndex: 99999,
                width: 350,
                padding: 0,
                margin: 0
            }).show("fast");
            a("#over_container").css({
                minWidth: a("#over_container").outerWidth(),
                maxWidth: a("#over_container").outerWidth()
            });
            a.alerts._overReposition();
            setTimeout(function() {
                a("#over_container").hide("fast")
            },
            c);
            setTimeout(function() {
                a("#over_container").remove()
            },
            b)
        },
        _overReposition: function() {
            var c = 4;
            var b = ((a(window).width() / 2) - (a("#over_container").outerWidth() / 2)) + a.alerts.horizontalOffset;
            if (c < 0) {
                c = 0
            }
            if (b < 0) {
                b = 0
            }
            if (a.browser.msie && parseInt(a.browser.version) <= 6) {
                c = c + a(window).scrollTop()
            }
            if (a.browser.msie && parseInt(a.browser.version) <= 6) {
                b = b - 175
            }
            a("#over_container").css({
                top: c + "px",
                left: b + "px"
            });
            a("#popup_overlay").height(a(document).height())
        },
        _show: function(j, b, k, g, m, l, c, f, n) {
            a.alerts._hide();
            a.alerts._overlay("show");
            a("body").append('<div id="popup_container" style="display:none"><h1 id="popup_title"></h1><em id="ctl"></em><em id="cbl"></em><em id="ctr"></em><em id="cbr"></em><span id="popup_close"></span><div id="popup_content"><div id="popup_error"></div><div id="popup_html"></div><div id="popup_message"></div></div></div>');
            if (a.alerts.dialogClass) {
                a("#popup_container").addClass(a.alerts.dialogClass)
            }
            var i = (a.browser.msie && parseInt(a.browser.version) <= 6) ? "absolute" : "fixed";
            a("#popup_container").css({
                position: i,
                zIndex: 99999,
                padding: 0,
                margin: 0
            }).fadeIn("fast");
            a("#popup_title").html(j);
            a("#popup_content").addClass(g);
            if (g != "openBox") {
                a("#popup_message").text(b).html(a("#popup_message").text().replace(/\n/g, "<br />"))
            }
            a("#popup_container").css({});
            a.alerts._reposition();
            a.alerts._maintainPosition(true);
            switch (g) {
                case "alert":
                    a("#popup_message").after('<div id="popup_panel"><input type="button" value="' + a.alerts.okButton + '" id="popup_ok" /></div>');
                    a("#popup_ok").click(function() {
                        a.alerts._hide();
                        m(true)
                    });
                    a("#popup_ok").focus().keypress(function(h) {
                        if (h.keyCode == 13 || h.keyCode == 27) {
                            a("#popup_ok").trigger("click")
                        }
                    });
                    break;
                case "confirm":
                    a("#popup_message").after('<div id="popup_panel"><input type="button" value="' + a.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + a.alerts.cancelButton + '" id="popup_cancel" /></div>');
                    a("#popup_ok").click(function() {
                        a.alerts._hide();
                        if (m) {
                            m(true)
                        }
                    });
                    a("#popup_cancel").click(function() {
                        a.alerts._hide();
                        if (m) {
                            m(false)
                        }
                    });
                    a("#popup_ok").focus();
                    a("#popup_ok, #popup_cancel").keypress(function(h) {
                        if (h.keyCode == 13) {
                            a("#popup_ok").trigger("click")
                        }
                        if (h.keyCode == 27) {
                            a("#popup_cancel").trigger("click")
                        }
                    });
                    break;
                case "prompt":
                    a("#popup_message").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" value="' + a.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + a.alerts.cancelButton + '" id="popup_cancel" /></div>');
                    a("#popup_prompt").width(a("#popup_message").width() - 10);
                    a("#popup_ok").click(function() {
                        var e = a("#popup_prompt").val();
                        a.alerts._hide();
                        if (m) {
                            m(e)
                        }
                    });
                    a("#popup_cancel").click(function() {
                        a.alerts._hide();
                        if (m) {
                            m(null)
                        }
                    });
                    a("#popup_prompt, #popup_ok, #popup_cancel").keypress(function(h) {
                        if (h.keyCode == 13) {
                            a("#popup_ok").trigger("click")
                        }
                        if (h.keyCode == 27) {
                            a("#popup_cancel").trigger("click")
                        }
                    });
                    if (k) {
                        a("#popup_prompt").val(k)
                    }
                    a("#popup_prompt").focus().select();
                    break;
                case "openBox":
                    a("#popup_message").append(a(b).html());
                    if (l) {
                        a("#popup_container").css({
                            width:
                        l + "px"
                        })
                    }
                    if (c) {
                        a("#popup_container").css({
                            height: c + "px"
                        });
                        a("#popup_message").css({
                            height: (c - 48) + "px"
                        })
                    }
                    a.alerts._reposition();
                    if (f) {
                        a(f).click(function() {
                            if (m) {
                                m(true)
                            }
                        })
                    }
                    if (n) {
                        a(n).click(function() {
                            a.alerts._hide();
                            return false;
                            if (m) {
                                m(false)
                            }
                        })
                    }
                    break
            }
            a("#popup_close").click(function() {
                a.alerts._hide();
                if (m) {
                    m(false)
                }
            });
            if (a.alerts.draggable) {
                try {
                    a("#popup_container").draggable({
                        handle: a("#popup_title")
                    });
                    a("#popup_title").css({
                        cursor: "move"
                    })
                } catch (d) { }
            }
        },
        _hide: function() {
            a("#popup_container").remove();
            a.alerts._overlay("hide");
            a.alerts._maintainPosition(false)
        },
        _overlay: function(b) {
            switch (b) {
                case "show":
                    a.alerts._overlay("hide");
                    a("BODY").append('<div id="popup_overlay"></div>');
                    a("#popup_overlay").css({
                        position:
                    "absolute",
                        zIndex: 99998,
                        top: "0px",
                        left: "0px",
                        width: "100%",
                        height: a(document).height(),
                        background: a.alerts.overlayColor,
                        opacity: a.alerts.overlayOpacity
                    });
                    break;
                case "hide":
                    a("#popup_overlay").remove();
                    break
            }
        },
        _reposition: function() {
            var c = ((a(window).height() / 2) - (a("#popup_container").height() / 2)) + a.alerts.verticalOffset;
            //alert('window:' + a(window).height() + '\n' + 'popup:' + a("#popup_container").height());
            var b = ((a(window).width() / 2) - (a("#popup_container").width() / 2)) + a.alerts.horizontalOffset;
            if (c < 0) {
                c = 0
            }
            if (b < 0) {
                b = 0
            }
            if (a.browser.msie && parseInt(a.browser.version) <= 6) {
                c = c + a(window).scrollTop()
            }
            a("#popup_container").css({
                top: c + "px",
                left: b + "px"
            });
            a("#popup_overlay").height(a(document).height())
        },
        _maintainPosition: function(b) {
            if (a.alerts.repositionOnResize) {
                switch (b) {
                    case true:
                        a(window).bind("resize", a.alerts._reposition);
                        break;
                    case false:
                        a(window).unbind("resize", a.alerts._reposition);
                        break
                }
            }
        }
    };
    hiAlert = function(b, c, d) {
        a.alerts.alert(b, c, d)
    };
    hiConfirm = function(b, c, d) {
        a.alerts.confirm(b, c, d)
    };
    hiPrompt = function(b, c, d, e) {
        a.alerts.prompt(b, c, d, e)
    };
    hiBox = function(f, g, b, c, e, d, i) {
        a.alerts.openBox(f, g, b, c, e, d, i)
    };
    hiOverAlert = function(c, b) {
        a.alerts.overAlert(c, b)
    };
    hiHide = function() {
        a.alerts._hide();
    };
    hiError = function(er) {
        a("#popup_error").text(er);
    };
    hiHtml = function(html) {
        a("#popup_html").html(html);
    };
})(jQuery);