-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery.easyui.plus.js
More file actions
111 lines (95 loc) · 3.16 KB
/
jquery.easyui.plus.js
File metadata and controls
111 lines (95 loc) · 3.16 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
/**
* 在iframe中调用,在父窗口中出提示框(herf方式不用调父窗口)
* 右下角弹出
*/
$.extend({
messageBox5s: function (title, msg) {
$.messager.show({
title: title, msg: msg, timeout: 5000, showType: 'slide', style: {
left: '',
right: 5,
top: '',
bottom: -document.body.scrollTop - document.documentElement.scrollTop + 5
}
});
}
});
$.extend({
messageBox10s: function (title, msg) {
$.messager.show({
title: title, msg: msg, height: 'auto', width: 'auto', timeout: 10000, showType: 'slide', style: {
left: '',
right: 5,
top: '',
bottom: -document.body.scrollTop - document.documentElement.scrollTop + 5
}
});
}
});
$.extend({
show_alert: function (strTitle, strMsg) {
$.messager.alert(strTitle, strMsg);
}
});
/**
* panel关闭时回收内存,主要用于layout使用iframe嵌入网页时的内存泄漏问题
*/
$.fn.panel.defaults.onBeforeDestroy = function () {
var frame = $('iframe', this);
try {
// alert('销毁,清理内存');
if (frame.length > 0) {
for (var i = 0; i < frame.length; i++) {
frame[i].contentWindow.document.write('');
frame[i].contentWindow.close();
}
frame.remove();
if ($.browser.msie) {
CollectGarbage();
}
}
} catch (e) {
}
};
//让window弹出框居中
var easyuiPanelOnOpen = function (left, top) {
var iframeWidth = $(this).parent().parent().width();
var iframeHeight = $(this).parent().parent().height();
var windowWidth = $(this).parent().width();
var windowHeight = $(this).parent().height();
var setWidth = (iframeWidth - windowWidth) / 2;
var setHeight = (iframeHeight - windowHeight) / 2;
$(this).parent().css({/* 修正面板位置 */
left: setWidth,
top: setHeight
});
if (iframeHeight < windowHeight) {
$(this).parent().css({/* 修正面板位置 */
left: setWidth,
top: 0
});
}
$(".window-shadow").hide();
};
$.fn.window.defaults.onOpen = easyuiPanelOnOpen;
var easyuiPanelOnResize = function (left, top) {
var iframeWidth = $(this).parent().parent().width();
var iframeHeight = $(this).parent().parent().height();
var windowWidth = $(this).parent().width();
var windowHeight = $(this).parent().height();
var setWidth = (iframeWidth - windowWidth) / 2;
var setHeight = (iframeHeight - windowHeight) / 2;
$(this).parent().css({/* 修正面板位置 */
left: setWidth - 6,
top: setHeight - 6
});
if (iframeHeight < windowHeight) {
$(this).parent().css({/* 修正面板位置 */
left: setWidth,
top: 0
});
}
$(".window-shadow").hide();
//$(".window-mask").hide().width(1).height(3000).show();
};
$.fn.window.defaults.onResize = easyuiPanelOnResize;