Bureaucrats, editor, Interface administrators, Administrators (Semantic MediaWiki), Curators (Semantic MediaWiki), Editors (Semantic MediaWiki), Administrators
47,390
edits
No edit summary Tag: Reverted |
|||
Line 54:
}
function buildGadget([entries, users, mw.pages]) {
lastUpdate = new Date();
// refreshed
if (gadgetLoaded) {
$('.gadget-abuselog-list').replaceWith(buildList(entries, users, mw.pages));
}
// initial load
Line 65:
let $container = $('<div class="gadget-abuselog"></div>');
$container.append(buildHeader(), buildList(entries, users, mw.pages));
$('.mw-changeslist').before($container);
gadgetLoaded = true;
Line 224:
}
function buildList(entries, users, mw.pages) {
let $list = $('<div class="gadget-abuselog-list"></div>');
let pageArr = Object.values(mw.pages);
for (let entry of entries) {
Line 241:
let opts = {
isRegistered: Object.hasOwn(user, 'userid'),
isRedirect: page === undefined, // API response separates redirects from mw.pages object
pageExists: page === undefined || Object.hasOwn(page, 'pageid'),
userPageExists: Object.hasOwn(userPage, 'pageid'),
Line 359:
function buildLink(pagename, opts) {
let url = mw.mw.util.getUrl(pagename);
if (opts.param) url = mw.mw.util.getUrl(pagename, {[opts.param]: opts.value});
if (!opts.exists) url = mw.mw.util.getUrl(pagename, {action: 'edit'});
if (opts.isRedirect) url = mw.mw.util.getUrl(pagename, {redirect: 'no'});
let title = (opts.exists) ? pagename : pagename + ' (page does not exist)';
Line 384:
function getPageTitles(abuselog) {
let mw.pages = new Set();
let usernames = getUsernames(abuselog);
for (let entry of abuselog) {
mw.pages.add(entry.title);
}
for (let username of usernames) {
mw.pages.add('User:' + username);
mw.pages.add('User talk:' + username);
}
return [...mw.pages];
}
Line 436:
// this api call gets:
// - page info for target mw.pages in abuselog
// - user info for users listed in abuselog
// - page info for those users' userpages and talk mw.pages
return api.get({
list: 'users',
Line 449:
function (results) {
let usersResult = results.query.users;
let pagesResult = results.query.mw.pages;
return [abuselogResult, usersResult, pagesResult];
|