Content deleted Content added
(bot/CD) |
(bot/CD) |
||
Line 1,305:
if (el.$element == null) {
console.error(el);
throw new Error('Element is not
}
return el.$element[0];
Line 2,058:
this.uiRow = row;
if (this.statusAutosaveFunction == null) {
// TODO: types-mediawiki limitation
this.statusAutosaveFunction = mw.util.throttle(() => __awaiter(this, void 0, void 0, function* () {
yield this.saveStatus();
Line 2,138 ⟶ 2,139:
return __awaiter(this, void 0, void 0, function* () {
this.completedCheckbox = new OO.ui.CheckboxInputWidget({
selected: yield this.getSavedStatus()
});
Line 2,522 ⟶ 2,523:
refresh() {
const icon = DeputyCCIStatusDropdown.menuOptionIcons[this.status];
this.dropdown.setIcon(
}
/**
Line 2,619 ⟶ 2,620:
}
DeputyCCIStatusDropdown.menuOptionIcons = {
[ContributionSurveyRowStatus.Unfinished]:
[ContributionSurveyRowStatus.Unknown]: 'alert',
[ContributionSurveyRowStatus.WithViolations]: 'check',
Line 2,955 ⟶ 2,956:
onUpdate() {
if (this.statusAutosaveFunction == null) {
// TODO: types-mediawiki limitation
this.statusAutosaveFunction = mw.util.throttle(() => __awaiter(this, void 0, void 0, function* () {
yield this.saveStatus();
Line 3,420 ⟶ 3,422:
unwrapWidget(this.content).appendChild(this.element);
this.$body.append(this.content.$element);
return this;
}
/**
Line 3,450 ⟶ 3,453:
});
if (compareRequest.error) {
swapElements(this.element, unwrapWidget(new OO.ui.MessageWidget({
type: 'error',
label: mw.msg('deputy.diff.error')
})));
}
const diffHTML = compareRequest.compare.bodies.main;
Line 3,486 ⟶ 3,489:
}
},
_a.static = Object.assign(Object.assign({}, OO.ui.ProcessDialog.static), { name: 'deputyReviewDialog', title: mw.msg('deputy.diff'), actions: [
{
flags: ['safe', 'close'],
Line 3,498:
action: 'close'
}
] }),
_a);
}
Line 3,580 ⟶ 3,579:
var version = "0.4.2";
var gitAbbrevHash = "
var gitBranch = "main";
var gitDate = "
var gitVersion = "0.4.2+
/**
Line 3,651 ⟶ 3,650:
const actionContainer = h_1("div", { class: "dp-messageWidget-actions" });
for (const action of ((_a = config.actions) !== null && _a !== void 0 ? _a : [])) {
if (action instanceof OO.ui.
actionContainer.appendChild(unwrapWidget(action));
}
Line 3,664 ⟶ 3,663:
closeButton.on('click', () => {
removeElement(unwrapWidget(this));
this.emit('close');
});
actionContainer.appendChild(unwrapWidget(closeButton));
Line 4,245:
this.comments = v;
});
return this.container = h_1("div", { class: "deputy dp-cs-section" },
h_1("div", null, this.rows.map((row) => row.render())),
Line 4,450 ⟶ 4,449:
'deputy', 'dp-cs-session-notice', 'dp-cs-session-tabActive'
],
type: '
title: mw.msg('deputy.session.tabActive.head'),
message: mw.msg('deputy.session.tabActive.help'),
Line 5,013 ⟶ 5,012:
});
menuSelectWidget.on('select', () => {
// Not a multiselect MenuSelectWidget
const selected = menuSelectWidget.findSelectedItem();
if (selected) {
Line 5,188:
}
this.revisionCheckbox = new OO.ui.CheckboxInputWidget({
selected: this.options.revisionStatus
});
Line 6,192:
}),
merge: new OO.ui.CheckboxInputWidget({
}),
afd: new OO.ui.TextInputWidget({
Line 6,465:
*/
setupOutlineItem() {
if (this.outlineItem !== undefined) {
this.outlineItem
.setMovable(true)
Line 6,529 ⟶ 6,527:
*/
clone(parent) {
// Odd constructor usage here allows cloning from subclasses without having
// to re-implement the cloning function.
// noinspection JSCheckFunctionSignatures
return new this.constructor(this, parent);
Line 6,627:
const mergeTarget = new OO.ui.DropdownInputWidget({
$overlay: true,
});
const mergeTargetButton = new OO.ui.ButtonWidget({
Line 6,633:
});
mergeTargetButton.on('click', () => {
const template = parentTemplate.parsoid.findNoticeType(type).find((v) => v.name === mergeTarget.
if (template) {
// If template found, merge and reset panel
Line 6,712:
function renderPreviewPanel(template) {
const previewPanel = h_1("div", { class: "cte-preview" });
// TODO: types-mediawiki limitation
const updatePreview = mw.util.throttle(() => __awaiter(this, void 0, void 0, function* () {
if (!previewPanel) {
Line 6,911 ⟶ 6,912:
*/
setupOutlineItem() {
if (this.outlineItem !== undefined) {
this.outlineItem
.setMovable(true)
Line 7,422 ⟶ 7,421:
// eslint-disable-next-line camelcase
from_oldid: new OO.ui.TextInputWidget({
value: this.splitArticleTemplateRow.from_oldid || '',
placeholder: mw.msg('deputy.ante.splitArticle.from_oldid.placeholder')
Line 7,435 ⟶ 7,433:
}),
diff: new OO.ui.TextInputWidget({
value: this.splitArticleTemplateRow.from_oldid || '',
placeholder: mw.msg('deputy.ante.splitArticle.diff.placeholder'),
Line 7,518 ⟶ 7,515:
*/
setupOutlineItem() {
if (this.outlineItem !== undefined) {
this.outlineItem
.setMovable(true)
Line 7,745 ⟶ 7,740:
*/
setupOutlineItem() {
if (this.outlineItem !== undefined) {
this.outlineItem
.setMovable(true)
Line 7,961 ⟶ 7,954:
}),
talk: new OO.ui.CheckboxInputWidget({
selected: yesNo(this.mergedFromTemplate.target)
})
Line 8,034 ⟶ 8,026:
*/
setupOutlineItem() {
if (this.outlineItem !== undefined) {
this.outlineItem
.setMovable(true)
Line 8,212 ⟶ 8,202:
}),
small: new OO.ui.CheckboxInputWidget({
selected: yesNo(this.mergedToTemplate.small, false)
})
Line 8,273 ⟶ 8,262:
*/
setupOutlineItem() {
if (this.outlineItem !== undefined) {
this.outlineItem
.setMovable(true)
Line 8,546 ⟶ 8,533:
const input = inputs[field];
if (field === 'author') {
input
.on('change', (value) => { if (value.length === 0) {
this.backwardsCopyTemplateRow.author = null;
Line 8,583 ⟶ 8,571:
*/
setupOutlineItem() {
if (this.outlineItem !== undefined) {
this.outlineItem
.setMovable(true)
Line 8,892 ⟶ 8,878:
*/
setupOutlineItem() {
if (this.outlineItem !== undefined) {
/** @member any */
Line 9,301 ⟶ 9,286:
*/
setupOutlineItem() {
if (this.outlineItem !== undefined) {
this.outlineItem
.setMovable(true)
Line 9,527 ⟶ 9,510:
});
menuSelectWidget.on('select', () => {
// Not a multiselect menu; cast the result to OptionWidget.
const selected = menuSelectWidget.findSelectedItem();
if (selected) {
Line 9,560 ⟶ 9,544:
const addListener = this.parent.layout.on('add', () => {
for (const name of Object.keys(this.parent.layout.pages)) {
if (name !== 'cte-no-templates' && this.outlineItem !== null) {
// Pop this page out if a page exists.
Line 9,584 ⟶ 9,567:
*/
setupOutlineItem() {
if (this.outlineItem !== undefined) {
this.outlineItem.toggle(false);
}
Line 10,944 ⟶ 10,925:
this.renderMenuActions();
this.$body.append(this.layout.$element);
return this;
}
/**
Line 11,222 ⟶ 11,204:
'deputy.ante.content.modify' :
'deputy.ante.content.add'))
}).catch(
throw errorToOO(e, c);
});
}), this);
// Page redirect
Line 11,258 ⟶ 11,242:
}
},
_a.static = Object.assign(Object.assign({}, OO.ui.ProcessDialog.static), { name: 'copiedTemplateEditorDialog', title: mw.msg('deputy.ante'), size: 'huge', actions: [
{
flags: ['primary', 'progressive'],
Line 11,277 ⟶ 11,257:
action: 'close'
}
] }),
_a);
}
Line 11,593 ⟶ 11,572:
if (locale === 'en') {
// Always loaded.
return;
}
if (mw.loader.getState('moment') !== 'ready') {
// moment.js is not yet loaded.
console.warn('Deputy tried loading moment.js locales but moment.js is not yet ready.');
return;
}
Line 11,928 ⟶ 11,912:
allowedValues: ['cci', 'ante', 'ia']
}),
portletNames: new Setting(generateEnumConfigurationProperties(PortletNameView, PortletNameView.Full)),
seenAnnouncements: new Setting({
defaultValue: [],
displayOptions: { hidden: true }
})
};
this.cci = {
Line 12,108 ⟶ 12,096:
setupTabItem() {
this.tabItem.setLabel(this.getMsg(this.config.group));
return this;
}
/**
Line 12,189 ⟶ 12,178:
// Attach disabled re-checker
this.on('change', () => {
field.setDisabled(!!setting.disabled);
});
return h_1("div", { class: "deputy-setting" }, unwrapWidget(layout));
Line 12,217 ⟶ 12,206:
helpInline: true
});
// TODO: @types/oojs-ui limitation
field.on('change', (items) => {
const finalData = Array.isArray(setting.allowedValues) ?
items :
field.
setting.set(finalData);
this.emit('change');
Line 12,226 ⟶ 12,216:
// Attach disabled re-checker
this.on('select', () => {
field.setDisabled(!!setting.disabled);
});
return h_1("div", { class: "deputy-setting" }, unwrapWidget(layout));
Line 12,242 ⟶ 12,232:
const desc = mw.message(`deputy.setting.${this.mode}.${this.config.group}.${settingKey}.description`);
const field = new OO.ui.RadioSelectWidget({
items: this.getAllowedValuesArray(settingKey, setting.allowedValues)
.map(([key, label]) => new OO.ui.RadioOptionWidget({
Line 12,270 ⟶ 12,260:
// Attach disabled re-checker
this.on('change', () => {
field.setDisabled(!!setting.disabled);
});
return h_1("div", { class: "deputy-setting" }, unwrapWidget(layout));
Line 12,534 ⟶ 12,524:
setupTabItem() {
this.tabItem.setLabel(mw.msg('deputy.about'));
return this;
}
},
Line 12,583 ⟶ 12,574:
}
this.$body.append(this.layout.$element);
return this;
}
/**
Line 12,644 ⟶ 12,636:
}
},
_a.static = Object.assign(Object.assign({}, OO.ui.ProcessDialog.static), { name: 'configurationDialog', title: mw.msg('deputy.settings.dialog.title'), size: 'large', actions: [
{
flags: ['safe', 'close'],
Line 12,662 ⟶ 12,650:
flags: ['progressive', 'primary']
}
] }),
_a);
}
Line 12,760 ⟶ 12,747:
'deputy', 'dp-mb'
],
type: '
title: mw.msg('deputy.settings.wikiEditIntro.title'),
message: current ?
Line 12,831 ⟶ 12,818:
'deputy', 'dp-mb', 'dp-wikiConfigUpdateMessage'
],
type: '
title: mw.msg('deputy.settings.wikiOutdated'),
message: mw.msg('deputy.settings.wikiOutdated.help'),
Line 13,372 ⟶ 13,359:
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;}.oo-ui-windowManager-modal > .oo-ui-window.oo-ui-dialog.oo-ui-messageDialog {z-index: 200;}";
/**
Line 13,435 ⟶ 13,396:
return false;
}
if (
// Button not yet appended
Line 13,651 ⟶ 13,608:
"deputy.session.page.iabot.reason": "Possible copyright violation investigation",
"deputy.session.page.tools": "Tools"
};
var deputySharedEnglish = {
"deputy.name": "Deputy",
"deputy.description": "Copyright cleanup and case processing tool for Wikipedia.",
"deputy.ia": "Infringement Assistant",
"deputy.ia.short": "I. Assistant",
"deputy.ia.acronym": "Deputy: IA",
"deputy.ante": "Attribution Notice Template Editor",
"deputy.ante.short": "Attrib. Template Editor",
"deputy.ante.acronym": "Deputy: ANTE",
"deputy.cancel": "Cancel",
"deputy.review": "Review",
"deputy.save": "Save",
"deputy.close": "Close",
"deputy.positiveDiff": "+{{FORMATNUM:$1}}",
"deputy.negativeDiff": "-{{FORMATNUM:$1}}",
"deputy.moreInfo": "More information",
"deputy.dismiss": "Dismiss",
"deputy.comma-separator": ", ",
"deputy.diff": "Review your changes",
"deputy.diff.load": "Loading changes...",
"deputy.diff.no-changes": "No difference",
"deputy.diff.error": "An error occurred while trying to get the comparison.",
"deputy.loadError.userConfig": "Due to an error, your Deputy configuration has been reset.",
"deputy.loadError.wikiConfig": "An error occurred while loading this wiki's Deputy configuration. Please report this to the Deputy maintainers for this wiki."
};
Line 14,380 ⟶ 14,363:
constructor(originLink, listing) {
super();
// TODO: types-mediawiki limitation
this.reloadPreviewThrottled = mw.util.throttle(this.reloadPreview, 500);
this.originLink = originLink;
Line 14,448 ⟶ 14,432:
*/
renderAdditionalCommentsField() {
this.commentsField = new OO.ui.
placeholder: mw.msg('deputy.ia.listing.re.extras'),
autosize: true,
Line 14,724 ⟶ 14,707:
]
}).$element);
return this;
}
/**
Line 14,752 ⟶ 14,736:
* Render OOUI FieldLayouts to be appended to the fieldset layout.
*
* @return An array of OOUI `
*/
renderFields() {
Line 14,763 ⟶ 14,747:
$overlay: this.$overlay,
disabled: entirePageByDefault,
}),
endSection: new OO.ui.DropdownInputWidget({
$overlay: this.$overlay,
disabled: entirePageByDefault,
}),
presumptive: new OO.ui.CheckboxInputWidget({
Line 14,787 ⟶ 14,771:
allowArbitrary: true,
inputPosition: 'outline',
placeholder: mw.msg('deputy.ia.report.sourceUrls.placeholder')
}),
Line 15,141 ⟶ 15,125:
}, this);
return process;
}
},
// For dialogs. Remove if not a dialog.
_a.static = Object.assign(Object.assign({}, OO.ui.ProcessDialog.static), { name: 'iaSinglePageWorkflowDialog', title: mw.msg('deputy.ia'), actions: [
{
flags: ['safe', 'close'],
Line 15,164 ⟶ 15,137:
action: 'close'
}
] }),
_a);
}
Line 15,336 ⟶ 15,308:
const currentListingPage = CopyrightProblemsPage.getCurrent();
const previewPanel = h_1("div", { class: "ia-listing--preview", "data-label": mw.msg('deputy.ia.listing.new.preview') });
// TODO: types-mediawiki limitation
const reloadPreview = mw.util.throttle(() => __awaiter(this, void 0, void 0, function* () {
const data = getData(currentListingPage);
Line 15,714 ⟶ 15,687:
// Query parameter-based autostart disable (i.e. don't start if param exists)
if (!/[?&]ia-autostart(=(0|no|false|off)?(&|$)|$)/.test(window.___location.search)) {
return mw.loader.using(InfringementAssistant.dependencies, () => __awaiter(this, void 0, void 0, function* () {
yield this.init();
}));
}
return true;
Line 15,729 ⟶ 15,704:
this.wikiConfig.ia.listingWikitextMatch.get() != null &&
this.wikiConfig.ia.responses.get() != null) {
yield DeputyLanguage.loadMomentLocale();
this.session = new CopyrightProblemsSession();
mw.hook('wikipage.content').add((el) => {
Line 15,762 ⟶ 15,738:
return mw.loader.using(InfringementAssistant.dependencies, () => __awaiter(this, void 0, void 0, function* () {
if (!this.dialog) {
yield DeputyLanguage.loadMomentLocale();
this.dialog = SinglePageWorkflowDialog({
page: new mw.Title(mw.config.get('wgPageName')),
Line 15,992 ⟶ 15,969:
sectionHeadingName: sectionHeadingName,
toRedirectsObject: toRedirectsObject
};
var deputyAnnouncementsEnglish = {
"deputy.announcement.ues-06-2023.title": "Deputy user experience survey",
"deputy.announcement.ues-06-2023.message": "Help improve Deputy by taking a short survey about your usage of the tool and your experience as a copyright cleanup editor.",
"deputy.announcement.ues-06-2023.survey.label": "Take the survey",
"deputy.announcement.ues-06-2023.survey.title": "Take the survey (opens the survey on LimeSurvey)",
"deputy.announcement.ues-06-2023.learn.label": "Learn more",
"deputy.announcement.ues-06-2023.learn.title": "Learn more about the survey (opens the Wikimedia Meta-Wiki page for this survey)"
};
/**
*
* Deputy announcements
*
* This will be loaded on all standalone modules and on main Deputy.
* Be conservative with what you load!
*
*/
class DeputyAnnouncements {
/**
* Initialize announcements.
* @param config
*/
static init(config) {
return __awaiter(this, void 0, void 0, function* () {
yield Promise.all([
DeputyLanguage.load('shared', deputySharedEnglish),
DeputyLanguage.load('announcements', deputyAnnouncementsEnglish)
]);
mw.util.addCSS('#siteNotice .deputy { text-align: left; }');
for (const [id, announcements] of Object.entries(this.knownAnnouncements)) {
if (config.core.seenAnnouncements.get().includes(id)) {
continue;
}
this.showAnnouncement(config, id, announcements);
}
});
}
/**
*
* @param config
* @param announcementId
* @param announcement
*/
static showAnnouncement(config, announcementId, announcement) {
mw.loader.using([
'oojs-ui-core',
'oojs-ui.styles.icons-interactions'
], () => {
const messageWidget = DeputyMessageWidget({
classes: ['deputy'],
icon: 'feedback',
// Messages that can be used here:
// * deputy.announcement.<id>.title
title: mw.msg(`deputy.announcement.${announcementId}.title`),
// Messages that can be used here:
// * deputy.announcement.<id>.message
message: mw.msg(`deputy.announcement.${announcementId}.message`),
closable: true,
actions: announcement.actions.map(action => {
var _a;
const button = new OO.ui.ButtonWidget({
// Messages that can be used here:
// * deputy.announcement.<id>.<action id>.message
label: mw.msg(`deputy.announcement.${announcementId}.${action.id}.label`),
// Messages that can be used here:
// * deputy.announcement.<id>.<action id>.title
title: mw.msg(`deputy.announcement.${announcementId}.${action.id}.title`),
flags: (_a = action.flags) !== null && _a !== void 0 ? _a : []
});
button.on('click', action.action);
return button;
})
});
messageWidget.on('close', () => {
config.core.seenAnnouncements.set([...config.core.seenAnnouncements.get(), announcementId]);
config.save();
});
document.getElementById('siteNotice').appendChild(unwrapWidget(messageWidget));
});
}
}
DeputyAnnouncements.knownAnnouncements = {
'ues-06-2023': {
actions: [
{
id: 'survey',
flags: ['primary', 'progressive'],
action: () => {
open('https://hourglass.limesurvey.net/188262', '_blank');
}
},
{
id: 'learn',
flags: ['primary'],
action: () => {
open('https://meta.wikimedia.org/wiki/Deputy/Research/Surveys/06-2023', '_blank');
}
}
]
}
};
Line 16,111 ⟶ 16,190:
console.log('Loaded!');
mw.hook('deputy.load').fire(this);
//
// Show announcements (if any)
yield DeputyAnnouncements.init(this.config),
// Asynchronously reload wiki configuration.
this.wikiConfig.update().catch(() => { })
]);
});
}
|