Content deleted Content added
(bot/CD) |
(bot/CD) |
||
Line 37:
* @author Jake Archibald
* @url https://github.com/jakearchibald/idb
*//*!
* @package tsx-dom
Line 49 ⟶ 43:
* @author Santo Pfingsten
* @url https://github.com/Lusito/tsx-dom
*//*!
* @package broadcastchannel-polyfill
* @version 1.0.1
* @license Unlicense
* @author Joshua Bell
* @url https://github.com/JSmith01/broadcastchannel-polyfill
*//*!
* @package @chlodalejandro/parsoid
Line 1,414:
// revisions to be processed here, and can assume that the rest is user comments.
const revids = [];
const revidText = {};
let diffs = null, comments, diffTemplate = '[[Special:Diff/$1|($2)]]';
if (extras) {
Line 1,419 ⟶ 1,420:
let diff = true;
while (diff) {
diff = diffMatch === null || diffMatch === void 0 ? void 0 : diffMatch[1];
if (diff != null) {
revids.push(+diff);
revidText[+diff] = diffMatch[2].replace(/^\(|\)$/g, '');
}
}
Line 1,469 ⟶ 1,472:
comments,
revids,
revidText,
diffTemplate,
diffsTemplate: diffsBolded ? "'''$1'''" : '$1'
Line 1,564 ⟶ 1,568:
this.current = this.current.slice(match[0].length);
return match[n];
}
else {
return null;
}
}
/**
* Eats a given expression from the start of the working string. If the working
* string does not contain the given expression, `null` is returned (and not a
* blank string). Only eats once, so any expression must be greedy if different
* behavior is expected.
*
* The regular expression passed into this function is automatically re-wrapped
* with `^(?:<source>)`. Avoid adding these expressions on your own.
*
* @param pattern The pattern to match.
* @return A {@link RegExpExecArray}.
*/
eatExpressionMatch(pattern) {
const expression = new RegExp(`^(?:${pattern.source})`,
// Ban global and multiline, useless since this only matches once and to
// ensure that the reading remains 'flat'.
pattern.flags.replace(/[gm]/g, ''));
const match = expression.exec(this.current);
if (match) {
this.current = this.current.slice(match[0].length);
return match;
}
else {
Line 1,775 ⟶ 1,805:
}
// Load tag messages
// First gather all tags mentioned, and then load messages.
const tags = Array.from(revisionData.values()).reduce((acc, cur) => {
if (acc.
acc.push(tag);
}
}
}
Line 1,930 ⟶ 1,963:
* @param root0.revid
* @param root0.parentid
* @param root0.missing
* @return HTML element
*/
function ChangesListLinks({ revid: _revid, parentid: _parentid, missing }) {
const cur = getRevisionDiffURL(_revid, 'cur');
const prev = missing ?
getRevisionDiffURL(_revid, 'prev') :
getRevisionDiffURL(_parentid, _revid);
return h_1("span", { class: "mw-changeslist-links" },
h_1("span", null,
h_1("a", { rel: "noopener", href:
h_1("span", null, (!
mw.msg('deputy.session.revision.prev') :
h_1("a", { rel: "noopener", href:
}
/**
Line 2,042 ⟶ 2,078:
return tagMessage !== '-' && h_1("span", { class: `mw-tag-marker mw-tag-marker-${v}`, dangerouslySetInnerHTML: tagMessage });
}));
}
/**
* Unwraps an element into its child elements. This entirely discards
* the parent element.
*
* @param el The element to unwrap.
* @return The unwrapped element.
*/
function unwrapElement (el) {
return Array.from(el.childNodes).map(v => v instanceof HTMLElement ? v :
(v instanceof Text ? v.textContent : undefined)).filter(v => v !== undefined);
}
Line 2,164 ⟶ 2,212:
}
/**
* Renders revision info. This is only called if the revision exists.
*/
var _a, _b
const commentElement = h_1("span", { class: "comment comment--without-parentheses",
/** Stranger danger! Yes. */
dangerouslySetInnerHTML: this.revision.parsedcomment });
return h_1("span", null,
" ",
h_1(ChangesListTime, { timestamp: this.revision.timestamp }),
h_1(ChangesListDate, { revision: this.revision }),
"
h_1(ChangesListUser, { user: this.revision.user }),
" ",
Line 2,193 ⟶ 2,237:
commentElement,
" ",
((
h_1(ChangesListTags, { tags: this.revision.tags }));
}
/**
* Renders a placeholder for missing revisions.
*/
renderMissingRevisionInfo() {
return h_1("span", null,
' ',
h_1("i", { dangerouslySetInnerHTML: mw.message('deputy.session.revision.missing', this.revision.revid).parse() }));
}
/**
* @inheritDoc
*/
render() {
var _a;
window.deputy.comms.addEventListener('revisionStatusUpdate', this.revisionStatusUpdateListener);
// Be wary of the spaces between tags.
return h_1("div", { class: ((_a = this.revision.tags) !== null && _a !== void 0 ? _a : []).map((v) => 'mw-tag-' + v).join(' ') },
unwrapWidget(this.completedCheckbox),
h_1(ChangesListLinks, { revid: this.revision.revid, parentid: this.revision.parentid, missing: this.revision.missing }),
unwrapElement(this.revision.missing ?
this.renderMissingRevisionInfo() :
this.renderRevisionInfo()));
}
/**
Line 2,627 ⟶ 2,693:
[ContributionSurveyRowStatus.PresumptiveRemoval]: 'trash'
};
/**
* Returns the last item of an array.
*
* @param array The array to get the last element from
* @return The last element of the array
*/
function last(array) {
return array[array.length - 1];
}
var DeputyContributionSurveyRowState;
Line 2,778 ⟶ 2,854:
if (unfinishedDiffs.length > 0) {
diffsText += unfinishedDiffs.map((v) => {
return mw.format(this.row.data.diffTemplate, v.revision.revid, v.revision.diffsize
// For whatever reason, diffsize is missing. Fall back to the text we had
// previously.
v.uiRow.row.data.revidText[v.revision.revid] :
(v.revision.diffsize > 0 ?
'+' + v.revision.diffsize : v.revision.diffsize));
}).join('');
result += mw.format(this.row.data.diffsTemplate, diffsText);
Line 3,114 ⟶ 3,195:
renderDetails(diffs) {
const parts = [];
// Timestamp is always found in a non-missing diff, suppressed or not.
const validDiffs = Array.from(diffs.values()).filter((v) => v.timestamp);
if (validDiffs.length > 0) {
const diffArray = Array.from(diffs.values());
if (diffArray.some((v) => !v.parentid)) {
Line 3,120 ⟶ 3,203:
}
// Number of edits
parts.push(mw.message('deputy.session.row.details.edits', diffs.size.toString()).text());
// Identify largest diff
const largestDiff = diffs.get(Array.from(diffs.values())
Line 3,335 ⟶ 3,416:
const baseRevisionIndex = baseRevision == null ?
0 : this.revisions.indexOf(baseRevision);
const exactRevision = event.data.reverse ?
last(this.revisions.filter((r, i) => i < baseRevisionIndex && !r.completed)) :
this.revisions.find((r, i) => i > baseRevisionIndex && !r.completed);
const firstRevision = exactRevision == null ?
this.revisions.find((r) => !r.completed) : null;
Line 3,579 ⟶ 3,663:
var version = "0.4.2";
var gitAbbrevHash = "
var gitBranch = "main";
var gitDate = "
var gitVersion = "0.4.2+
/**
Line 3,685 ⟶ 3,769:
}
return new InternalDeputyMessageWidget(config);
}
Line 3,909 ⟶ 3,983:
}
const m = message.join(mw.msg('deputy.content.assessed.comma'));
if (m.length === 0) {
return mw.msg('deputy.content.reformat');
}
const summary = mw.msg(nowClosed ?
'deputy.content.summary.sectionClosed' :
Line 5,268 ⟶ 5,345:
* @return The OOUI ButtonWidget element.
*/
const getButtonClickHandler = (button, reverse) => {
return () => __awaiter(this, void 0, void 0, function* () {
this.setDisabled(true);
if (this.options.nextRevision) {
// No need to worry about swapping elements here, since `loadNewDiff`
// will fire the `wikipage.diff` MW hook. This means this element will
// be rebuilt from scratch anyway.
try {
const nextRevisionData = yield window.deputy.comms.sendAndWait({
type: 'pageNextRevisionRequest',
caseId: this.options.caseId,
page: this.row.title.getPrefixedText(),
after: this.revision,
reverse
});
if (nextRevisionData == null) {
OO.ui.alert(mw.msg('deputy.session.page.incommunicable'));
this.setDisabled(false);
}
else if (nextRevisionData.revid != null) {
yield DiffPage.loadNewDiff(nextRevisionData.revid);
}
else {
this.setDisabled(false);
button.setDisabled(true);
}
}
catch (e) {
console.error(e);
this.setDisabled(false);
}
}
else if (this.options.nextRevision !== false) {
// Sets disabled to false if the value is null.
this.setDisabled(false);
}
});
};
this.previousRevisionButton = new OO.ui.ButtonWidget({
invisibleLabel: true,
label: mw.msg('deputy.session.page.diff.previous'),
title: mw.msg('deputy.session.page.diff.previous'),
icon: 'previous',
disabled: this.options.nextRevision == null
});
this.previousRevisionButton.on('click', getButtonClickHandler(this.nextRevisionButton, true));
this.nextRevisionButton = new OO.ui.ButtonWidget({
invisibleLabel: true,
Line 5,276 ⟶ 5,399:
disabled: this.options.nextRevision == null
});
this.nextRevisionButton.on('click',
return h_1("div", { class: "dp-pt-section" },
h_1("div", { class: "dp-pt-section-content" },
this.revision != null && unwrapWidget(this.previousRevisionButton),
unwrapWidget(this.nextRevisionButton)));
}
/**
Line 5,352 ⟶ 5,443:
this.renderCaseInfo(),
this.renderRevisionInfo(),
this.
this.renderMenus());
}
Line 5,361 ⟶ 5,452:
*/
setDisabled(disabled) {
var _a, _b, _c, _d;
(_a = this.statusDropdown) === null || _a === void 0 ? void 0 : _a.setDisabled(disabled);
(_b = this.revisionCheckbox) === null || _b === void 0 ? void 0 : _b.setDisabled(disabled);
(_c = this.
(_d = this.nextRevisionButton) === null || _d === void 0 ? void 0 : _d.setDisabled(disabled);
}
/**
Line 5,389 ⟶ 5,481:
this.options.nextRevision = data.nextRevision;
// Re-render button.
swapElements(this.
}
}
Line 6,054 ⟶ 6,146:
*/
refreshLabel() {
if (this.copiedTemplateRow.from && equalTitle(this.copiedTemplateRow.from, normalizeTitle(this.copiedTemplateRow.parent.parsoid.getPage())
.getSubjectPage())) {
this.label = mw.message('deputy.ante.copied.entry.shortTo', this.copiedTemplateRow.to || '???').text();
}
else if (this.copiedTemplateRow.to && equalTitle(this.copiedTemplateRow.to, normalizeTitle(this.copiedTemplateRow.parent.parsoid.getPage())
.getSubjectPage())) {
this.label = mw.message('deputy.ante.copied.entry.shortFrom', this.copiedTemplateRow.from || '???').text();
Line 8,655 ⟶ 8,747:
function DemoTemplateMessage (nocat = false) {
return h_1("span", null,
h_1("b", null, mw.message(nocat ? 'deputy.
h_1("br", null),
mw.message(nocat ? 'deputy.
h_1("br", null),
h_1("span", { class: "cte-message-button" }));
Line 13,363 ⟶ 13,455:
}
var cteStyles = ".copied-template-editor .oo-ui-window-frame {width: 1000px !important;}.copied-template-editor .oo-ui-menuLayout > .oo-ui-menuLayout-menu {height: 20em;width: 20em;}.copied-template-editor .oo-ui-menuLayout > .oo-ui-menuLayout-content {left: 20em;}.cte-preview .copiednotice {margin-left: 0;margin-right: 0;}.cte-merge-panel {padding: 16px;z-index: 20;border: 1px solid lightgray;margin-bottom: 8px;}.copied-template-editor .oo-ui-bookletLayout-outlinePanel {bottom: 32px;}.cte-actionPanel {height: 32px;width: 100%;position: absolute;bottom: 0;z-index: 1;background-color: white;border-top: 1px solid #c8ccd1;}.cte-actionPanel > .oo-ui-buttonElement {display: inline-block;margin: 0 !important;}.cte-templateOptions {margin: 8px;display: flex;}.cte-templateOptions > * {flex: 1;}.cte-fieldset {border: 1px solid gray;background-color: #ddf7ff;padding: 16px;min-width: 200px;clear: both;}.cte-fieldset-date {float: left;margin-top: 10px !important;}.cte-fieldset-advswitch {float: right;}.cte-fieldset-advswitch .oo-ui-fieldLayout-field,.cte-fieldset-date .oo-ui-fieldLayout-field {display: inline-block !important;}.cte-fieldset-advswitch .oo-ui-fieldLayout-header {display: inline-block !important;margin-right: 16px;}.copied-template-editor .mw-widgets-datetime-dateTimeInputWidget-handle .oo-ui-iconElement-icon {left: 0.5em;width: 1em;height: 1em;top: 0.4em;}.cte-fieldset-date .mw-widgets-datetime-dateTimeInputWidget-editField {min-width: 2.5ch !important;}.cte-fieldset-date :not(.mw-widgets-datetime-dateTimeInputWidget-empty) > .mw-widgets-datetime-dateTimeInputWidget-handle {padding-right: 0;}.cte-page-row:not(:last-child),.cte-page-template:not(:last-child),.cte-fieldset-date.oo-ui-actionFieldLayout.oo-ui-fieldLayout-align-top .oo-ui-fieldLayout-header {padding-bottom: 0 !important;}.cte-page-template + .cte-page-row {padding-top: 0 !important;}.copied-template-editor .oo-ui-fieldsetLayout.oo-ui-iconElement > .oo-ui-fieldsetLayout-header {position: relative;}.oo-ui-actionFieldLayout.oo-ui-fieldLayout-align-top .oo-ui-fieldLayout-header {padding-bottom: 6px !important;}.deputy.oo-ui-
/**
Line 13,599 ⟶ 13,691:
"deputy.session.revision.new": "N",
"deputy.session.revision.new.tooltip": "This edit created a new page.",
"deputy.session.revision.missing": "The revision [[Special:Diff/$1|$1]] could not be found. It may have been deleted or suppressed.",
"deputy.session.page.diff.previous": "Navigate to the previous unassessed revision",
"deputy.session.page.diff.next": "Navigate to the next unassessed revision",
"deputy.session.page.diff.loadFail": "Failed to load diff. Please check your internet connection and try again.",
Line 16,134 ⟶ 16,228:
}
/**
* Initialize Deputy. This static function attaches Deputy to the `window.deputy`
* object and initializes that instance.
*/
static init() {
|