forum_moderate.js
3.76 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
/*
[Discuz!] (C)2001-2099 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: forum_moderate.js 26484 2011-12-14 02:08:03Z svn_project_zhangjie $
*/
function modaction(action, pid, extra, mod) {
if(!action) {
return;
}
var mod = mod ? mod : 'forum.php?mod=topicadmin';
var extra = !extra ? '' : '&' + extra;
if(!pid && in_array(action, ['delpost', 'banpost'])) {
var checked = 0;
var pid = '';
for(var i = 0; i < $('modactions').elements.length; i++) {
if($('modactions').elements[i].name.match('topiclist')) {
checked = 1;
break;
}
}
} else {
var checked = 1;
}
if(!checked) {
alert('请选择需要操作的帖子');
} else {
$('modactions').action = mod + '&action='+ action +'&fid=' + fid + '&tid=' + tid + '&handlekey=mods&infloat=yes&nopost=yes' + (!pid ? '' : '&topiclist[]=' + pid) + extra + '&r' + Math.random();
showWindow('mods', 'modactions', 'post');
if(BROWSER.ie) {
doane(event);
}
hideMenu();
}
}
function modthreads(optgroup, operation) {
var operation = !operation ? '' : operation;
$('modactions').action = 'forum.php?mod=topicadmin&action=moderate&fid=' + fid + '&moderate[]=' + tid + '&handlekey=mods&infloat=yes&nopost=yes' + (optgroup != 3 && optgroup != 2 ? '&from=' + tid : '');
$('modactions').optgroup.value = optgroup;
$('modactions').operation.value = operation;
hideWindow('mods');
showWindow('mods', 'modactions', 'post', 0);
if(BROWSER.ie) {
doane(event);
}
}
function pidchecked(obj) {
if(obj.checked) {
try {
var inp = document.createElement('<input name="topiclist[]" />');
} catch(e) {
try {
var inp = document.createElement('input');
inp.name = 'topiclist[]';
} catch(e) {
return;
}
}
inp.id = 'topiclist_' + obj.value;
inp.value = obj.value;
inp.type = 'hidden';
$('modactions').appendChild(inp);
} else {
$('modactions').removeChild($('topiclist_' + obj.value));
}
}
var modclickcount = 0;
function modclick(obj, pid) {
if(obj.checked) {
modclickcount++;
} else {
modclickcount--;
}
$('mdct').innerHTML = modclickcount;
if(modclickcount > 0) {
var offset = fetchOffset(obj);
$('mdly').style.top = offset['top'] - 65 + 'px';
$('mdly').style.left = offset['left'] - 215 + 'px';
$('mdly').style.display = '';
} else {
$('mdly').style.display = 'none';
}
}
function resetmodcount() {
modclickcount = 0;
$('mdly').style.display = 'none';
}
function tmodclick(obj) {
if(obj.checked) {
modclickcount++;
} else {
modclickcount--;
}
$('mdct').innerHTML = modclickcount;
if(modclickcount > 0) {
var top_offset = obj.offsetTop;
while((obj = obj.offsetParent).id != 'threadlist') {
top_offset += obj.offsetTop;
}
$('mdly').style.top = top_offset - 7 + 'px';
$('mdly').style.display = '';
} else {
$('mdly').style.display = 'none';
}
}
function tmodthreads(optgroup, operation) {
var checked = 0;
var operation = !operation ? '' : operation;
for(var i = 0; i < $('moderate').elements.length; i++) {
if($('moderate').elements[i].name.match('moderate') && $('moderate').elements[i].checked) {
checked = 1;
break;
}
}
if(!checked) {
alert('请选择需要操作的帖子');
} else {
$('moderate').optgroup.value = optgroup;
$('moderate').operation.value = operation;
hideWindow('mods');
showWindow('mods', 'moderate', 'post', 0);
}
}
function getthreadclass() {
var fid = $('fid');
if(fid) {
ajaxget('forum.php?mod=ajax&action=getthreadclass&fid=' + fid.value, 'threadclass', null, null, null, showthreadclass);
}
}
function showthreadclass() {
try{
$('append_parent').removeChild($('typeid_ctrl_menu'));
}catch(e) {}
simulateSelect('typeid');
}
loadcss('forum_moderator');