notice.js
7.51 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
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
var x0=0,y0=0,x1=0,y1=0;
// var offx=6,offy=6;
var moveable=false;//鼠标是否是按下状态
// var hover='orange',normal='slategray';//color;
var hover='slategray',normal='slategray';//color;
var index=10000;//z-index;
//创建一个对象;
function xWin(id,tit,msg,url){
index = index+2;
if(id==1){
isShow_chinnal=false;
}else if(id==2){
isShow_liveApply=false;
}
this.id = id;
this.width = 300;//主窗体宽度
this.height = 200;//主窗体高度
this.right = 0;//位置距右
this.bottom = 0;//位置距下
this.zIndex = index;
this.title = tit;//标题
this.message = msg;//消息体
this.url = url;//url
this.obj = null;
this.bulid = bulid;
this.bulid();
}
//初始化;
function bulid(){
var str = ""
+ "<div id=xMsg" + this.id + " "
+ "style='"
+ "z-index:" + this.zIndex + ";"
+ "width:" + this.width + "px;"
+ "height:" + this.height + "px;"
+ "right:" + this.right + ";"
+ "bottom:" + this.bottom + ";"
+ "background-color:white;"
+ "color:" + normal + ";"
+ "font-size:18px;"
+ "font-family:Verdana;"
+ "position:fixed;"
+ "cursor:default;"
+ "-webkit-user-select:none;"
+ "-moz-user-select:none;"
+ "-ms-user-select:none;"
+ "user-select:none;"
+ "border:2px solid " + normal + ";"
+ "' "
+ "οnmοusedοwn='getFocus(this)'"
+">"
// 标题开始
+ "<div "
+ "style='"
+ "background-color:" + normal + ";"
+ "width:" + (this.width-2*2) + "px;"
+ "height:28px;"
+ "color:white;"
+ "' "
+ "onmousedown='startDrag(this)' "
+ "onmouseup='stopDrag(this)' "
+ "onmousemove='drag(this)' "
+ "ondblclick='min(this.childNodes[1])'"
+ ">"
+ "<span style='width:" + (this.width-2*25-4) + "px;padding-left:3px; display:-moz-inline-box; display:inline-block;'>" + this.title + "</span>"
+ "<span style='width:25px;border-width:0px;color:white;font-family:webdings;display:-moz-inline-box; display:inline-block;' onclick='min(this)'>0</span>"
+ "<span style='width:25px;border-width:0px;color:white;font-family:webdings;display:-moz-inline-box; display:inline-block;' onclick='cls(this," + this.id + ")'>r</span>"
+ "</div>"
// 主窗体开始
+ "<div style='"
+ "width:100%;"
+ "height:" + (this.height-28-4) + "px;"
+ "min-height:" + (this.height-28-4) + "px;"
+ "background-color:white;"
+ "word-break:break-all;"
+ "padding:3px;"
+ "'>"
// 主窗体的内容部分
+ "<div style='"
+ "width:100%;"
+ "height:" + (this.height-28-4-50) + "px;"
+ "min-height:" + (this.height-28-4-50) + "px;"
+ "line-height:20px;"
+ "text-align: center;"
+ "word-break:break-all;"
+ "padding:3px;"
+ "padding-top: 40px;"
+ "color:red;"
+ "'>"
+ this.message
+ "</div>"
// 主窗体的按钮部分(按钮1)
+ "<div style='"
+ "width:60px;"
+ "height:30px;"
+ "color: #fff;"
+ "line-height: 30px;"
+ "text-align: center;"
+ "font-size: 15px;"
+ "float:left;"
+ "margin-left: 120px;"
+ "background-color:" + normal + ";"
+ "'"
+" type='button'"
+" onclick='cls(this," + this.id + ")'"
+">确定</div>"
// 主窗体的按钮部分(按钮2)
+ "<div style='"
+ "width:60px;"
+ "height:30px;"
+ "color: #fff;"
+ "line-height: 30px;"
+ "text-align: center;"
+ "font-size: 15px;"
+ "float:right;"
+ "margin-right:20px;"
+ "background-color:" + normal + ";"
+ "'"
+" type='button'"
+" onclick=\"toLink('"+this.url+"'," + this.id + ")\""
+">查看</div>"
+ "</div>"
+ "</div>";
document.body.insertAdjacentHTML("beforeEnd",str);
}
//开始拖动;
function startDrag(obj){
if(event.button==0){
//锁定标题栏;
// obj.setCapture();
//定义对象;
var win = obj.parentNode;
// var sha = win.nextSibling;
//记录鼠标和层位置;
x0 = event.clientX;
y0 = event.clientY;
x1 = parseInt(win.style.right.replace("px",""));
y1 = parseInt(win.style.bottom.replace("px",""));
//记录颜色;
normal = obj.style.backgroundColor;
//改变风格;
obj.style.backgroundColor = hover;
win.style.borderColor = hover;
obj.nextSibling.style.color = hover;
// sha.style.right = (x1 - offx)+"px";
// sha.style.bottom = (y1 - offy)+"px";
moveable = true;
}
}
//拖动;
function drag(obj){
if(moveable){
var win = obj.parentNode;
// var sha = win.nextSibling;
win.style.right = ( x1+x0-event.clientX)+"px";
win.style.bottom = ( y1+y0-event.clientY)+"px";
// sha.style.right = (parseInt(win.style.right.replace("px","")) - offx)+"px";
// sha.style.bottom = (parseInt(win.style.bottom.replace("px","")) - offy)+"px";
}
}
//停止拖动;
function stopDrag(obj){
if(moveable){
var win = obj.parentNode;
// var sha = win.nextSibling;
var msg = obj.nextSibling;
win.style.borderColor = normal;
obj.style.backgroundColor = normal;
msg.style.color = normal;
// sha.style.right = obj.parentNode.style.right;
// sha.style.bottom = obj.parentNode.style.bottom;
// obj.releaseCapture();
moveable = false;
}
}
//获得焦点;
function getFocus(obj)
{
if(obj.style.zIndex!=index)
{
index = index + 2;
var idx = index;
obj.style.zIndex=idx;
obj.nextSibling.style.zIndex=idx-1;
}
}
//最小化;
function min(obj){
var win = obj.parentNode.parentNode;
// var sha = win.nextSibling;
var tit = obj.parentNode;
var msg = tit.nextSibling;
var flg = msg.style.display=="none";
if(flg)
{
win.style.height = (parseInt(msg.style.height.replace("px","")) + parseInt(tit.style.height.replace("px","")) + 2*2)+"px";
// sha.style.height = win.style.height;
msg.style.display = "block";
obj.innerHTML = "0";
}
else
{
win.style.height = (parseInt(tit.style.height.replace("px","")) + 2*2)+"px";
// sha.style.height = win.style.height;
obj.innerHTML = "2";
msg.style.display = "none";
}
}
//关闭;
function cls(obj,id){
var win = obj.parentNode.parentNode;
// var sha = win.nextSibling;
win.style.visibility = "hidden";
// sha.style.visibility = "hidden";
if(id==1){
isShow_chinnal=true;
}else if(id==2){
isShow_liveApply=true;
}
}
//点击查看跳转链接
function toLink(url,id){
if(id==1){
isShow_chinnal=true;
}else if(id==2){
isShow_liveApply=true;
} window.location.href= url;
// window.location.href= window.location.protocol+"//"+window.location.host+"/channel/page?shenhe_status=0&receive=0";
}