Pengguna:Kenrick95/online.js: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
Kenrick95 (bicara | kontrib)
kTidak ada ringkasan suntingan
Kenrick95 (bicara | kontrib)
Tidak ada ringkasan suntingan
 
(3 revisi perantara oleh 2 pengguna tidak ditampilkan)
Baris 10:
* - see which admin is listed on RCFeed, report to a list, show as "apparently online"
*/
mw.loader.using("mediawiki.util", function apparentlyOnline() {
function apparentlyOnline() {
var online_sysops = [], online_sysops_msg = "Tidak ada", last_seen = [];
var online_sysops = [], online_sysops_msg = "Tidak ada", last_seen = [];
function loadNow() {
var window_msg_data = null;
mw.loader.using("mediawiki.api", function () {
var apiwindowManager = newnull, mw.Api()messageDialog = null;
api.get({
action: "query",
function loadNow() {
list: "allusers|recentchanges",
mw.loader.using("mediawiki.api", function () {
format: "json",
var api = new mw.Api();
rclimit: 500,
var i;
rcprop: "user|userid|timestamp",
api.get({
rcshow: "!bot|!anon",
augroup action: "sysopquery",
list: "allusers|recentchanges",
aulimit: 500
format: "json",
})
rclimit: 500,
.done(function (data) {
rcprop: "user|userid|timestamp",
// console.log(data);
rcshow: "!bot|!anon",
var rc = data.query.recentchanges;
augroup: "sysop",
var sysops = data.query.allusers;
aulimit: 500
var is_sysop = {};
})
for (var i = 0; i < sysops.length; i++) {
.done(function (data) {
is_sysop[sysops[i].userid] = true;
// console.log(data);
}
for ( var irc = 0; i < rcdata.lengthquery.recentchanges; i++) {
var sysops = data.query.allusers;
if (is_sysop[rc[i].userid]) {
var is_sysop = {};
if (online_sysops.indexOf(rc[i].user) < 0) {
for (i = 0; i < sysops.length; i++) {
online_sysops.push(rc[i].user);
last_seen.push(rcis_sysop[sysops[i].timestamp)userid] = true;
}
for (i = 0; i < rc.length; i++) {
if (is_sysop[rc[i].userid]) {
if (online_sysops.indexOf(rc[i].user) < 0) {
online_sysops.push(rc[i].user);
last_seen.push(rc[i].timestamp);
}
}
}
// console.log(online_sysops);
}
online_sysops_msg = "";
// console.log(online_sysops);
if (online_sysops.length === 0) {
online_sysops_msg = "";
online_sysops_msg = "Tidak ada";
if (online_sysops.length === 0) {
}
online_sysops_msg = "Tidak ada";
for (i = 0; i < online_sysops.length; i++) {
}
var time = new Date(last_seen[i]);
for (var i = 0; i < online_sysops.length; i++) {
online_sysops_msg += "<li><a href=\"" + mw.config.get("wgServer") + "/wiki/User:" + online_sysops[i] + "\">"
var time = new Date(last_seen[i]);
online_sysops_msg += "<li><a href=\"" + mw.config.get("wgServer") + "/wiki/User:" + online_sysops[i] + "\">"
+ online_sysops[i]"</a> (suntingan terakhir: "
+ "</a>time.toLocaleString(")
+ time.toLocaleString(")</li>";
+ ")</li>";}
window_msg_data = {
}
title: 'Pengurus daring',
document.getElementById("online_sysops_msg").innerHTML = online_sysops_msg;
message: new OO.ui.HtmlSnippet("<div style=\"text-align:left;\">"
+ "Pengurus yang daring berdasarkan 500 suntingan terakhir di perubahan terbaru:"
+ "<br>" + online_sysops_msg + "</div> "),
actions: [
{
action: 'accept',
label: 'Tutup',
flags: 'primary'
}
]
};
windowManager.openWindow(messageDialog, window_msg_data);
});
});
}
var link = mw.util.addPortletLink(
'p-cactions', //p-cactions, p-tb, p-views
'#',
'Pengurus daring',
't-prettylinkwidget',
'Perlihatkan daftar pengurus yang daring',
null,
'#t-whatlinkshere'
);
mw.loader.using('oojs-ui', function() {
messageDialog = new OO.ui.MessageDialog();
windowManager = new OO.ui.WindowManager();
$( 'body' ).append( windowManager.$element );
windowManager.addWindows( [ messageDialog ] );
messageDialog.setSize("large");
});
$(link).click(function (e) {
e.preventDefault();
online_sysops_msg = "Memuat...";
loadNow();
});
}
var link = mw.util.addPortletLink(
'p-cactions', //p-cactions, p-tb, p-views
'#',
'Pengurus daring',
't-prettylinkwidget',
'Perlihatkan daftar pengurus yang daring',
null,
'#t-whatlinkshere'
);
$(apparentlyOnline);
mw.loader.using('jquery.ui.dialog', function() {
$dialog = $("<div></div>")
});
.html("Pengurus yang daring berdasarkan 500 suntingan terakhir di perubahan terbaru:"
+ "<br><div id=\"online_sysops_msg\">" + online_sysops_msg + "</div>")
.dialog({
autoOpen: false,
title: "Pengurus Daring",
width: '500px',
modal: true
});
});
$(link).click(function (e) {
e.preventDefault();
online_sysops_msg = "Memuat...";
loadNow();
$dialog.dialog("open");
});
}
 
$(apparentlyOnline);