problem.js
2.82 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
function show(anchor) {
$.ajax({
type : "get",
url : anchor.href,
success : function(data, textStatus) {
alertWin("Problem Detail", data);
}
});
return false;
}
function requestGroupInfo(anchor){
$.ajax({
type : "get",
url : anchor.href,
success : function(data, textStatus) {
document.getElementById('machineThreadGroupInfo').innerHTML=data;
}
});
return false;
}
$(document).keypress(function(e) {
if (e.which == 113) {
var lastMsgObj = document.getElementById("msgObjRef");
if (lastMsgObj != null) {
document.body.removeChild(lastMsgObj);
}
}
});
function alertWin(title, msg) {
var lastMsgObj = document.getElementById("msgObjRef");
if (lastMsgObj != null) {
document.body.removeChild(lastMsgObj);
}
var w = 500; // default width
var h = 250; // defaylt hight
var iWidth = document.documentElement.clientWidth;
var iHeight = document.documentElement.clientHeight;
if (iHeight < 600)
iHeight = 600;
if (iWidth < 1000)
iWidth = 1000;
var top_ = 150 + document.documentElement.scrollTop
+ document.body.scrollTop;
var left_ = 500 + document.documentElement.scrollLeft
+ document.body.scrollLeft;
var msgObj = document.createElement("div");
msgObj.setAttribute("id", "msgObjRef");
msgObj.style.cssText = "top:" + top_ + "px;left:" + left_ + "px";
document.body.appendChild(msgObj);
var table = document.createElement("table");
msgObj.appendChild(table);
var tr = table.insertRow(-1);
var titleBar = tr.insertCell(-1);
titleBar.setAttribute("id", "titleBar");
titleBar.innerHTML = title;
var moveX = 0;
var moveY = 0;
var moveTop = 0;
var moveLeft = 0;
var moveable = false;
var docMouseMoveEvent = document.onmousemove;
var docMouseUpEvent = document.onmouseup;
titleBar.onmousedown = function() {
var evt = getEvent();
moveable = true;
moveX = evt.clientX;
moveY = evt.clientY;
moveTop = parseInt(msgObj.style.top);
moveLeft = parseInt(msgObj.style.left);
document.onmousemove = function() {
if (moveable) {
var evt = getEvent();
var x = moveLeft + evt.clientX - moveX;
var y = moveTop + evt.clientY - moveY;
if (x > 0 && (x + w < iWidth) && y > 0 && (y + h < iHeight)) {
msgObj.style.left = x + "px";
msgObj.style.top = y + "px";
}
}
};
document.onmouseup = function() {
if (moveable) {
document.onmousemove = docMouseMoveEvent;
document.onmouseup = docMouseUpEvent;
moveable = false;
moveX = 0;
moveY = 0;
moveTop = 0;
moveLeft = 0;
}
};
};
var closeBtn = tr.insertCell(-1);
closeBtn.setAttribute("id", "closeBtn");
closeBtn.innerHTML = "×";
closeBtn.onclick = function() {
document.body.removeChild(msgObj);
};
var msgBox = table.insertRow(-1).insertCell(-1);
msgBox.colSpan = 2;
msgBox.innerHTML = msg;
function getEvent() {
return window.event || arguments.callee.caller.arguments[0];
}
}