MediaWiki:Gadget-OnlineAdmins.js: Difference between revisions
From Test Wiki
Content deleted Content added
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
// About this program: |
// About this program: |
||
// This program was done with implementation of codes, and combined codes of both Alexander Misel and Vjudge1 |
// This program was done with implementation of codes, and combined codes of both Alexander Misel and Vjudge1 |
||
// Program was used for |
// Program was used for Chinese Wikipedia only. For English Wikipedia, please check in the English Box |
||
// Version: 1.2 |
// Version: 1.2 |
||
// Create Portlet Link |
// Create Portlet Link |
||
| Line 7: | Line 7: | ||
'p-personal', |
'p-personal', |
||
'#', |
'#', |
||
' |
'管理人員', |
||
't- |
't-onlineadmin', |
||
'查看当前在线管理员', |
|||
'Seek Help from Administrators, Rollbackers and Reviewers', |
|||
'', |
'', |
||
'#pt-userpage' |
'#pt-userpage' |
||
| Line 79: | Line 79: | ||
if ($.inArray('patroller', user.groups) > -1) { |
if ($.inArray('patroller', user.groups) > -1) { |
||
patrollers[i] = user.name; |
patrollers[i] = user.name; |
||
} |
|||
if ($.inArray('reviewer', user.groups) > -1) { |
|||
reviewers[i] = user.name; |
|||
} |
} |
||
} |
} |
||
| Line 113: | Line 110: | ||
if (admins.length + rollbackers.length + patrollers.length > 0) { |
if (admins.length + rollbackers.length + patrollers.length > 0) { |
||
var adminsstring = ['<p> |
var adminsstring = ['<p>當前在線管理人員</p>']; |
||
if (admins.length > 0) { |
if (admins.length > 0) { |
||
adminsstring.push('<p style="word-break:break-all;"> |
adminsstring.push('<p style="word-break:break-all;">有' + admins.length + '個管理員在線:'); |
||
$.each(admins, function(i, e) { |
$.each(admins, function(i, e) { |
||
adminsstring.push(userlink(e)); |
adminsstring.push(userlink(e)); |
||
| Line 124: | Line 121: | ||
if (patrollers.length > 0) { |
if (patrollers.length > 0) { |
||
adminsstring.push('<p style="word-break:break-all;"> |
adminsstring.push('<p style="word-break:break-all;">有' + patrollers.length + '個巡查員在線:'); |
||
$.each(patrollers, function(i, e) { |
$.each(patrollers, function(i, e) { |
||
adminsstring.push(userlink(e)); |
adminsstring.push(userlink(e)); |
||
| Line 132: | Line 129: | ||
if (rollbackers.length > 0) { |
if (rollbackers.length > 0) { |
||
adminsstring.push('<p style="word-break:break-all;"> |
adminsstring.push('<p style="word-break:break-all;">有' + rollbackers.length + '個回退員在線:'); |
||
$.each(rollbackers, function(i, e) { |
$.each(rollbackers, function(i, e) { |
||
adminsstring.push(userlink(e)); |
adminsstring.push(userlink(e)); |
||
| Line 141: | Line 138: | ||
mw.notify($(adminsstring.join(''))); |
mw.notify($(adminsstring.join(''))); |
||
} else { |
} else { |
||
mw.notify(' |
mw.notify('現在沒有管理人員在線'); |
||
} |
} |
||
}).fail(function () { |
}).fail(function () { |
||
mw.notify(' |
mw.notify('查詢時出現錯誤'); |
||
}); |
}); |
||
}); |
}); |
||