Skip to content

Commit

Permalink
Merge branch 'master' into variable-pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae authored Nov 27, 2024
2 parents 0a97299 + 001f236 commit 0ebab3c
Show file tree
Hide file tree
Showing 24 changed files with 306 additions and 285 deletions.
8 changes: 3 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"array-bracket-spacing": "off",
"camelcase": "off",
"computed-property-spacing": "off",
"indent": "off",
"jsdoc/require-param": "off",
"jsdoc/require-returns": "off",
"max-len": "off",
"no-alert": "off",
"no-jquery/no-class-state": "off",
Expand Down Expand Up @@ -41,13 +44,10 @@

"es-x/no-array-prototype-includes": "warn",
"es-x/no-object-values": "warn",
"indent": "off",
"jsdoc/require-asterisk-prefix": "warn",
"mediawiki/class-doc": "warn",
"new-cap": "warn",
"no-jquery/no-constructor-attributes": "warn",
"no-jquery/no-each-util": "warn",
"no-jquery/no-extend": "warn",
"no-jquery/no-grep": "warn",
"no-jquery/no-in-array": "warn",
"no-jquery/no-map-util": "warn",
Expand All @@ -59,12 +59,10 @@
"no-script-url": "warn",
"no-sequences": "warn",
"no-throw-literal": "warn",
"no-unneeded-ternary": "warn",
"no-unused-expressions": "warn",
"no-use-before-define": "warn",
"no-useless-concat": "warn",
"no-var": "warn",
"operator-linebreak": "warn",
"prefer-const": "warn"
}
}
4 changes: 2 additions & 2 deletions gadget.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Twinkle [ResourceLoader |dependencies=ext.gadget.morebits, ext.gadget.select2, mediawiki.api, mediawiki.language |rights=autoconfirmed |type=general |peers=Twinkle-pagestyles |requiresES6] |Twinkle.js |Twinkle.css |twinklearv.js |twinklewarn.js |twinkleblock.js |twinklewelcome.js |twinkleshared.js |twinkletalkback.js |twinklespeedy.js |twinkleprod.js |twinklexfd.js |twinkleimage.js |twinkleprotect.js |twinkletag.js |twinklediff.js |twinkleunlink.js |twinklerollback.js |twinkledeprod.js |twinklebatchdelete.js |twinklebatchprotect.js |twinklebatchundelete.js |twinkleconfig.js
* morebits [ResourceLoader |dependencies=mediawiki.user, mediawiki.util, mediawiki.Title, jquery.ui |hidden |requiresES6] |morebits.js |morebits.css
* Twinkle [ResourceLoader |dependencies=ext.gadget.morebits, ext.gadget.select2, mediawiki.api, mediawiki.language |rights=autoconfirmed |type=general |peers=Twinkle-pagestyles] |Twinkle.js |Twinkle.css |twinklearv.js |twinklewarn.js |twinkleblock.js |twinklewelcome.js |twinkleshared.js |twinkletalkback.js |twinklespeedy.js |twinkleprod.js |twinklexfd.js |twinkleimage.js |twinkleprotect.js |twinkletag.js |twinklediff.js |twinkleunlink.js |twinklerollback.js |twinkledeprod.js |twinklebatchdelete.js |twinklebatchprotect.js |twinklebatchundelete.js |twinkleconfig.js
* morebits [ResourceLoader |dependencies=mediawiki.user, mediawiki.util, mediawiki.Title, jquery.ui |hidden] |morebits.js |morebits.css
* Twinkle-pagestyles [hidden |skins=vector, vector-2022] |Twinkle-pagestyles.css
* select2 [ResourceLoader |hidden] |select2.min.js |select2.min.css
38 changes: 19 additions & 19 deletions modules/twinklearv.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <nowiki>

(function($) {
(function() {

/*
****************************************
Expand Down Expand Up @@ -373,10 +373,10 @@ Twinkle.arv.callback.changeCategory = function (e) {
} else {
for (let i = 0; i < page.revisions.length; ++i) {
const rev = page.revisions[i];
const $entry = $('<div/>', {
const $entry = $('<div>', {
class: 'entry'
});
const $input = $('<input/>', {
const $input = $('<input>', {
type: 'checkbox',
name: 's_' + field,
value: rev.revid
Expand All @@ -397,15 +397,15 @@ Twinkle.arv.callback.changeCategory = function (e) {

// add free form input for resolves
if (field === 'resolves') {
const $free_entry = $('<div/>', {
const $free_entry = $('<div>', {
class: 'entry'
});
const $free_input = $('<input/>', {
const $free_input = $('<input>', {
type: 'text',
name: 's_resolves_free'
});

const $free_label = $('<label/>', {
const $free_label = $('<label>', {
for: 's_resolves_free',
html: 'URL link of diff with additional discussions: '
});
Expand Down Expand Up @@ -468,11 +468,11 @@ Twinkle.arv.callback.changeCategory = function (e) {
};

Twinkle.arv.callback.evaluate = function(e) {
var form = e.target;
var reason = '';
var input = Morebits.quickForm.getInputData(form);
const form = e.target;
let reason = '';
const input = Morebits.quickForm.getInputData(form);

var uid = form.uid.value;
const uid = form.uid.value;

switch (input.category) {

Expand Down Expand Up @@ -725,8 +725,8 @@ Twinkle.arv.callback.evaluate = function(e) {
};

Twinkle.arv.callback.getAivReasonWikitext = function(input) {
var text = '';
var type = input.arvtype;
let text = '';
let type = input.arvtype;

if (!type.length && input.reason === '') {
return null;
Expand Down Expand Up @@ -763,15 +763,15 @@ Twinkle.arv.callback.getAivReasonWikitext = function(input) {
}

if (input.reason !== '') {
var textEndsInPunctuationOrBlank = /([.?!;:]|^)$/.test(text);
const textEndsInPunctuationOrBlank = /([.?!;:]|^)$/.test(text);
text += textEndsInPunctuationOrBlank ? '' : '.';
var textIsBlank = text === '';
const textIsBlank = text === '';
text += textIsBlank ? '' : ' ';
text += input.reason;
}

text = text.trim();
var textEndsInPunctuation = /[.?!;]$/.test(text);
const textEndsInPunctuation = /[.?!;]$/.test(text);
if (!textEndsInPunctuation) {
text += '.';
}
Expand All @@ -795,18 +795,18 @@ Twinkle.arv.callback.getUsernameReportWikitext = function(input) {
}

// a or an?
var adjective = 'a';
let adjective = 'a';
if (/[aeiouwyh]/.test(input.arvtype[0] || '')) { // non 100% correct, but whatever, including 'h' for Cockney
adjective = 'an';
}

var text = '*{{user-uaa|1=' + input.uid + '}} &ndash; ';
let text = '*{{user-uaa|1=' + input.uid + '}} &ndash; ';
if (input.arvtype.length) {
text += 'Violation of the username policy as ' + adjective + ' ' + input.arvtype + ' username. ';
}
if (input.reason !== '') {
text += Morebits.string.toUpperCaseFirstChar(input.reason);
var endsInPeriod = /\.$/.test(input.reason);
const endsInPeriod = /\.$/.test(input.reason);
if (!endsInPeriod) {
text += '.';
}
Expand Down Expand Up @@ -980,6 +980,6 @@ Twinkle.arv.processAN3 = function(params) {
};

Twinkle.addInitCallback(Twinkle.arv, 'arv');
}(jQuery));
}());

// </nowiki>
8 changes: 4 additions & 4 deletions modules/twinklebatchdelete.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <nowiki>

(function($) {
(function() {

/*
****************************************
Expand Down Expand Up @@ -597,7 +597,7 @@ Twinkle.batchdelete.callbacks = {
unlinker.setPageList(pages);
unlinker.run((pageName) => {
const wikipedia_page = new Morebits.wiki.page(pageName, 'Unlinking on ' + pageName);
const params = $.extend({}, apiobj.params);
const params = Object.assign({}, apiobj.params);
params.title = pageName;
params.unlinker = unlinker;
wikipedia_page.setCallbackParameters(params);
Expand Down Expand Up @@ -648,7 +648,7 @@ Twinkle.batchdelete.callbacks = {
unlinker.setPageList(pages);
unlinker.run((pageName) => {
const wikipedia_page = new Morebits.wiki.page(pageName, 'Removing file usages on ' + pageName);
const params = $.extend({}, apiobj.params);
const params = Object.assign({}, apiobj.params);
params.title = pageName;
params.unlinker = unlinker;
wikipedia_page.setCallbackParameters(params);
Expand Down Expand Up @@ -690,6 +690,6 @@ Twinkle.batchdelete.callbacks = {
};

Twinkle.addInitCallback(Twinkle.batchdelete, 'batchdelete');
}(jQuery));
}());

// </nowiki>
6 changes: 3 additions & 3 deletions modules/twinklebatchprotect.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <nowiki>

(function($) {
(function() {

/*
****************************************
Expand Down Expand Up @@ -288,7 +288,7 @@ Twinkle.batchprotect.callback.evaluate = function twinklebatchprotectCallbackEva
};
const wikipedia_api = new Morebits.wiki.api('Checking if page ' + pageName + ' exists', query,
Twinkle.batchprotect.callbacks.main, null, batchOperation.workerFailure);
wikipedia_api.params = $.extend({
wikipedia_api.params = Object.assign({
page: pageName,
batchOperation: batchOperation
}, input);
Expand Down Expand Up @@ -333,6 +333,6 @@ Twinkle.batchprotect.callbacks = {
};

Twinkle.addInitCallback(Twinkle.batchprotect, 'batchprotect');
}(jQuery));
}());

// </nowiki>
4 changes: 2 additions & 2 deletions modules/twinklebatchundelete.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <nowiki>

(function($) {
(function() {

/*
****************************************
Expand Down Expand Up @@ -204,6 +204,6 @@ Twinkle.batchundelete.callbacks = {
};

Twinkle.addInitCallback(Twinkle.batchundelete, 'batchundelete');
}(jQuery));
}());

// </nowiki>
8 changes: 4 additions & 4 deletions modules/twinkleblock.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// <nowiki>

(function($) {
(function() {

let api = new mw.Api(), relevantUserName, blockedUserName;
const menuFormattedNamespaces = $.extend({}, mw.config.get('wgFormattedNamespaces'));
const menuFormattedNamespaces = Object.assign({}, mw.config.get('wgFormattedNamespaces'));
menuFormattedNamespaces[0] = '(Article)';

/*
Expand Down Expand Up @@ -1897,7 +1897,7 @@ Twinkle.block.callback.issue_template = function twinkleblockCallbackIssueTempla
// "talk page" of an IP range (which does not exist)
const userTalkPage = 'User_talk:' + mw.config.get('wgRelevantUserName');

const params = $.extend(formData, {
const params = Object.assign(formData, {
messageData: Twinkle.block.blockPresetsInfo[formData.template],
reason: Twinkle.block.field_template_options.block_reason,
disabletalk: Twinkle.block.field_template_options.notalk,
Expand Down Expand Up @@ -2039,6 +2039,6 @@ Twinkle.block.callback.main = function twinkleblockcallbackMain(pageobj) {
};

Twinkle.addInitCallback(Twinkle.block, 'block');
}(jQuery));
}());

// </nowiki>
4 changes: 2 additions & 2 deletions modules/twinkleconfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <nowiki>

(function($) {
(function() {

/*
****************************************
Expand Down Expand Up @@ -1727,6 +1727,6 @@ Twinkle.config.saveSuccess = function twinkleconfigSaveSuccess(pageobj) {
};

Twinkle.addInitCallback(Twinkle.config.init);
}(jQuery));
}());

// </nowiki>
4 changes: 2 additions & 2 deletions modules/twinkledeprod.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <nowiki>

(function($) {
(function() {

/*
****************************************
Expand Down Expand Up @@ -184,6 +184,6 @@ var callback_commit = function(event) {
};

Twinkle.addInitCallback(Twinkle.deprod, 'deprod');
}(jQuery));
}());

// </nowiki>
4 changes: 2 additions & 2 deletions modules/twinklediff.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <nowiki>

(function($) {
(function() {

/*
****************************************
Expand Down Expand Up @@ -75,6 +75,6 @@ Twinkle.diff.callbacks = {
};

Twinkle.addInitCallback(Twinkle.diff, 'diff');
}(jQuery));
}());

// </nowiki>
6 changes: 3 additions & 3 deletions modules/twinkleimage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <nowiki>

(function($) {
(function() {

/*
****************************************
Expand Down Expand Up @@ -212,7 +212,7 @@ Twinkle.image.callback.evaluate = function twinkleimageCallbackEvaluate(event) {
const lognomination = Twinkle.getPref('logSpeedyNominations') && Twinkle.getPref('noLogOnSpeedyNomination').indexOf(csdcrit.toLowerCase()) === -1;
const templatename = input.derivative ? 'dw ' + input.type : input.type;

const params = $.extend({
const params = Object.assign({
templatename: templatename,
normalized: csdcrit,
lognomination: lognomination
Expand Down Expand Up @@ -355,6 +355,6 @@ Twinkle.image.callbacks = {
};

Twinkle.addInitCallback(Twinkle.image, 'image');
}(jQuery));
}());

// </nowiki>
4 changes: 2 additions & 2 deletions modules/twinkleprod.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <nowiki>

(function($) {
(function() {

/*
****************************************
Expand Down Expand Up @@ -472,6 +472,6 @@ Twinkle.prod.callback.evaluate = function twinkleprodCallbackEvaluate(e) {
};

Twinkle.addInitCallback(Twinkle.prod, 'prod');
}(jQuery));
}());

// </nowiki>
4 changes: 2 additions & 2 deletions modules/twinkleprotect.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <nowiki>

(function($) {
(function() {

/*
****************************************
Expand Down Expand Up @@ -1653,6 +1653,6 @@ Twinkle.protect.callbacks = {
};

Twinkle.addInitCallback(Twinkle.protect, 'protect');
}(jQuery));
}());

// </nowiki>
Loading

0 comments on commit 0ebab3c

Please sign in to comment.