User:Chlod/Scripts/Deputy.js: Difference between revisions

Content deleted Content added
[480d81f] ia: add fields for presumptive deletion
[03a9505] various page toolbar improvements; [13892d7] getNameText (deprecated) to getMainText
Line 1,979:
const userContribsPage = new mw.Title('Special:Contributions/' + user);
return h_1("span", { class: "history-user" },
h_1("a", { class: "mw-userlink", target: "_blank", rel: "noopener", href: mw.format(mw.config.get('wgArticlePath'), userPage.getPrefixedDb()), title: userPage.getPrefixedText() }, userPage.getNameTextgetMainText()),
" ",
h_1("span", { class: "mw-usertoollinks mw-changeslist-links" },
Line 2,135:
revision: this.revision.revid,
status: checked,
nextRevision: (_c = (_b = (_a = this.uiRow.revisions) === null || _a === void 0 ? void 0 : _a.find((revision) => !revision.completed &&
revision.revision.revid !== this.revision.revid)) === null || _b === void 0 ? void 0 : _b.revision.revid) !== null && _c !== void 0 ? _c : null
});
this.statusAutosaveFunction();
Line 3,189 ⟶ 3,190:
var _a, _b, _c, _d;
const rev = (_a = this.revisions) === null || _a === void 0 ? void 0 : _a.find((r) => r.revision.revid === event.data.revision);
if (event.data.page === this.row.title.getPrefixedText()) &&{
(event.data.page !== this.row.title.getPrefixedText() || !!rev)) {
window.deputy.comms.reply(event.data, {
type: 'pageStatusResponse',
Line 3,199:
enabledStatuses: this.statusDropdown.getEnabledOptions(),
revisionStatus: rev ? rev.completed : undefined,
revision: event.data.revision,
nextRevision: (_d = (_c = (_b = this.revisions) === null || _b === void 0 ? void 0 : _b.find((revision) => !revision.completed &&
revision.revision.revid !== event.data.revision)) === null || _c === void 0 ? void 0 : _c.revision.revid) !== null && _d !== void 0 ? _d : null
});
}
Line 3,470 ⟶ 3,472:
 
var version = "0.3.1";
var gitAbbrevHash = "480d81f2360b81";
var gitBranch = "main";
var gitDate = "ThuSun, 291 DecJan 20222023 1009:4055:1757 +0800";
var gitVersion = "0.3.1+g480d81fg2360b81";
 
/**
Line 4,970 ⟶ 4,972:
*/
constructor(options) {
}var _a;
this.instanceId = generateId();
this.revisionStatusUpdateListener = this.onRevisionStatusUpdate.bind(this);
this.options = options;
if (options.revisionStatus != null) {
this.revision = (_a = options.revision) !== null && _a !== void 0 ? _a : mw.config.get('wgRevisionId');
}
this.runAsyncJobs();
Line 5,043 ⟶ 5,046:
});
let lastStatus = this.revisionCheckbox.isSelected();
// State }));variables
let processing = false;
let incommunicable = false;
Line 5,118 ⟶ 5,122:
label: mw.msg('deputy.session.page.diff.next'),
title: mw.msg('deputy.session.page.diff.next'),
icon: this.revision == null ? 'play' : 'next',
if ( disabled: this.options.nextRevision == null) {
});
this.nextRevisionButton.on('click', () => __awaiter(this, void 0, void 0, function* () {
Line 5,155 ⟶ 5,160:
}
}));
if (this.options.nextRevision == null) {
this.nextRevisionButton.setDisabled(true);
}
return h_1("div", { class: "dp-pt-section" },
h_1("div", { class: "dp-pt-section-content" }, unwrapWidget(this.nextRevisionButton)));
Line 5,279 ⟶ 5,281:
'oojs-ui-core',
'oojs-ui-windows',
});'oojs-ui-widgets',
'oojs-ui.styles.icons-interactions',
'oojs-ui.styles.icons-movement',
'oojs-ui.styles.icons-moderation',
'oojs-ui.styles.icons-media',
'oojs-ui.styles.icons-editing-advanced',
'oojs-ui.styles.icons-editing-citation'
], () => {
if (mw.hookconfig.get('wikipage.diffwgDiffNewId').add(() =>== __awaiter(this, void 0, void 0, function* (null) {
// AttemptNot toon geta newdiff revisionpage, databut *withwgRevisionId revisionis ID*populated nonetheless.
data = yield DeputyPageSessionthis.getPageDetailsinitInterface(mw.config.get('wgDiffNewId'data) ||;
mw.config.get('wgRevisionId'));}
else }{
const openPromise = this.appendToolbar(Object.assign(Object.assign({}, data), { forceRevision: this.toolbar != null ||
mw.hook('wikipage.diff').add(() => __awaiter(this, void 0, void 0, function* //() Is a diff page.{
yield mwthis.config.getinitInterface('wgDiffNewId') != null })data);
if (this.toolbar &&}));
this.toolbar.revision !== mw.config.get('wgRevisionId')) {}
const oldToolbar = this.toolbar;
openPromise.then(() => {
oldToolbar.close();
});
}
this.toolbar = yield openPromise;
}));
});
}
}
/**
* Initialize the interface.
*
* @param data
*/
initInterface(data) {
return __awaiter(this, void 0, void 0, function* () {
// Attempt to get new revision data *with revision ID*.
const isCurrentDiff = /[?&]diff=0+(\D|$)/.test(window.___location.search);
data = yield DeputyPageSession.getPageDetails((isCurrentDiff ?
// On a "cur" diff page
mw.config.get('wgRevisionIdwgDiffOldId')); :
// On a "prev" diff page
mw.config.get('wgDiffNewId')) ||
mw.config.get('wgRevisionId'));
const openPromise = this.appendToolbar(Object.assign(Object.assign({}, data), { forceRevision: this.toolbar != null ||
// Is a diff page.
mw.config.get('wgDiffNewId') != null }));
if (
// Previous toolbar exists. Close it before moving on.
this.toolbar &&
this.toolbar.revision !== mw.config.get('wgRevisionId')) {
const oldToolbar = this.toolbar;
openPromise.then(() => {
oldToolbar.close();
});
}
this.toolbar = yield openPromise;
});
}
/**
Line 5,347 ⟶ 5,374:
constructor() {
this.DeputyRootSession = DeputyRootSession;
this.DeputyPageSession = DeputyPageSession;
}
/**
Line 5,442 ⟶ 5,470:
// Normal page. Determine if this is being worked on, and then
// start a new session if it is.
const pageSession = yield DeputyPageSession.getPageDetails(mw.config.get('wgDiffNewId') ||;
mw.config.get('wgRevisionId'));
if (pageSession) {
// This page is being worked on, create a session.
Line 10,230 ⟶ 10,257:
nsId('template') ?
// If in the "Template" namespace, "Copied"
WikiAttributionNotices.attributionNoticeTemplates[type].getNameTextgetMainText() :
// If not in the "Template" namespace, "Namespace:Copied"
WikiAttributionNotices.attributionNoticeTemplates[type].getPrefixedText();