PageSourceSearch

https://news.vobao.com/Scripts/Extensions/jquery.dailog.extension.js

js vobao.com collected 2026-10-04 08:48:47 UTC 15,251 bytes, 418 lines download raw bytes

1function resizeDailog() {
2    /* 计算对话框Frame的高度
3    ----------------------------------------------------------*/
4
5    var topWindow = window;
6    while (topWindow.parent) {
7        if (topWindow.arrDialog) {
8            break;
9        }
10        topWindow = topWindow.parent;
11    }
12    if (topWindow.arrDialog.length == 0) {
13        return;
14    }
15    var currentDailog = topWindow.arrDialog[topWindow.arrDialog.length - 1];
16
17    if (currentDailog != null && currentDailog[0].contentWindow.location == window.location) {
18        if (currentDailog.attr("resized") == "0") {
19            var fullHeight = $(topWindow).height() - 70;
20            var frameHeight = fullHeight;
21            if ($(document).height() > currentDailog.parent().height()) {
22                if ($(document).height() < fullHeight) {
23                    frameHeight = $(document).height();
24                    $(currentDailog.parent()[0]).css("top", (fullHeight - $(document).height()) / 2 + "px");
25                }
26                else {
27                    frameHeight = fullHeight;
28                    $(currentDailog.parent()[0]).css("top", "9px");
29                }
30            }
31            else {
32
33                frameHeight = $(document).height();
34                $(currentDailog.parent()[0]).css("top", (fullHeight - $(document).height()) / 2 + "px");
35            }
36            var addtionalHeight = 27;
37            var frameWidth = $(document).width();
38            var fullWidth = ($(topWindow).width() - 70);
39            if (frameWidth > fullWidth) {
40                frameWidth = fullWidth;
41                $(currentDailog.parent()[0]).css("left", 70 / 2 + "px");
42            }
43            frameWidth = frameWidth > ($(topWindow).width() - 70) ? ($(topWindow).width() - 70) : frameWidth;
44            $("body").css("width", frameWidth + "px");
45
46            if ($(document).height() > frameHeight) {
47                frameWidth = frameWidth + 17;
48            }
49
50            $(currentDailog.parent()[0]).css("width", frameWidth + "px")
51            if ($(document).width() > $(currentDailog.parent()[0]).width()) {
52                frameHeight = frameHeight + addtionalHeight;
53            } else {
54                frameHeight = frameHeight + 1;
55            }
56            currentDailog.css("width", frameWidth + "px")
57            currentDailog.css("height", frameHeight + "px");
58            currentDailog.attr("resized", "1");
59        }
60    }
61}
62/* 右下角弹出系统消息
63----------------------------------------------------------*/
64function sysSuccessMessage(message, option) {
65    var _default = {
66        height: 40,
67        width: 200
68    };
69    $.extend(_default, option);
70    var sysMessage = $("#sysSuccessMessage");
71    if (sysMessage.length == 0) {
72        sysMessage = $('<div id="sysSuccessMessage" class="success" style="display: none;"></div>');
73        sysMessage.appendTo(document.body);
74    }
75    if (message != undefined && message != "") {
76        sysMessage.html(message);
77    }
78    else {
79        sysMessage.html("系统消息--操作成功!");
80    }
81    sysMessage.css("width", _default.width + "px");
82    sysMessage.css("height", _default.height + "px");
83    var left = $(document).width() - sysMessage.outerWidth();
84    var top = $(window).height() - sysMessage.outerHeight() - 10 + $(window).scrollTop();
85    sysMessage.css("left", left + "px");
86    sysMessage.css("top", top + "px");
87    sysMessage.css("display", "block");
88    //sysMessage.animate({ top: top + "px" }, 1000);
89    window.setTimeout("$('#sysSuccessMessage').fadeOut();", 2000);
90}
91/* 右下角弹出系统消息
92----------------------------------------------------------*/
93function sysInfoMessage(message, option) {
94    var _default = {
95        height: 40,
96        width: 200
97    };
98    $.extend(_default, option);
99    var sysMessage = $("#sysInfoMessage");
100    if (sysMessage.length == 0) {
101        sysMessage = $('<div id="sysInfoMessage" class="info" style="display: none;"></div>');
102        sysMessage.appendTo(document.body);
103    }
104    if (message != undefined && message != "") {
105        sysMessage.html(message);
106    }
107    else {
108        sysMessage.html("系统消息--操作成功!");
109    }
110    sysMessage.css("width", _default.width + "px");
111    sysMessage.css("height", _default.height + "px");
112    var left = $(document).width() - sysMessage.outerWidth();
113    var top = $(window).height() - sysMessage.outerHeight() - 10 + $(window).scrollTop();
114    sysMessage.css("left", left + "px");
115    sysMessage.css("top", top + "px");
116    sysMessage.css("display", "block");
117    //sysMessage.animate({ top: top + "px" }, 1000);
118    window.setTimeout("$('#sysInfoMessage').fadeOut();", 2000);
119}
120/* 右下角弹出系统消息
121----------------------------------------------------------*/
122function sysWarningMessage(message, option) {
123    var _default = {
124        height: 40,
125        width: 200
126    };
127    $.extend(_default, option);
128    var sysMessage = $("#sysWarningMessage");
129    if (sysMessage.length == 0) {
130        sysMessage = $('<div id="sysWarningMessage" class="warning" style="display: none;"></div>');
131        sysMessage.appendTo(document.body);
132    }
133    if (message != undefined && message != "") {
134        sysMessage.html(message);
135    }
136    else {
137        sysMessage.html("系统消息--操作成功!");
138    }
139    sysMessage.css("width", _default.width + "px");
140    sysMessage.css("height", _default.height + "px");
141    var left = $(document).width() - sysMessage.outerWidth();
142    var top = $(window).height() - sysMessage.outerHeight() - 10 + $(window).scrollTop();
143    sysMessage.css("left", left + "px");
144    sysMessage.css("top", top + "px");
145    sysMessage.css("display", "block");
146    //sysMessage.animate({ top: top + "px" }, 1000);
147    window.setTimeout("$('#sysWarningMessage').fadeOut();", 2000);
148}
149/* 右下角弹出系统消息
150----------------------------------------------------------*/
151function sysErrorMessage(message, option) {
152    var _default = {
153        height: 40,
154        width: 200
155    };
156    $.extend(_default, option);
157    var sysMessage = $("#sysErrorMessage");
158    if (sysMessage.length == 0) {
159        sysMessage = $('<div id="sysErrorMessage" class="error" style="display: none;"></div>');
160        sysMessage.appendTo(document.body);
161    }
162    if (message != undefined && message != "") {
163        sysMessage.html(message);
164    }
165    else {
166        sysMessage.html("系统消息--操作成功!");
167    }
168    sysMessage.css("width", _default.width + "px");
169    sysMessage.css("height", _default.height + "px");
170    var left = $(document).width() - sysMessage.outerWidth();
171    var top = $(window).height() - sysMessage.outerHeight() - 10 + $(window).scrollTop();
172    sysMessage.css("left", left + "px");
173    sysMessage.css("top", top + "px");
174    sysMessage.css("display", "block");
175    //sysMessage.animate({ top: top + "px" }, 1000);
176    window.setTimeout("$('#sysErrorMessage').fadeOut();", 2000);
177}
178/* 显示信息确认对话框
179----------------------------------------------------------*/
180function showMessageDialog(message, option) {
181    if (message == undefined)
182        return;
183    var _default = {
184        height: 155,
185        width: 200,
186        modal: true,
187        resizable: false,
188        //applicationPath: window.top.appRootPath,
189        imageName: "Default.png",
190        buttons: {
191            "确认": function () {
192                $(this).dialog("close");
193            }
194        }
195    };
196    var _beforeClose = _default.beforeClose;
197    _default.beforeClose = function () {
198        if (typeof (_beforeClose) != "undefined") {
199            _beforeClose();
200        }
201    };
202
203    var dialogMessage = $("#dialog-message");
204    if (dialogMessage.length == 0) {
205        dialogMessage = $('<div title="系统提示" style="width: auto; height: auto;  display: none;"' +
206            'id="dialog-message" class="ui-dialog-content ui-widget-content">' +
207            '<table style="width: 100%;">
207' +
208                '<tbody>' +
209                    '<tr>' +
210                        '<td>' +
211                            '<span class="icon-information" style="float: left;"></span>' +
212                        '</td>' +
213                        '<td style="height: 100%; width: 100%;">' +
214                            '<span style="" id="dialog-message-text"></span>' +
215                        '</td>' +
216                    '</tr>' +
217                '</tbody>' +
218            '</table>' +
219        '</div>');
220        dialogMessage.appendTo(window.top.document.body);
221    }
222    $.extend(_default, option);
223    $("#dialog-message-text", dialogMessage).html(message);
224    dialogMessage.dialog(_default);
225    $(dialogMessage).height($("#dialog-message-text", dialogMessage).height() + 15);
226}
227/* 显示信息确认对话框
228----------------------------------------------------------*/
229/*
230url
231, width
232, height
233, beforeConfirm
234, beforeCancel
235*/
236function showConfirmDialog(message, option) {
237    if (message == undefined)
238        return;
239    var _default = {
240        resizable: false,
241        height: 200,
242        width: 250,
243        modal: true,
244        title: "系统提示!",
245        //applicationPath: window.top.appRootPath,
246        imageName: "Default.png",
247        buttons: {
248            "确定": function () {
249                if (typeof (option.beforeConfirm) != "undefined") {
250                    option.beforeConfirm();
251                }
252                $(this).dialog("close");
253            },
254            "取消": function () {
255                if (typeof (option.beforeCancel) != "undefined") {
256                    option.beforeCancel();
257                }
258                $(this).dialog("close");
259            }
260        }
261    };
262
263    var dialogConfirm = $("#dialog-confirm");
264    if (dialogConfirm.length == 0) {
265        dialogConfirm = $('<div title="系统提示" style="width: auto; min-height: 0px; height: 65px; display: none;"' +
266            'id="dialog-confirm" class="ui-dialog-content ui-widget-content">' +
267            '<table style="width: 100%;">' +
268                '<tbody>' +
269                    '<tr>' +
270                        '<td>' +
271                            '<span class="icon-confirm" style="float: left;"></span>' +
272                        '</td>' +
273                        '<td style="height: 100%; width: 100%;">' +
274                            '<span style="line-height: 20px;" id="dialog-confirm-text"></span>' +
275                        '</td>' +
276                    '</tr>' +
277                '</tbody>' +
278            '</table>' +
279        '</div>');
280        dialogConfirm.appendTo(document.body);
281    }
282    $.extend(_default, option);
283    $("#dialog-confirm-text", dialogConfirm).html(message);
284    dialogConfirm.dialog(_default);
285}
286/* 打开一个Dialog
287----------------------------------------------------------*/
288/*
289url
290, title
291, width
292, height
293, beforeClose
294*/
295var arrDialog = new Array();
296var arrClosedDialog = new Array();
297function openDialog(option) {
298    option = option || {};
299    var _default = {
300        width: 650,
301        height: 550,
302        //applicationPath: window.top.appRootPath,
303        imageName: "Default.png",
304        url: "about:blank",
305        modal: true
306    };
307    $.extend(_default, option);
308
309    var windowHeight = $(window).height() - 51;
310    var windowWidth = $(window).width();
311
312    _default.height = _default.height > windowHeight ? windowHeight : _default.height;
313    _default.width = _default.width > windowWidth ? windowWidth : _default.width;
314
315    var _beforeClose = _default.beforeClose;
316    _default.beforeClose = function () {
317        if (typeof (_beforeClose) != "undefined") {
318            _beforeClose();
319        }
320        arrClosedDialog.push(arrDialog.pop());
321        arrClosedDialog[arrClosedDialog.length - 1].attr("src", "about:blank");
322    };
323    var dailogObject = null;
324    if (arrClosedDialog.length > 0) {
325        dailogObject = arrClosedDialog.pop()[0];
326    }
327    else {
328        dailogObject = $('<iframe allowTransparency= "true" border="0" frameborder="0" framespacing="0" marginheight="0" marginwidth="0" />');
329    }
330    $(dailogObject).attr("resized", "0")
331                   .attr("src", _default.url);
332    var currDialog = $(dailogObject).dialog(_default);
333    currDialog.width(_default.width - 0);
334    currDialog.height(_default.height - 0);
335    arrDialog.push(currDialog);
336
337}
338
339/* 关闭框架层
340----------------------------------------------------------*/
341/*
342isRefreshParent
343, message
344, callback
345, isShowMessage
346, index
347, form
348*/
349function closeDialog(option) {
350    option = option || {};
351    var _default = {
352        isRefreshParent: false,
353        isShowMessage: false,
354        callback: "",
355        message: "",
356        form: "form"
357    };
358    $.extend(_default, option);
359    var topWindow = window;
360    while (topWindow.parent) {
361        if (topWindow.sysErrorMessage) {
362            break;
363        }
364        topWindow = topWindow.parent;
365    }
366    if (arrDialog.length == 1) {
367        if (_default.highlightData != undefined && _default.highlightData != null)
368            window.commonPage.highlightData = _default.highlightData;
369        if (_default.callback != undefined && _default.callback != "") {
370            var contentWindowDialog = arrDialog[arrDialog.length - 1][0].contentWindow;
371            //回调执行,并传入取得的返回字符串
372            if (contentWindowDialog.returnValue) {
373                option.callbackParameter = contentWindowDialog.eval('returnValue()');
374            }
375            if (option.callbackParameter) {
376                window.eval(option.callback + '(' + option.callbackParameter + ')');
377            } else {
378                window.eval(option.callback + '()');
379            }
380        }
381        if (_default.isShowMessage) {
382            topWindow.sysErrorMessage(_default.message, {});
383        }
384        if (_default.isRefreshParent) {
385            window.goPage(currentPageUrl);
386        }
387    }
388    else {
389        refreshDialog(_default);
390    }
391
392    $(arrDialog[arrDialog.length - 1]).dialog("close");
393
394    if (_default.isShowMessage) {
395        sysMessage(_default.message);
396    }
397}
398
399
400/* 刷新弹出层
401----------------------------------------------------------*/
402function refreshDialog(option) {
403    var contentWindowOpener = arrDialog[arrDialog.length - 2][0].contentWindow;
404    var contentWindowDialog = arrDialog[arrDialog.length - 1][0].contentWindow;
405
406    if (option.callback != undefined && option.callback != "") {
407        //回调执行,并传入取得的返回字符串
408        if (contentWindowDialog.returnValue) {
409            contentWindowOpener.eval(option.callback + '(' + contentWindowDialog.eval('returnValue()') + ')');
410        }
411        else {
412            contentWindowOpener.eval(option.callback + '()');
413        }
414    }
415    if (option.isRefreshParent) {
416        contentWindowOpener.commonPage.submitPageForm(option.form);
417    }
418}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.