diff --git a/.eslintrc.json b/.eslintrc.json index abdabc72a..f15d5e170 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,6 +15,7 @@ "camelcase": "off", "computed-property-spacing": "off", "max-len": "off", + "no-alert": "off", "no-jquery/no-class-state": "off", "no-jquery/no-global-selector": "off", "no-shadow": "off", @@ -38,15 +39,12 @@ } ], - "dot-location": "warn", "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", - "new-parens": "warn", - "no-alert": "warn", "no-jquery/no-constructor-attributes": "warn", "no-jquery/no-each-util": "warn", "no-jquery/no-extend": "warn", @@ -57,8 +55,6 @@ "no-jquery/no-sizzle": "warn", "no-jquery/variable-pattern": "warn", "no-loop-func": "warn", - "no-multi-spaces": "warn", - "no-multiple-empty-lines": "warn", "no-new": "warn", "no-return-assign": "warn", "no-script-url": "warn", @@ -70,7 +66,6 @@ "no-useless-concat": "warn", "no-var": "warn", "operator-linebreak": "warn", - "prefer-const": "warn", - "quote-props": "warn" + "prefer-const": "warn" } } diff --git a/modules/twinklearv.js b/modules/twinklearv.js index 3fb6e8a62..6bcf37c04 100644 --- a/modules/twinklearv.js +++ b/modules/twinklearv.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinklearv.js: ARV module @@ -125,7 +123,6 @@ Twinkle.arv.callback = function (uid, isIP) { } })).post(); - // We must init the const evt = document.createEvent('Event'); evt.initEvent('change', true, true); @@ -780,7 +777,7 @@ Twinkle.arv.callback.getAivReasonWikitext = function(input) { } text += ' ~~~~'; - text = text.replace(/\r?\n/g, '\n*:'); // indent newlines + text = text.replace(/\r?\n/g, '\n*:'); // indent newlines return text; }; @@ -816,7 +813,7 @@ Twinkle.arv.callback.getUsernameReportWikitext = function(input) { text += ' '; } text += '~~~~'; - text = text.replace(/\r?\n/g, '\n*:'); // indent newlines + text = text.replace(/\r?\n/g, '\n*:'); // indent newlines return text; }; @@ -846,7 +843,7 @@ Twinkle.arv.processSock = function(params) { spiPage.setWatchlist(Twinkle.getPref('spiWatchReport')); spiPage.append(); - Morebits.wiki.removeCheckpoint(); // all page updates have been started + Morebits.wiki.removeCheckpoint(); // all page updates have been started }; Twinkle.arv.processAN3 = function(params) { @@ -976,7 +973,7 @@ Twinkle.arv.processAN3 = function(params) { talkPage.setChangeTags(Twinkle.changeTags); talkPage.setAppendText(notifyText); talkPage.append(); - Morebits.wiki.removeCheckpoint(); // all page updates have been started + Morebits.wiki.removeCheckpoint(); // all page updates have been started }).fail((data) => { console.log('API failed :(', data); // eslint-disable-line no-console }); @@ -985,5 +982,4 @@ Twinkle.arv.processAN3 = function(params) { Twinkle.addInitCallback(Twinkle.arv, 'arv'); }()); - // diff --git a/modules/twinklebatchdelete.js b/modules/twinklebatchdelete.js index 7cb68e7fb..2cd39a367 100644 --- a/modules/twinklebatchdelete.js +++ b/modules/twinklebatchdelete.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinklebatchdelete.js: Batch delete module (sysops only) @@ -141,7 +139,7 @@ Twinkle.batchdelete.callback = function twinklebatchdeleteCallback() { const titleSplit = pathSplit[3].split(':'); query.gapnamespace = mw.config.get('wgNamespaceIds')[titleSplit[0].toLowerCase()]; if (titleSplit.length < 2 || typeof query.gapnamespace === 'undefined') { - query.gapnamespace = 0; // article namespace + query.gapnamespace = 0; // article namespace query.gapprefix = pathSplit.splice(3).join('/'); } else { pathSplit = pathSplit.splice(4); @@ -158,7 +156,7 @@ Twinkle.batchdelete.callback = function twinklebatchdeleteCallback() { } const statusdiv = document.createElement('div'); - statusdiv.style.padding = '15px'; // just so it doesn't look broken + statusdiv.style.padding = '15px'; // just so it doesn't look broken Window.setContent(statusdiv); Morebits.status.init(statusdiv); Window.display(); @@ -541,7 +539,7 @@ Twinkle.batchdelete.callbacks = { if (params.delete_talk) { const pageTitle = mw.Title.newFromText(params.page); if (pageTitle && pageTitle.namespace % 2 === 0 && pageTitle.namespace !== 2) { - pageTitle.namespace++; // now pageTitle is the talk page title! + pageTitle.namespace++; // now pageTitle is the talk page title! query = { action: 'query', titles: pageTitle.toText(), @@ -694,5 +692,4 @@ Twinkle.batchdelete.callbacks = { Twinkle.addInitCallback(Twinkle.batchdelete, 'batchdelete'); }()); - // diff --git a/modules/twinklebatchprotect.js b/modules/twinklebatchprotect.js index e33415d7b..9d24e88a5 100644 --- a/modules/twinklebatchprotect.js +++ b/modules/twinklebatchprotect.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinklebatchprotect.js: Batch protect module (sysops only) @@ -13,7 +11,6 @@ * non-existing categories; Special:PrefixIndex */ - Twinkle.batchprotect = function twinklebatchprotect() { if (Morebits.userIsSysop && ((mw.config.get('wgArticleId') > 0 && (mw.config.get('wgNamespaceNumber') === 2 || mw.config.get('wgNamespaceNumber') === 4)) || mw.config.get('wgNamespaceNumber') === 14 || @@ -135,7 +132,7 @@ Twinkle.batchprotect.callback = function twinklebatchprotectCallback() { form.append({ type: 'header', - label: '' // horizontal rule + label: '' // horizontal rule }); form.append({ type: 'input', @@ -153,7 +150,7 @@ Twinkle.batchprotect.callback = function twinklebatchprotectCallback() { format: 'json' }; - if (mw.config.get('wgNamespaceNumber') === 14) { // categories + if (mw.config.get('wgNamespaceNumber') === 14) { // categories query.generator = 'categorymembers'; query.gcmtitle = mw.config.get('wgPageName'); query.gcmlimit = Twinkle.getPref('batchMax'); @@ -169,7 +166,7 @@ Twinkle.batchprotect.callback = function twinklebatchprotectCallback() { } const statusdiv = document.createElement('div'); - statusdiv.style.padding = '15px'; // just so it doesn't look broken + statusdiv.style.padding = '15px'; // just so it doesn't look broken Window.setContent(statusdiv); Morebits.status.init(statusdiv); Window.display(); @@ -338,5 +335,4 @@ Twinkle.batchprotect.callbacks = { Twinkle.addInitCallback(Twinkle.batchprotect, 'batchprotect'); }()); - // diff --git a/modules/twinklebatchundelete.js b/modules/twinklebatchundelete.js index d411dd03e..a804ea382 100644 --- a/modules/twinklebatchundelete.js +++ b/modules/twinklebatchundelete.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinklebatchundelete.js: Batch undelete module @@ -12,7 +10,6 @@ * Active on: Existing user and project pages */ - Twinkle.batchundelete = function twinklebatchundelete() { if (!Morebits.userIsSysop || !mw.config.get('wgArticleId') || ( mw.config.get('wgNamespaceNumber') !== mw.config.get('wgNamespaceIds').user && @@ -49,7 +46,7 @@ Twinkle.batchundelete.callback = function twinklebatchundeleteCallback() { }); const statusdiv = document.createElement('div'); - statusdiv.style.padding = '15px'; // just so it doesn't look broken + statusdiv.style.padding = '15px'; // just so it doesn't look broken Window.setContent(statusdiv); Morebits.status.init(statusdiv); Window.display(); @@ -209,5 +206,4 @@ Twinkle.batchundelete.callbacks = { Twinkle.addInitCallback(Twinkle.batchundelete, 'batchundelete'); }()); - // diff --git a/modules/twinkleblock.js b/modules/twinkleblock.js index fd6a687b3..b536b5102 100644 --- a/modules/twinkleblock.js +++ b/modules/twinkleblock.js @@ -1,6 +1,5 @@ // - (function() { let api = new mw.Api(), relevantUserName, blockedUserName; @@ -639,7 +638,6 @@ Twinkle.block.callback.change_action = function twinkleblockCallbackChangeAction oldfield.parentNode.replaceChild(field_block_options.render(), oldfield); $form.find('fieldset[name="field_64"]').show(); - $form.find('[name=pagerestrictions]').select2({ theme: 'default select2-morebits', width: '100%', @@ -754,7 +752,6 @@ Twinkle.block.callback.change_action = function twinkleblockCallbackChangeAction statusStr += ' (expires ' + new Morebits.date(Twinkle.block.currentBlockInfo.expiry).calendar('utc') + ')'; } - let infoStr = 'This form will'; if (sameUser) { infoStr += ' change that block'; @@ -831,7 +828,7 @@ Twinkle.block.callback.change_action = function twinkleblockCallbackChangeAction * To disable, set 'hardblock' and 'disabletalk', respectively */ Twinkle.block.blockPresetsInfo = { - 'anonblock': { + anonblock: { expiry: '31 hours', forUnregisteredOnly: true, nocreate: true, @@ -881,14 +878,14 @@ Twinkle.block.blockPresetsInfo = { reason: '{{checkuserblock-wide}}', sig: '~~~~' }, - 'colocationwebhost': { + colocationwebhost: { expiry: '1 year', forUnregisteredOnly: true, nonstandard: true, reason: '{{colocationwebhost}}', sig: null }, - 'oversightblock': { + oversightblock: { autoblock: true, expiry: 'infinity', nocreate: true, @@ -903,28 +900,28 @@ Twinkle.block.blockPresetsInfo = { reason: '{{school block}}', sig: '~~~~' }, - 'spamblacklistblock': { + spamblacklistblock: { forUnregisteredOnly: true, expiry: '1 month', disabletalk: true, nocreate: true, reason: '{{spamblacklistblock}} ' }, - 'rangeblock': { + rangeblock: { reason: '{{rangeblock}}', nocreate: true, nonstandard: true, forUnregisteredOnly: true, sig: '~~~~' }, - 'tor': { + tor: { expiry: '1 year', forUnregisteredOnly: true, nonstandard: true, reason: '{{Tor}}', sig: null }, - 'webhostblock': { + webhostblock: { expiry: '1 year', forUnregisteredOnly: true, nonstandard: true, @@ -1442,7 +1439,6 @@ Twinkle.block.blockGroupsPartial = [ } ]; - Twinkle.block.callback.filtered_block_groups = function twinkleblockCallbackFilteredBlockGroups(group, show_template) { return $.map(group, (blockGroup) => { const list = $.map(blockGroup.list, (blockPreset) => { @@ -2045,5 +2041,4 @@ Twinkle.block.callback.main = function twinkleblockcallbackMain(pageobj) { Twinkle.addInitCallback(Twinkle.block, 'block'); }()); - // diff --git a/modules/twinkleconfig.js b/modules/twinkleconfig.js index 37cc3f1ef..323f5cb67 100644 --- a/modules/twinkleconfig.js +++ b/modules/twinkleconfig.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinkleconfig.js: Preferences module @@ -18,13 +16,12 @@ point you in the right direction.) -- TTO */ - Twinkle.config = {}; Twinkle.config.watchlistEnums = { - 'yes': 'Add to watchlist (indefinitely)', - 'no': "Don't add to watchlist", - 'default': 'Follow your site preferences', + yes: 'Add to watchlist (indefinitely)', + no: "Don't add to watchlist", + default: 'Follow your site preferences', '1 week': 'Watch for 1 week', '1 month': 'Watch for 1 month', '3 months': 'Watch for 3 months', @@ -967,7 +964,7 @@ Twinkle.config.init = function twinkleconfigInit() { mw.config.get('wgAction') === 'view') { if (!document.getElementById('twinkle-config')) { - return; // maybe the page is misconfigured, or something - but any attempt to modify it will be pointless + return; // maybe the page is misconfigured, or something - but any attempt to modify it will be pointless } // set style to nothing to prevent conflict with external css @@ -975,7 +972,7 @@ Twinkle.config.init = function twinkleconfigInit() { document.getElementById('twinkle-config-titlebar').removeAttribute('style'); const contentdiv = document.getElementById('twinkle-config-content'); - contentdiv.textContent = ''; // clear children + contentdiv.textContent = ''; // clear children // let user know about possible conflict with skin js/common.js file // (settings in that file will still work, but they will be overwritten by twinkleoptions.js settings) @@ -1028,7 +1025,7 @@ Twinkle.config.init = function twinkleconfigInit() { contentdiv.appendChild(toctable); const contentform = document.createElement('form'); - contentform.setAttribute('action', 'javascript:void(0)'); // was #tw-save - changed to void(0) to work around Chrome issue + contentform.setAttribute('action', 'javascript:void(0)'); // was #tw-save - changed to void(0) to work around Chrome issue contentform.addEventListener('submit', Twinkle.config.save, true); contentdiv.appendChild(contentform); @@ -1038,7 +1035,7 @@ Twinkle.config.init = function twinkleconfigInit() { $(Twinkle.config.sections).each((sectionkey, section) => { if (section.hidden || (section.adminOnly && !Morebits.userIsSysop)) { - return true; // i.e. "continue" in this context + return true; // i.e. "continue" in this context } // add to TOC @@ -1062,12 +1059,12 @@ Twinkle.config.init = function twinkleconfigInit() { row.appendChild(cell); container.appendChild(row); - let rowcount = 1; // for row banding + let rowcount = 1; // for row banding // add each of the preferences to the form $(section.preferences).each((prefkey, pref) => { if (pref.adminOnly && !Morebits.userIsSysop) { - return true; // i.e. "continue" in this context + return true; // i.e. "continue" in this context } row = document.createElement('tr'); @@ -1081,7 +1078,7 @@ Twinkle.config.init = function twinkleconfigInit() { let label, input, gotPref = Twinkle.getPref(pref.name); switch (pref.type) { - case 'boolean': // create a checkbox + case 'boolean': // create a checkbox cell.setAttribute('colspan', '2'); label = document.createElement('label'); @@ -1097,7 +1094,7 @@ Twinkle.config.init = function twinkleconfigInit() { cell.appendChild(label); break; - case 'string': // create an input box + case 'string': // create an input box case 'integer': // add label to first column cell.style.textAlign = 'right'; @@ -1118,7 +1115,7 @@ Twinkle.config.init = function twinkleconfigInit() { if (pref.type === 'integer') { input.setAttribute('size', 6); input.setAttribute('type', 'number'); - input.setAttribute('step', '1'); // integers only + input.setAttribute('step', '1'); // integers only } if (gotPref) { input.setAttribute('value', gotPref); @@ -1126,7 +1123,7 @@ Twinkle.config.init = function twinkleconfigInit() { cell.appendChild(input); break; - case 'enum': // create a combo box + case 'enum': // create a combo box // add label to first column // note: duplicates the code above, under string/integer cell.style.textAlign = 'right'; @@ -1160,10 +1157,10 @@ Twinkle.config.init = function twinkleconfigInit() { cell.appendChild(input); break; - case 'set': // create a set of check boxes + case 'set': // create a set of check boxes // add label first of all cell.setAttribute('colspan', '2'); - label = document.createElement('label'); // not really necessary to use a label element here, but we do it for consistency of styling + label = document.createElement('label'); // not really necessary to use a label element here, but we do it for consistency of styling label.appendChild(document.createTextNode(pref.label + ':')); cell.appendChild(label); @@ -1306,9 +1303,9 @@ Twinkle.config.init = function twinkleconfigInit() { // place "why not try the preference panel" notice box.setAttribute('class', 'config-twopt-box'); - if (mw.config.get('wgArticleId') > 0) { // page exists + if (mw.config.get('wgArticleId') > 0) { // page exists box.appendChild(document.createTextNode('This page contains your Twinkle preferences. You can change them using the ')); - } else { // page does not exist + } else { // page does not exist box.appendChild(document.createTextNode('You can customize Twinkle to suit your preferences by using the ')); } link = document.createElement('a'); @@ -1468,7 +1465,7 @@ Twinkle.config.listDialog.reset = function twinkleconfigListDialogReset($button, Twinkle.config.resetPref(curpref); // reset form - $tbody.find('tr').slice(1).remove(); // all rows except the first (header) row + $tbody.find('tr').slice(1).remove(); // all rows except the first (header) row // add the new values const curvalue = $button.data('value'); $.each(curvalue, (k, v) => { @@ -1504,25 +1501,25 @@ Twinkle.config.resetPrefLink = function twinkleconfigResetPrefLink(e) { // search tactics $(Twinkle.config.sections).each((sectionkey, section) => { if (section.hidden || (section.adminOnly && !Morebits.userIsSysop)) { - return true; // continue: skip impossibilities + return true; // continue: skip impossibilities } let foundit = false; $(section.preferences).each((prefkey, pref) => { if (pref.name !== wantedpref) { - return true; // continue + return true; // continue } Twinkle.config.resetPref(pref); foundit = true; - return false; // break + return false; // break }); if (foundit) { - return false; // break + return false; // break } }); - return false; // stop link from scrolling page + return false; // stop link from scrolling page }; Twinkle.config.resetPref = function twinkleconfigResetPref(pref) { @@ -1560,7 +1557,7 @@ Twinkle.config.resetAllPrefs = function twinkleconfigResetAllPrefs() { // no confirmation message - the user can just refresh/close the page to abort $(Twinkle.config.sections).each((sectionkey, section) => { if (section.hidden || (section.adminOnly && !Morebits.userIsSysop)) { - return true; // continue: skip impossibilities + return true; // continue: skip impossibilities } $(section.preferences).each((prefkey, pref) => { if (!pref.adminOnly || Morebits.userIsSysop) { @@ -1569,7 +1566,7 @@ Twinkle.config.resetAllPrefs = function twinkleconfigResetAllPrefs() { }); return true; }); - return false; // stop link from scrolling page + return false; // stop link from scrolling page }; Twinkle.config.save = function twinkleconfigSave(e) { @@ -1618,27 +1615,27 @@ Twinkle.config.writePrefs = function twinkleconfigWritePrefs(pageobj) { $(Twinkle.config.sections).each((sectionkey, section) => { if (section.adminOnly && !Morebits.userIsSysop) { - return; // i.e. "continue" in this context + return; // i.e. "continue" in this context } // reach each of the preferences from the form $(section.preferences).each((prefkey, pref) => { - let userValue; // = undefined + let userValue; // = undefined // only read form values for those prefs that have them if (!pref.adminOnly || Morebits.userIsSysop) { if (!section.hidden) { switch (pref.type) { - case 'boolean': // read from the checkbox + case 'boolean': // read from the checkbox userValue = form[pref.name].checked; break; - case 'string': // read from the input box or combo box + case 'string': // read from the input box or combo box case 'enum': userValue = form[pref.name].value; break; - case 'integer': // read from the input box + case 'integer': // read from the input box userValue = parseInt(form[pref.name].value, 10); if (isNaN(userValue)) { Morebits.status.warn('Saving', 'The value you specified for ' + pref.name + ' (' + pref.value + ') was invalid. The save will continue, but the invalid data value will be skipped.'); @@ -1646,7 +1643,7 @@ Twinkle.config.writePrefs = function twinkleconfigWritePrefs(pageobj) { } break; - case 'set': // read from the set of check boxes + case 'set': // read from the set of check boxes userValue = []; if (pref.setDisplayOrder) { // read only those keys specified in the display order @@ -1665,7 +1662,7 @@ Twinkle.config.writePrefs = function twinkleconfigWritePrefs(pageobj) { } break; - case 'customList': // read from the jQuery data stored on the button object + case 'customList': // read from the jQuery data stored on the button object userValue = $(form[pref.name]).data('value'); break; @@ -1732,5 +1729,4 @@ Twinkle.config.saveSuccess = function twinkleconfigSaveSuccess(pageobj) { Twinkle.addInitCallback(Twinkle.config.init); }()); - // diff --git a/modules/twinkledeprod.js b/modules/twinkledeprod.js index c8b4939ff..2337fb9bd 100644 --- a/modules/twinkledeprod.js +++ b/modules/twinkledeprod.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinkledeprod.js: Batch deletion of expired PRODs (sysops only) @@ -36,7 +34,7 @@ Twinkle.deprod.callback = function() { const form = new Morebits.quickForm(callback_commit); const statusdiv = document.createElement('div'); - statusdiv.style.padding = '15px'; // just so it doesn't look broken + statusdiv.style.padding = '15px'; // just so it doesn't look broken Window.setContent(statusdiv); Morebits.status.init(statusdiv); Window.display(); @@ -143,7 +141,7 @@ var callback_commit = function(event) { const pageTitle = mw.Title.newFromText(pageName); // Don't delete user talk pages, limiting this to Talk: pages since only article and user pages appear in deprod if (pageTitle && pageTitle.namespace % 2 === 0 && pageTitle.namespace !== 2) { - pageTitle.namespace++; // now pageTitle is the talk page title! + pageTitle.namespace++; // now pageTitle is the talk page title! query = { action: 'query', titles: pageTitle.toText(), @@ -188,5 +186,4 @@ var callback_commit = function(event) { Twinkle.addInitCallback(Twinkle.deprod, 'deprod'); }()); - // diff --git a/modules/twinklediff.js b/modules/twinklediff.js index 4a38edb32..57b0739f0 100644 --- a/modules/twinklediff.js +++ b/modules/twinklediff.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinklediff.js: Diff module @@ -79,5 +77,4 @@ Twinkle.diff.callbacks = { Twinkle.addInitCallback(Twinkle.diff, 'diff'); }()); - // diff --git a/modules/twinkleimage.js b/modules/twinkleimage.js index e3caed2b4..c1522708f 100644 --- a/modules/twinkleimage.js +++ b/modules/twinkleimage.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinkleimage.js: Image CSD module @@ -273,7 +271,7 @@ Twinkle.image.callbacks = { tag += params.reason ? '|1=' + params.reason : ''; break; default: - break; // doesn't matter + break; // doesn't matter } tag += '|help=off}}\n'; @@ -359,5 +357,4 @@ Twinkle.image.callbacks = { Twinkle.addInitCallback(Twinkle.image, 'image'); }()); - // diff --git a/modules/twinkleprod.js b/modules/twinkleprod.js index 69280c7c6..9a17ab595 100644 --- a/modules/twinkleprod.js +++ b/modules/twinkleprod.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinkleprod.js: PROD module @@ -111,7 +109,6 @@ Twinkle.prod.callback = function twinkleprodCallback() { }; - Twinkle.prod.callback.prodtypechanged = function(event) { // prepare frame for prod type dependant controls const field = new Morebits.quickForm.element({ @@ -222,7 +219,7 @@ Twinkle.prod.callbacks = { fetchCreationInfo: function twinkleprodFetchCreationInfo() { const def = $.Deferred(); const ts = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Looking up page creator'); - ts.setFollowRedirect(true); // for NPP, and also because redirects are ineligible for PROD + ts.setFollowRedirect(true); // for NPP, and also because redirects are ineligible for PROD ts.setLookupNonRedirectCreator(true); // Look for author of first non-redirect revision ts.lookupCreation((pageobj) => { params.initialContrib = pageobj.getCreator(); @@ -237,7 +234,7 @@ Twinkle.prod.callbacks = { const def = $.Deferred(); const wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Tagging page'); - wikipedia_page.setFollowRedirect(true); // for NPP, and also because redirects are ineligible for PROD + wikipedia_page.setFollowRedirect(true); // for NPP, and also because redirects are ineligible for PROD wikipedia_page.load((pageobj) => { const statelem = pageobj.getStatusElement(); @@ -291,7 +288,7 @@ Twinkle.prod.callbacks = { const wikipage = new Morebits.wikitext.page(text); text = wikipage.insertAfterTemplates(tag + '\n', Twinkle.hatnoteRegex).getText(); - } else { // already tagged for PROD, so try endorsing it + } else { // already tagged for PROD, so try endorsing it const prod2_re = /{{(?:Proposed deletion endorsed|prod-?2).*?}}/i; if (prod2_re.test(text)) { statelem.warn('Page already tagged with {{proposed deletion}} and {{proposed deletion endorsed}} templates, aborting procedure'); @@ -344,7 +341,7 @@ Twinkle.prod.callbacks = { talkpage.setPrependText(oldprodfull); talkpage.setEditSummary('Adding {{Old prod}}'); talkpage.setChangeTags(Twinkle.changeTags); - talkpage.setFollowRedirect(true); // match behavior for page tagging + talkpage.setFollowRedirect(true); // match behavior for page tagging talkpage.setCreateOption('recreate'); talkpage.prepend(def.resolve, def.reject); return def; @@ -477,5 +474,4 @@ Twinkle.prod.callback.evaluate = function twinkleprodCallbackEvaluate(e) { Twinkle.addInitCallback(Twinkle.prod, 'prod'); }()); - // diff --git a/modules/twinkleprotect.js b/modules/twinkleprotect.js index c537c375a..ab06f6102 100644 --- a/modules/twinkleprotect.js +++ b/modules/twinkleprotect.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinkleprotect.js: Protect/RPP module @@ -91,7 +89,6 @@ Twinkle.protect.callback = function twinkleprotectCallback() { Twinkle.protect.fetchProtectionLevel(); }; - // A list of bots who may be the protecting sysop, for whom we shouldn't // remind the user contact before requesting unprotection (evaluate) Twinkle.protect.trustedBots = ['MusikBot II', 'TFA Protector Bot']; @@ -110,7 +107,6 @@ const hasFlaggedRevs = mw.loader.getState('ext.flaggedRevs.review') && // Limit template editor; a Twinkle restriction, not a site setting const isTemplate = mw.config.get('wgNamespaceNumber') === 10 || mw.config.get('wgNamespaceNumber') === 828; - // Contains the current protection level in an object // Once filled, it will look something like: // { edit: { level: "sysop", expiry: , cascade: true }, ... } @@ -335,7 +331,7 @@ Twinkle.protect.callback.changeAction = function twinkleprotectCallbackChangeAct }); field2 = new Morebits.quickForm.element({ type: 'field', label: 'Protection options', name: 'field2' }); - field2.append({ type: 'div', name: 'currentprot', label: ' ' }); // holds the current protection level, as filled out by the async callback + field2.append({ type: 'div', name: 'currentprot', label: ' ' }); // holds the current protection level, as filled out by the async callback field2.append({ type: 'div', name: 'hasprotectlog', label: ' ' }); // for existing pages if (mw.config.get('wgArticleId')) { @@ -439,7 +435,7 @@ Twinkle.protect.callback.changeAction = function twinkleprotectCallbackChangeAct list: Twinkle.protect.protectionLengths }); } - } else { // for non-existing pages + } else { // for non-existing pages field2.append({ type: 'select', name: 'createlevel', @@ -494,13 +490,13 @@ Twinkle.protect.callback.changeAction = function twinkleprotectCallbackChangeAct value: '', tooltip: 'Optional revision ID of the RfPP page where protection was requested.' }); - if (!mw.config.get('wgArticleId') || mw.config.get('wgPageContentModel') === 'Scribunto' || mw.config.get('wgNamespaceNumber') === 710) { // tagging isn't relevant for non-existing, module, or TimedText pages + if (!mw.config.get('wgArticleId') || mw.config.get('wgPageContentModel') === 'Scribunto' || mw.config.get('wgNamespaceNumber') === 710) { // tagging isn't relevant for non-existing, module, or TimedText pages break; } /* falls through */ case 'tag': field1 = new Morebits.quickForm.element({ type: 'field', label: 'Tagging options', name: 'field1' }); - field1.append({ type: 'div', name: 'currentprot', label: ' ' }); // holds the current protection level, as filled out by the async callback + field1.append({ type: 'div', name: 'currentprot', label: ' ' }); // holds the current protection level, as filled out by the async callback field1.append({ type: 'div', name: 'hasprotectlog', label: ' ' }); field1.append({ type: 'select', @@ -543,7 +539,7 @@ Twinkle.protect.callback.changeAction = function twinkleprotectCallbackChangeAct }); field1 = new Morebits.quickForm.element({ type: 'field', label: 'Options', name: 'field1' }); - field1.append({ type: 'div', name: 'currentprot', label: ' ' }); // holds the current protection level, as filled out by the async callback + field1.append({ type: 'div', name: 'currentprot', label: ' ' }); // holds the current protection level, as filled out by the async callback field1.append({ type: 'div', name: 'hasprotectlog', label: ' ' }); field1.append({ type: 'select', @@ -773,9 +769,9 @@ Twinkle.protect.protectionWeight = { templateeditor: 30, extendedconfirmed: 20, autoconfirmed: 10, - flaggedrevs_autoconfirmed: 5, // Pending Changes protection alone + flaggedrevs_autoconfirmed: 5, // Pending Changes protection alone all: 0, - flaggedrevs_none: 0 // just in case + flaggedrevs_none: 0 // just in case }; // NOTICE: keep this synched with [[MediaWiki:Protect-dropdown]] @@ -873,7 +869,7 @@ Twinkle.protect.protectionPresetsInfo = { reason: '[[WP:PP#Talk-page protection|Inappropriate use of user talk page while blocked]]', template: 'pp-usertalk' }, - 'pp-semi-template': { // removed for now + 'pp-semi-template': { // removed for now edit: 'autoconfirmed', move: 'autoconfirmed', expiry: 'infinity', @@ -891,7 +887,7 @@ Twinkle.protect.protectionPresetsInfo = { template: 'pp-protected' }, 'pp-pc-vandalism': { - stabilize: 'autoconfirmed', // stabilize = Pending Changes + stabilize: 'autoconfirmed', // stabilize = Pending Changes reason: 'Persistent [[WP:Vandalism|vandalism]]', template: 'pp-pc' }, @@ -932,7 +928,7 @@ Twinkle.protect.protectionPresetsInfo = { expiry: 'infinity', reason: '[[WP:MOVP|Highly visible page]]' }, - 'unprotect': { + unprotect: { edit: 'all', move: 'all', stabilize: 'none', @@ -1009,7 +1005,7 @@ Twinkle.protect.callback.changePreset = function twinkleprotectCallbackChangePre break; } - if (actiontype === 'protect') { // actually protecting the page + if (actiontype === 'protect') { // actually protecting the page const item = Twinkle.protect.protectionPresetsInfo[form.category.value]; if (mw.config.get('wgArticleId')) { @@ -1035,7 +1031,6 @@ Twinkle.protect.callback.changePreset = function twinkleprotectCallbackChangePre form.editexpiry.value = form.moveexpiry.value = item.expiry || '2 days'; - if (form.pcmodify) { if (item.stabilize) { form.pcmodify.checked = true; @@ -1086,7 +1081,7 @@ Twinkle.protect.callback.changePreset = function twinkleprotectCallbackChangePre } } - } else { // RPP request + } else { // RPP request if (form.category.value === 'unprotect') { form.expiry.value = ''; form.expiry.disabled = true; @@ -1355,7 +1350,7 @@ Twinkle.protect.callback.evaluate = function twinkleprotectCallbackEvaluate(e) { var reason = typereason; if (input.reason !== '') { if (typereason !== '') { - reason += '\u00A0\u2013 '; // U+00A0 NO-BREAK SPACE; U+2013 EN RULE + reason += '\u00A0\u2013 '; // U+00A0 NO-BREAK SPACE; U+2013 EN RULE } reason += input.reason; } @@ -1660,5 +1655,4 @@ Twinkle.protect.callbacks = { Twinkle.addInitCallback(Twinkle.protect, 'protect'); }()); - // diff --git a/modules/twinklerollback.js b/modules/twinklerollback.js index 40c9b7402..800b5fe2d 100644 --- a/modules/twinklerollback.js +++ b/modules/twinklerollback.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinklerollback.js: Revert/rollback module @@ -185,7 +183,6 @@ Twinkle.rollback.linkBuilder = { } }; - Twinkle.rollback.addLinks = { contributions: function() { // $('sp-contributions-footer-anon-range') relies on the fmbox @@ -275,7 +272,6 @@ Twinkle.rollback.addLinks = { } }); - } }, @@ -354,7 +350,6 @@ Twinkle.rollback.disableLinks = function disablelinks(parentNode) { }); }; - Twinkle.rollback.revert = function revertPage(type, vandal, rev, page) { if (mw.util.isIPv6Address(vandal)) { vandal = Morebits.ip.sanitizeIPv6(vandal); @@ -445,7 +440,7 @@ Twinkle.rollback.callbacks = { return; } - const optional_summary = prompt('Please specify a reason for the revert: ', ''); // padded out to widen prompt in Firefox + const optional_summary = prompt('Please specify a reason for the revert: ', ''); // padded out to widen prompt in Firefox if (optional_summary === null) { apiobj.statelem.error('Aborted by user.'); return; @@ -640,7 +635,7 @@ Twinkle.rollback.callbacks = { let summary, extra_summary; switch (params.type) { case 'agf': - extra_summary = prompt('An optional comment for the edit summary: ', ''); // padded out to widen prompt in Firefox + extra_summary = prompt('An optional comment for the edit summary: ', ''); // padded out to widen prompt in Firefox if (extra_summary === null) { statelem.error('Aborted by user.'); return; @@ -660,7 +655,7 @@ Twinkle.rollback.callbacks = { /* falls through */ default: if (Twinkle.getPref('offerReasonOnNormalRevert')) { - extra_summary = prompt('An optional comment for the edit summary: ', ''); // padded out to widen prompt in Firefox + extra_summary = prompt('An optional comment for the edit summary: ', ''); // padded out to widen prompt in Firefox if (extra_summary === null) { statelem.error('Aborted by user.'); return; @@ -854,5 +849,4 @@ Twinkle.rollback.formatSummary = function(builtInString, userName, customString) Twinkle.addInitCallback(Twinkle.rollback, 'rollback'); }()); - // diff --git a/modules/twinkleshared.js b/modules/twinkleshared.js index 1b6a6ebba..f551e18f2 100644 --- a/modules/twinkleshared.js +++ b/modules/twinkleshared.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinkleshared.js: Shared IP tagging module @@ -130,9 +128,9 @@ Twinkle.shared.standardList = [ ]; Twinkle.shared.callback.change_shared = function twinklesharedCallbackChangeShared(e) { - e.target.form.contact.disabled = e.target.value !== 'Shared IP edu'; // only supported by {{Shared IP edu}} + e.target.form.contact.disabled = e.target.value !== 'Shared IP edu'; // only supported by {{Shared IP edu}} e.target.form.organization.disabled = false; - e.target.form.host.disabled = e.target.value === 'Whois'; // host= not supported by {{Whois}} + e.target.form.host.disabled = e.target.value === 'Whois'; // host= not supported by {{Whois}} }; Twinkle.shared.callbacks = { @@ -233,5 +231,4 @@ Twinkle.shared.callback.evaluate = function twinklesharedCallbackEvaluate(e) { Twinkle.addInitCallback(Twinkle.shared, 'shared'); }()); - // diff --git a/modules/twinklespeedy.js b/modules/twinklespeedy.js index befc9cec6..090de201f 100644 --- a/modules/twinklespeedy.js +++ b/modules/twinklespeedy.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinklespeedy.js: CSD module @@ -98,7 +96,7 @@ Twinkle.speedy.initDialog = function twinklespeedyInitDialog(callbackfunc) { type: 'header', label: 'Delete-related options' }); - if (mw.config.get('wgNamespaceNumber') % 2 === 0 && (mw.config.get('wgNamespaceNumber') !== 2 || (/\//).test(mw.config.get('wgTitle')))) { // hide option for user pages, to avoid accidentally deleting user talk page + if (mw.config.get('wgNamespaceNumber') % 2 === 0 && (mw.config.get('wgNamespaceNumber') !== 2 || (/\//).test(mw.config.get('wgTitle')))) { // hide option for user pages, to avoid accidentally deleting user talk page deleteOptions.append({ type: 'checkbox', list: [ @@ -286,26 +284,26 @@ Twinkle.speedy.callback.modeChanged = function twinklespeedyCallbackModeChanged( if (!Morebits.isPageRedirect()) { switch (namespace) { - case 0: // article - case 1: // talk + case 0: // article + case 1: // talk appendList('Articles', Twinkle.speedy.articleList); break; - case 2: // user - case 3: // user talk + case 2: // user + case 3: // user talk appendList('User pages', Twinkle.speedy.userList); break; - case 6: // file - case 7: // file talk + case 6: // file + case 7: // file talk appendList('Files', Twinkle.speedy.fileList); if (!mode.isSysop) { work_area.append({ type: 'div', label: 'Tagging for CSD F4 (no license), F5 (orphaned non-free use), F6 (no non-free use rationale), and F11 (no permission) can be done using Twinkle\'s "DI" tab.' }); } break; - case 14: // category - case 15: // category talk + case 14: // category + case 15: // category talk appendList('Categories', Twinkle.speedy.categoryList); break; @@ -353,7 +351,7 @@ Twinkle.speedy.callback.priorDeletionCount = function () { leaction: 'delete/delete', // Just pure page deletion, no redirect overwrites or revdel letitle: mw.config.get('wgPageName'), leprop: '', // We're just counting we don't actually care about the entries - lelimit: 5 // A little bit goes a long way + lelimit: 5 // A little bit goes a long way }; new Morebits.wiki.api('Checking for past deletions', query, ((apiobj) => { @@ -384,7 +382,6 @@ Twinkle.speedy.callback.priorDeletionCount = function () { })).post(); }; - Twinkle.speedy.generateCsdList = function twinklespeedyGenerateCsdList(list, mode) { const pageNamespace = mw.config.get('wgNamespaceNumber'); @@ -461,7 +458,7 @@ Twinkle.speedy.generateCsdList = function twinklespeedyGenerateCsdList(list, mod criterion.subgroup, { type: 'button', - name: 'submit', // ends up being called "csd.submit" so this is OK + name: 'submit', // ends up being called "csd.submit" so this is OK label: mode.isSysop ? 'Delete page' : 'Tag page', event: submitSubgroupHandler } @@ -901,7 +898,7 @@ Twinkle.speedy.generalList = [ value: 'subpage', tooltip: 'This excludes any page that is useful to the project, and in particular: deletion discussions that are not logged elsewhere, user and user talk pages, talk page archives, plausible redirects that can be changed to valid targets, and file pages or talk pages for files that exist on Wikimedia Commons.', hideWhenMultiple: true, - hideInNamespaces: [ 0, 6, 8 ] // hide in main, file, and mediawiki-spaces + hideInNamespaces: [ 0, 6, 8 ] // hide in main, file, and mediawiki-spaces }, { label: 'G10: Attack page', @@ -952,7 +949,7 @@ Twinkle.speedy.generalList = [ value: 'afc', tooltip: 'Any rejected or unsubmitted AfC submission in userspace or any non-redirect page in draft namespace, that has not been edited for more than 6 months. Blank drafts in either namespace are also included.', hideWhenRedirect: true, - showInNamespaces: [2, 118] // user, draft namespaces only + showInNamespaces: [2, 118] // user, draft namespaces only }, { label: 'G14: Unnecessary disambiguation page', @@ -994,67 +991,67 @@ Twinkle.speedy.redirectList = [ ]; Twinkle.speedy.normalizeHash = { - 'reason': 'db', - 'nonsense': 'g1', - 'test': 'g2', - 'vandalism': 'g3', - 'hoax': 'g3', - 'repost': 'g4', - 'banned': 'g5', - 'error': 'g6', - 'move': 'g6', + reason: 'db', + nonsense: 'g1', + test: 'g2', + vandalism: 'g3', + hoax: 'g3', + repost: 'g4', + banned: 'g5', + error: 'g6', + move: 'g6', 'afc-move': 'g6', - 'xfd': 'g6', - 'movedab': 'g6', - 'copypaste': 'g6', - 'g6': 'g6', - 'author': 'g7', - 'g8': 'g8', - 'talk': 'g8', - 'subpage': 'g8', - 'redirnone': 'g8', - 'imagepage': 'g8', - 'attack': 'g10', - 'negublp': 'g10', - 'spam': 'g11', - 'spamuser': 'g11', - 'copyvio': 'g12', - 'afc': 'g13', - 'disambig': 'g14', - 'nocontext': 'a1', - 'foreign': 'a2', - 'nocontent': 'a3', - 'a7': 'a7', - 'person': 'a7', - 'corp': 'a7', - 'web': 'a7', - 'band': 'a7', - 'club': 'a7', - 'animal': 'a7', - 'event': 'a7', - 'a9': 'a9', - 'a10': 'a10', - 'madeup': 'a11', - 'rediruser': 'r2', - 'redirtypo': 'r3', - 'redircom': 'r4', - 'redundantimage': 'f1', - 'noimage': 'f2', - 'fpcfail': 'f2', - 'noncom': 'f3', - 'unksource': 'f4', - 'unfree': 'f5', - 'f5': 'f5', - 'norat': 'f6', - 'badfairuse': 'f7', - 'commons': 'f8', - 'imgcopyvio': 'f9', - 'nopermission': 'f11', - 'catempty': 'c1', - 'c4': 'c4', - 'userreq': 'u1', - 'nouser': 'u2', - 'notwebhost': 'u5' + xfd: 'g6', + movedab: 'g6', + copypaste: 'g6', + g6: 'g6', + author: 'g7', + g8: 'g8', + talk: 'g8', + subpage: 'g8', + redirnone: 'g8', + imagepage: 'g8', + attack: 'g10', + negublp: 'g10', + spam: 'g11', + spamuser: 'g11', + copyvio: 'g12', + afc: 'g13', + disambig: 'g14', + nocontext: 'a1', + foreign: 'a2', + nocontent: 'a3', + a7: 'a7', + person: 'a7', + corp: 'a7', + web: 'a7', + band: 'a7', + club: 'a7', + animal: 'a7', + event: 'a7', + a9: 'a9', + a10: 'a10', + madeup: 'a11', + rediruser: 'r2', + redirtypo: 'r3', + redircom: 'r4', + redundantimage: 'f1', + noimage: 'f2', + fpcfail: 'f2', + noncom: 'f3', + unksource: 'f4', + unfree: 'f5', + f5: 'f5', + norat: 'f6', + badfairuse: 'f7', + commons: 'f8', + imgcopyvio: 'f9', + nopermission: 'f11', + catempty: 'c1', + c4: 'c4', + userreq: 'u1', + nouser: 'u2', + notwebhost: 'u5' }; Twinkle.speedy.callbacks = { @@ -1067,7 +1064,7 @@ Twinkle.speedy.callbacks = { code += '|' + norm.toUpperCase(); parameters = params.templateParams[index] || []; for (const i in parameters) { - if (typeof parameters[i] === 'string' && !parseInt(i, 10)) { // skip numeric parameters - {{db-multiple}} doesn't understand them + if (typeof parameters[i] === 'string' && !parseInt(i, 10)) { // skip numeric parameters - {{db-multiple}} doesn't understand them code += '|' + i + '=' + parameters[i]; } } @@ -1173,7 +1170,7 @@ Twinkle.speedy.callbacks = { notifytext += (params.welcomeuser ? '' : '|nowelcome=yes') + '}} ~~~~'; editsummary = 'Notification: speedy deletion' + (params.warnUser ? '' : ' nomination'); - if (params.normalizeds.indexOf('g10') === -1) { // no article name in summary for G10 taggings + if (params.normalizeds.indexOf('g10') === -1) { // no article name in summary for G10 taggings editsummary += ' of [[:' + Morebits.pageNameNorm + ']].'; } else { editsummary += ' of an attack page.'; @@ -1404,7 +1401,7 @@ Twinkle.speedy.callbacks = { // Wrap SD template in noinclude tags if we are in template space. // Won't work with userboxes in userspace, or any other transcluded page outside template space - if (mw.config.get('wgNamespaceNumber') === 10) { // Template: + if (mw.config.get('wgNamespaceNumber') === 10) { // Template: code = '' + code + ''; } @@ -1459,7 +1456,6 @@ Twinkle.speedy.callbacks = { text = wikipage.insertAfterTemplates(code + '\n', Twinkle.hatnoteRegex).getText(); } - pageobj.setPageText(text); pageobj.setEditSummary(editsummary); pageobj.setWatchlist(params.watch); @@ -1537,7 +1533,7 @@ Twinkle.speedy.callbacks = { let editsummary = 'Logging speedy deletion nomination'; let appendText = '# [[:' + Morebits.pageNameNorm; - if (params.normalizeds.indexOf('g10') === -1) { // no article name in log for G10 taggings + if (params.normalizeds.indexOf('g10') === -1) { // no article name in log for G10 taggings appendText += ']]' + fileLogLink + ': '; editsummary += ' of [[:' + Morebits.pageNameNorm + ']].'; } else { @@ -1549,7 +1545,7 @@ Twinkle.speedy.callbacks = { $.each(params.normalizeds, (index, norm) => { appendText += '[[WP:CSD#' + norm.toUpperCase() + '|' + norm.toUpperCase() + ']], '; }); - appendText = appendText.substr(0, appendText.length - 2); // remove trailing comma + appendText = appendText.substr(0, appendText.length - 2); // remove trailing comma appendText += ')'; } else if (params.normalizeds[0] === 'db') { appendText += '{{tl|db-reason}}'; @@ -1614,7 +1610,7 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'userreq': // U1 + case 'userreq': // U1 if (form['csd.userreq_rationale']) { const u1rationale = form['csd.userreq_rationale'].value; if (mw.config.get('wgNamespaceNumber') === 3 && !(/\//).test(mw.config.get('wgTitle')) && @@ -1627,7 +1623,7 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'repost': // G4 + case 'repost': // G4 if (form['csd.repost_xfd']) { const deldisc = form['csd.repost_xfd'].value; if (deldisc) { @@ -1636,13 +1632,13 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'banned': // G5 + case 'banned': // G5 if (form['csd.banned_user'] && form['csd.banned_user'].value) { currentParams.user = form['csd.banned_user'].value.replace(/^\s*User:/i, ''); } break; - case 'move': // G6 + case 'move': // G6 if (form['csd.move_page'] && form['csd.move_reason']) { const movepage = form['csd.move_page'].value, movereason = form['csd.move_reason'].value; @@ -1661,7 +1657,7 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'xfd': // G6 + case 'xfd': // G6 if (form['csd.xfd_fullvotepage']) { const xfd = form['csd.xfd_fullvotepage'].value; if (xfd) { @@ -1670,7 +1666,7 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'afc-move': // G6 + case 'afc-move': // G6 if (form['csd.draft_page']) { const draftpage = form['csd.draft_page'].value; if (!draftpage || !draftpage.trim()) { @@ -1682,7 +1678,7 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'copypaste': // G6 + case 'copypaste': // G6 if (form['csd.copypaste_sourcepage']) { const copypaste = form['csd.copypaste_sourcepage'].value; if (!copypaste || !copypaste.trim()) { @@ -1694,30 +1690,30 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'g6': // G6 + case 'g6': // G6 if (form['csd.g6_rationale'] && form['csd.g6_rationale'].value) { currentParams.rationale = form['csd.g6_rationale'].value; } break; - case 'author': // G7 + case 'author': // G7 if (form['csd.author_rationale'] && form['csd.author_rationale'].value) { currentParams.rationale = form['csd.author_rationale'].value; } break; - case 'g8': // G8 + case 'g8': // G8 if (form['csd.g8_rationale'] && form['csd.g8_rationale'].value) { currentParams.rationale = form['csd.g8_rationale'].value; } break; - case 'attack': // G10 + case 'attack': // G10 currentParams.blanked = 'yes'; // it is actually blanked elsewhere in code, but setting the flag here break; - case 'copyvio': // G12 + case 'copyvio': // G12 if (form['csd.copyvio_url'] && form['csd.copyvio_url'].value) { currentParams.url = form['csd.copyvio_url'].value; } @@ -1729,11 +1725,11 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'afc': // G13 + case 'afc': // G13 currentParams.ts = '$TIMESTAMP'; // to be replaced by the last revision timestamp when page is saved break; - case 'redundantimage': // F1 + case 'redundantimage': // F1 if (form['csd.redundantimage_filename']) { const redimage = form['csd.redundantimage_filename'].value; if (!redimage || !redimage.trim()) { @@ -1745,13 +1741,13 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'badfairuse': // F7 + case 'badfairuse': // F7 if (form['csd.badfairuse_rationale'] && form['csd.badfairuse_rationale'].value) { currentParams.rationale = form['csd.badfairuse_rationale'].value; } break; - case 'commons': // F8 + case 'commons': // F8 if (form['csd.commons_filename']) { const filename = form['csd.commons_filename'].value; if (filename && filename.trim() && filename !== Morebits.pageNameNorm) { @@ -1760,7 +1756,7 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'imgcopyvio': // F9 + case 'imgcopyvio': // F9 if (form['csd.imgcopyvio_url'] && form['csd.imgcopyvio_rationale']) { const f9url = form['csd.imgcopyvio_url'].value; const f9rationale = form['csd.imgcopyvio_rationale'].value; @@ -1778,7 +1774,7 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'foreign': // A2 + case 'foreign': // A2 if (form['csd.foreign_source']) { const foreignlink = form['csd.foreign_source'].value; if (!foreignlink || !foreignlink.trim()) { @@ -1790,7 +1786,7 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'a10': // A10 + case 'a10': // A10 if (form['csd.a10_article']) { const duptitle = form['csd.a10_article'].value; if (!duptitle || !duptitle.trim()) { @@ -1802,7 +1798,7 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values) } break; - case 'c4': // C4 + case 'c4': // C4 if (form['csd.c4_rationale'] && form['csd.c4_rationale'].value) { currentParams.rationale = form['csd.c4_rationale'].value; } @@ -1991,5 +1987,4 @@ Twinkle.speedy.callback.evaluateUser = function twinklespeedyCallbackEvaluateUse Twinkle.addInitCallback(Twinkle.speedy, 'speedy'); }()); - // diff --git a/modules/twinkletag.js b/modules/twinkletag.js index 85ab724c0..d22857827 100644 --- a/modules/twinkletag.js +++ b/modules/twinkletag.js @@ -2,7 +2,6 @@ (function() { - /* **************************************** *** twinkletag.js: Tag module @@ -140,7 +139,6 @@ Twinkle.tag.callback = function twinkletagCallback() { }); }); - form.append({ type: 'select', name: 'sortorder', @@ -153,7 +151,6 @@ Twinkle.tag.callback = function twinkletagCallback() { ] }); - if (!Twinkle.tag.canRemove) { const divElement = document.createElement('div'); divElement.innerHTML = 'For removal of existing tags, please open Tag menu from the current version of article'; @@ -282,7 +279,7 @@ Twinkle.tag.callback = function twinkletagCallback() { // for quick filter: $allCheckboxDivs = $(result).find('[name$=tags]').parent(); $allHeaders = $(result).find('h5, .quickformDescription'); - result.quickfilter.focus(); // place cursor in the quick filter field as soon as window is opened + result.quickfilter.focus(); // place cursor in the quick filter field as soon as window is opened result.quickfilter.autocomplete = 'off'; // disable browser suggestions result.quickfilter.addEventListener('keypress', (e) => { if (e.keyCode === 13) { // prevent enter key from accidentally submitting the form @@ -361,7 +358,6 @@ Twinkle.tag.callback = function twinkletagCallback() { } }; - // $allCheckboxDivs and $allHeaders are defined globally, rather than in the // quickfilter event function, to avoid having to recompute them on every keydown let $allCheckboxDivs, $allHeaders; @@ -407,7 +403,6 @@ Twinkle.tag.updateSortOrder = function(e) { }); }; - if (sortorder === 'cat') { // categorical sort order // function to iterate through the tags and create a checkbox for each one const doCategoryCheckboxes = function(subdiv, subgroup) { @@ -524,7 +519,6 @@ var generateLinks = function(checkbox) { $(checkbox).parent().append(['\u00A0', link]); }; - // Tags for ARTICLES start here Twinkle.tag.article = {}; @@ -612,7 +606,7 @@ Twinkle.tag.article.tagList = { size: 35, required: true } - }, // has a subgroup with text input + }, // has a subgroup with text input { tag: 'Cleanup rewrite', description: "needs to be rewritten entirely to comply with Wikipedia's quality standards" @@ -628,7 +622,7 @@ Twinkle.tag.article.tagList = { tooltip: 'e.g. "consistent spelling". Optional.', size: 35 } - } // has a subgroup with text input + } // has a subgroup with text input ], 'Potentially unwanted content': [ { @@ -654,7 +648,7 @@ Twinkle.tag.article.tagList = { tooltip: 'If known.', size: 50 } - }, // has a subgroup with text input + }, // has a subgroup with text input { tag: 'AI-generated', description: 'content appears to be generated by a large language model' }, { tag: 'External links', description: 'external links may not follow content policies or guidelines' }, { tag: 'Non-free', description: 'may contain excessive or improper use of copyrighted materials' } @@ -765,7 +759,7 @@ Twinkle.tag.article.tagList = { { tag: 'Overly detailed', description: 'excessive amount of intricate detail' }, { tag: 'Undue weight', description: 'lends undue weight to certain ideas, incidents, or controversies' } ], - 'Timeliness': [ + Timeliness: [ { tag: 'Current', description: 'documents a current event', excludeMI: true }, // Works but not intended for use in MI { tag: 'Current related', description: 'documents a topic affected by a current event', excludeMI: true }, // Works but not intended for use in MI { tag: 'Update', description: 'needs additional up-to-date information added', @@ -843,11 +837,11 @@ Twinkle.tag.article.tagList = { ] }, 'Specific content issues': { - 'Accessibility': [ + Accessibility: [ { tag: 'Cleanup colors', description: 'uses color as only way to convey information' }, { tag: 'Overcoloured', description: 'overuses color'} ], - 'Language': [ + Language: [ { tag: 'Not English', description: 'written in a language other than English and needs translation', excludeMI: true, subgroup: translationSubgroups.slice(0, 1).concat([{ @@ -889,7 +883,7 @@ Twinkle.tag.article.tagList = { }] } ], - 'Links': [ + Links: [ { tag: 'Dead end', description: 'article has no links to other articles' }, { tag: 'Orphan', description: 'linked to from no other articles' }, { tag: 'Overlinked', description: 'too many duplicate and/or irrelevant links to other articles' }, @@ -902,12 +896,12 @@ Twinkle.tag.article.tagList = { { tag: 'No footnotes', description: 'has references, but lacks inline citations' }, { tag: 'Parenthetical referencing', description: 'uses parenthetical referencing, which is deprecated on Wikipedia' } ], - 'Categories': [ + Categories: [ { tag: 'Improve categories', description: 'needs additional or more specific categories', excludeMI: true }, { tag: 'Uncategorized', description: 'not added to any categories', excludeMI: true } ] }, - 'Merging': [ + Merging: [ { tag: 'History merge', description: 'another page should be history merged into this one', @@ -944,7 +938,7 @@ Twinkle.tag.article.tagList = { { tag: 'Merge to', description: 'should be merged into another given article', excludeMI: true, subgroup: getMergeSubgroups('Merge to') } ], - 'Informational': [ + Informational: [ { tag: 'GOCEinuse', description: 'currently undergoing a major copy edit by the Guild of Copy Editors', excludeMI: true }, { tag: 'In use', description: 'undergoing a major edit for a short while', excludeMI: true }, { tag: 'Under construction', description: 'in the process of an expansion or major restructuring', excludeMI: true } @@ -956,7 +950,7 @@ Twinkle.tag.article.tagList = { // transclusions from Template:R template index Twinkle.tag.redirectList = { 'Grammar, punctuation, and spelling': { - 'Abbreviation': [ + Abbreviation: [ { tag: 'R from acronym', description: 'redirect from an acronym (e.g. POTUS) to its expanded form', restriction: 'insideMainspaceOnly' }, { tag: 'R from airport code', description: 'redirect from an airport\'s IATA or ICAO code to that airport\'s article', restriction: 'insideMainspaceOnly' }, { tag: 'R from airline code', description: 'redirect from an airline\'s IATA or ICAO code to that airline\'s article', restriction: 'insideMainspaceOnly' }, @@ -964,7 +958,7 @@ Twinkle.tag.redirectList = { { tag: 'R from MathSciNet abbreviation', description: 'redirect from MathSciNet publication title abbreviation to the unabbreviated title', restriction: 'insideMainspaceOnly' }, { tag: 'R from NLM abbreviation', description: 'redirect from a NLM publication title abbreviation to the unabbreviated title', restriction: 'insideMainspaceOnly' } ], - 'Capitalisation': [ + Capitalisation: [ { tag: 'R from CamelCase', description: 'redirect from a CamelCase title' }, { tag: 'R from other capitalisation', description: 'redirect from a title with another method of capitalisation', restriction: 'insideMainspaceOnly' }, { tag: 'R from miscapitalisation', description: 'redirect from a capitalisation error' } @@ -978,7 +972,7 @@ Twinkle.tag.redirectList = { { tag: 'R from verb', description: 'redirect from an English-language verb or verb phrase', restriction: 'insideMainspaceOnly' }, { tag: 'R from adjective', description: 'redirect from an adjective (word or phrase that describes a noun)', restriction: 'insideMainspaceOnly' } ], - 'Spelling': [ + Spelling: [ { tag: 'R from alternative spelling', description: 'redirect from a title with a different spelling' }, { tag: 'R from alternative transliteration', description: 'redirect from an alternative English transliteration to a more common variation' }, { tag: 'R from ASCII-only', description: 'redirect from a title in only basic ASCII to the formal title, with differences that are not diacritical marks or ligatures' }, @@ -1058,7 +1052,7 @@ Twinkle.tag.redirectList = { ] }, 'Navigation aids': { - 'Navigation': [ + Navigation: [ { tag: 'R to anchor', description: 'redirect from a topic that does not have its own page to an anchored part of a page on the subject' }, { tag: 'R avoided double redirect', @@ -1078,7 +1072,7 @@ Twinkle.tag.redirectList = { { tag: 'R from shortcut', description: 'redirect from a Wikipedia shortcut' }, { tag: 'R to subpage', description: 'redirect to a subpage' } ], - 'Disambiguation': [ + Disambiguation: [ { tag: 'R from ambiguous term', description: 'redirect from an ambiguous page name to a page that disambiguates it. This template should never appear on a page that has "(disambiguation)" in its title, use R to disambiguation page instead' }, { tag: 'R to disambiguation page', description: 'redirect to a disambiguation page', restriction: 'disambiguationPagesOnly' }, { tag: 'R from incomplete disambiguation', description: 'redirect from a page name that is too ambiguous to be the title of an article and should redirect to an appropriate disambiguation page' }, @@ -1092,7 +1086,7 @@ Twinkle.tag.redirectList = { { tag: 'R from move', description: 'redirect from a page that has been moved/renamed' }, { tag: 'R from merge', description: 'redirect from a merged page in order to preserve its edit history' } ], - 'Namespace': [ + Namespace: [ { tag: 'R from remote talk page', description: 'redirect from a talk page in any talk namespace to a corresponding page that is more heavily watched', restriction: 'insideTalkNamespaceOnly' }, { tag: 'R to category namespace', description: 'redirect from a page outside the category namespace to a category page' }, { tag: 'R to help namespace', description: 'redirect from any page inside or outside of help namespace to a page in that namespace' }, @@ -1102,7 +1096,7 @@ Twinkle.tag.redirectList = { { tag: 'R to user namespace', description: 'redirect from a page outside the user namespace to a user page (not to a user talk page)', restriction: 'outsideUserspaceOnly' } ] }, - 'Media': { + Media: { General: [ { tag: 'R from album', description: 'redirect from an album to a related topic such as the recording artist or a list of albums', restriction: 'insideMainspaceOnly' }, { tag: 'R from band name', description: 'redirect from a musical band or musical group name that redirects an article on a single person, i.e. the band or group leader' }, @@ -1124,7 +1118,7 @@ Twinkle.tag.redirectList = { { tag: 'R from fictional location', description: 'redirect from a fictional location or setting to a related fictional work or list of places', restriction: 'insideMainspaceOnly' } ] }, - 'Miscellaneous': { + Miscellaneous: { 'Related information': [ { tag: 'R to article without mention', description: 'redirect to an article without any mention of the redirected word or phrase', restriction: 'insideMainspaceOnly' }, { tag: 'R to decade', description: 'redirect from a year to the decade article', restriction: 'insideMainspaceOnly' }, @@ -1148,7 +1142,7 @@ Twinkle.tag.redirectList = { { tag: 'R from ISO 4 abbreviation', description: 'redirect from an ISO 4 publication title abbreviation to the unabbreviated title', restriction: 'insideMainspaceOnly' }, { tag: 'R from ISO 639 code', description: 'redirect from a title that is an ISO 639 language code to an article about the language', restriction: 'insideMainspaceOnly' } ], - 'Printworthiness': [ + Printworthiness: [ { tag: 'R printworthy', description: 'redirect from a title that would be helpful in a printed or CD/DVD version of Wikipedia', restriction: 'insideMainspaceOnly' }, { tag: 'R unprintworthy', description: 'redirect from a title that would NOT be helpful in a printed or CD/DVD version of Wikipedia', restriction: 'insideMainspaceOnly' } ] @@ -1339,7 +1333,6 @@ Twinkle.tag.fileList['Replacement tags'].forEach((el) => { }; }); - Twinkle.tag.callbacks = { article: function articleCallback(pageobj) { @@ -1558,8 +1551,8 @@ Twinkle.tag.callbacks = { action: 'query', prop: 'linkshere', titles: getRedirectsFor.join('|'), - redirects: 1, // follow redirect if the class name turns out to be a redirect page - lhnamespace: '10', // template namespace only + redirects: 1, // follow redirect if the class name turns out to be a redirect page + lhnamespace: '10', // template namespace only lhshow: 'redirect', lhlimit: 'max', // 500 is max for normal users, 5000 for bots and sysops format: 'json' @@ -1573,7 +1566,7 @@ Twinkle.tag.callbacks = { if (tag_re.test(pageText)) { pageText = pageText.replace(tag_re, ''); removed = true; - return false; // break out of $.each + return false; // break out of $.each } }); if (!removed) { @@ -1753,7 +1746,6 @@ Twinkle.tag.callbacks = { addUngroupedTags(); }; - const getRedirectsFor = []; // Reposition the tags on the page into {{multiple issues}}, if found with its @@ -1793,7 +1785,7 @@ Twinkle.tag.callbacks = { tagText += tag_re.exec(pageText)[1]; pageText = pageText.replace(tag_re, ''); found = true; - return false; // break out of $.each + return false; // break out of $.each } }); if (!found) { @@ -1987,7 +1979,7 @@ Twinkle.tag.callbacks = { } break; default: - break; // don't care + break; // don't care } currentTag = '{{' + currentTag + '}}\n'; @@ -2024,7 +2016,6 @@ Twinkle.tag.callback.evaluate = function twinkletagCallbackEvaluate(e) { const form = e.target; const params = Morebits.quickForm.getInputData(form); - // Validation // Given an array of incompatible tags, check if we have two or more selected diff --git a/modules/twinkletalkback.js b/modules/twinkletalkback.js index 8531fe208..a7ee884c4 100644 --- a/modules/twinkletalkback.js +++ b/modules/twinkletalkback.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinkletalkback.js: Talkback module @@ -64,7 +62,7 @@ Twinkle.talkback.callback = function() { const previewlink = document.createElement('a'); $(previewlink).click(() => { - Twinkle.talkback.callbacks.preview(result); // |result| is defined below + Twinkle.talkback.callbacks.preview(result); // |result| is defined below }); previewlink.style.cursor = 'pointer'; previewlink.textContent = 'Preview'; @@ -329,7 +327,7 @@ Twinkle.talkback.evaluate = function(e) { talkpage.setEditSummary('Please check the discussion at [[:' + input.page + (input.section ? '#' + input.section : '') + ']]'); break; - default: // talkback + default: // talkback input.page = Twinkle.talkback.callbacks.normalizeTalkbackPage(input.page); talkpage.setEditSummary('Talkback ([[:' + input.page + (input.section ? '#' + input.section : '') + ']])'); @@ -399,7 +397,7 @@ Twinkle.talkback.callbacks = { text = '{{subst:Please see|location=' + input.page + (input.section ? '#' + input.section : '') + '|more=' + input.message + '|heading=' + heading + '}}'; break; - default: // talkback + default: // talkback text = '==' + Twinkle.getPref('talkbackHeading') + '==\n' + '{{talkback|' + input.page + (input.section ? '|' + input.section : '') + '|ts=~~~~~}}'; @@ -415,5 +413,4 @@ Twinkle.talkback.callbacks = { Twinkle.addInitCallback(Twinkle.talkback, 'talkback'); }()); - // diff --git a/modules/twinkleunlink.js b/modules/twinkleunlink.js index 81380976f..5ca9cdf2b 100644 --- a/modules/twinkleunlink.js +++ b/modules/twinkleunlink.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinkleunlink.js: Unlink module @@ -88,7 +86,7 @@ Twinkle.unlink.callback = function(presetReason) { wikipedia_api.post(); const root = document.createElement('div'); - root.style.padding = '15px'; // just so it doesn't look broken + root.style.padding = '15px'; // just so it doesn't look broken Morebits.status.init(root); wikipedia_api.statelem.status('loading...'); Window.setContent(root); @@ -122,7 +120,7 @@ Twinkle.unlink.callback.evaluate = function twinkleunlinkCallbackEvaluate(event) const params = { reason: input.reason, unlinker: unlinker }; unlinker.run((pageName) => { const wikipedia_page = new Morebits.wiki.page(pageName, 'Unlinking in page "' + pageName + '"'); - wikipedia_page.setBotEdit(true); // unlink considered a floody operation + wikipedia_page.setBotEdit(true); // unlink considered a floody operation wikipedia_page.setCallbackParameters($.extend({ doBacklinks: input.backlinks.indexOf(pageName) !== -1, doImageusage: input.imageusage.indexOf(pageName) !== -1 @@ -298,5 +296,4 @@ Twinkle.unlink.callbacks = { Twinkle.addInitCallback(Twinkle.unlink, 'unlink'); }()); - // diff --git a/modules/twinklewarn.js b/modules/twinklewarn.js index 9bcdf8a59..3f470ee4a 100644 --- a/modules/twinklewarn.js +++ b/modules/twinklewarn.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinklewarn.js: Warn module @@ -115,13 +113,12 @@ Twinkle.warn.callback = function twinklewarnCallback() { id: 'twinkle-warn-warning-messages' }); - const more = form.append({ type: 'field', name: 'reasonGroup', label: 'Warning information' }); more.append({ type: 'textarea', label: 'Optional message:', name: 'reason', tooltip: 'Perhaps a reason, or that a more detailed notice must be appended' }); const previewlink = document.createElement('a'); $(previewlink).click(() => { - Twinkle.warn.callbacks.preview(result); // |result| is defined below + Twinkle.warn.callbacks.preview(result); // |result| is defined below }); previewlink.style.cursor = 'pointer'; previewlink.textContent = 'Preview'; @@ -196,7 +193,6 @@ Twinkle.warn.callback = function twinklewarnCallback() { } } - // We must init the first choice (General Note); const evt = document.createEvent('Event'); evt.initEvent('change', true, true); @@ -830,7 +826,7 @@ Twinkle.warn.messages = { } } }, - 'Other': { + Other: { 'uw-attempt': { level1: { label: 'Triggering the edit filter', @@ -1055,7 +1051,7 @@ Twinkle.warn.messages = { 'uw-bite': { label: '"Biting" newcomers', summary: 'Notice: "Biting" newcomers', - suppressArticleInSummary: true // non-standard (user name, not article), and not necessary + suppressArticleInSummary: true // non-standard (user name, not article), and not necessary }, 'uw-blar': { label: 'Article blanked and redirected', @@ -1332,7 +1328,7 @@ Twinkle.warn.messages = { }, 'uw-socksuspect': { label: 'Sockpuppetry', - summary: 'Warning: You are a suspected [[WP:SOCK|sockpuppet]]' // of User:... + summary: 'Warning: You are a suspected [[WP:SOCK|sockpuppet]]' // of User:... }, 'uw-upv': { label: 'Userpage vandalism', @@ -1341,7 +1337,7 @@ Twinkle.warn.messages = { 'uw-username': { label: 'Username is against policy', summary: 'Warning: Your username might be against policy', - suppressArticleInSummary: true // not relevant for this template + suppressArticleInSummary: true // not relevant for this template }, 'uw-coi-username': { label: 'Username is against policy, and conflict of interest', @@ -1526,7 +1522,6 @@ Twinkle.warn.callback.change_category = function twinklewarnCallbackChangeCatego Twinkle.warn.callback.postCategoryCleanup(e); }; - if (Twinkle.warn.talkpageObj) { autolevelProc(); } else { @@ -1972,7 +1967,7 @@ Twinkle.warn.callbacks = { if (messageData.suppressArticleInSummary !== true && params.article) { if (params.sub_group === 'uw-agf-sock' || params.sub_group === 'uw-socksuspect' || - params.sub_group === 'uw-aiv') { // these templates require a username + params.sub_group === 'uw-aiv') { // these templates require a username summary += ' of [[:User:' + params.article + ']]'; } else { summary += ' on [[:' + params.article + ']]'; @@ -1984,7 +1979,6 @@ Twinkle.warn.callbacks = { pageobj.setChangeTags(Twinkle.changeTags); pageobj.setWatchlist(Twinkle.getPref('watchWarnings')); - // Get actual warning text let warningText = Twinkle.warn.callbacks.getWarningWikitext(params.sub_group, params.article, params.reason, params.main_group === 'custom'); @@ -2062,5 +2056,4 @@ Twinkle.warn.callback.evaluate = function twinklewarnCallbackEvaluate(e) { Twinkle.addInitCallback(Twinkle.warn, 'warn'); }()); - // diff --git a/modules/twinklewelcome.js b/modules/twinklewelcome.js index 0c624b99b..94eed57b5 100644 --- a/modules/twinklewelcome.js +++ b/modules/twinklewelcome.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinklewelcome.js: Welcome module @@ -160,7 +158,7 @@ Twinkle.welcome.callback = function twinklewelcomeCallback(uid) { const previewlink = document.createElement('a'); $(previewlink).click(() => { - Twinkle.welcome.callbacks.preview(result); // |result| is defined below + Twinkle.welcome.callbacks.preview(result); // |result| is defined below }); previewlink.style.cursor = 'pointer'; previewlink.textContent = 'Preview'; @@ -203,8 +201,8 @@ Twinkle.welcome.populateWelcomeList = function(e) { name: 'template', list: $.map(templates, (properties, template) => ({ value: template, - label: '{{' + template + '}}: ' + properties.description + (properties.linkedArticle ? '\u00A0*' : ''), // U+00A0 NO-BREAK SPACE - tooltip: properties.tooltip // may be undefined + label: '{{' + template + '}}: ' + properties.description + (properties.linkedArticle ? '\u00A0*' : ''), // U+00A0 NO-BREAK SPACE + tooltip: properties.tooltip // may be undefined })), event: function(ev) { ev.target.form.article.disabled = !templates[ev.target.value].linkedArticle; @@ -233,7 +231,7 @@ Twinkle.welcome.populateWelcomeList = function(e) { Twinkle.welcome.templates = { standard: { 'General welcome templates': { - 'welcome': { + welcome: { description: 'standard welcome', linkedArticle: true, syntax: '{{subst:welcome|$USERNAME$|art=$ARTICLE$}} ~~~~' @@ -251,7 +249,7 @@ Twinkle.welcome.templates = { description: 'a welcome message with some helpful links and a plate of cookies', syntax: '{{subst:welcome cookie}} ~~~~' }, - 'welcoming': { + welcoming: { description: 'welcome message with tutorial links and basic editing tips', syntax: '{{subst:Welcoming}}' } @@ -316,31 +314,31 @@ Twinkle.welcome.templates = { linkedArticle: true, syntax: '{{subst:welcome-image|$USERNAME$|art=$ARTICLE$}}' }, - 'welcomelaws': { + welcomelaws: { description: 'welcome with information about copyrights, NPOV, the sandbox, and vandalism', syntax: '{{subst:welcomelaws|$USERNAME$}} ~~~~' }, - 'welcomenpov': { + welcomenpov: { description: 'for someone whose initial efforts do not adhere to the neutral point of view policy', linkedArticle: true, syntax: '{{subst:welcomenpov|$ARTICLE$|$USERNAME$}} ~~~~' }, - 'welcomeunsourced': { + welcomeunsourced: { description: 'for someone whose initial efforts are unsourced', linkedArticle: true, syntax: '{{subst:welcomeunsourced|$ARTICLE$|$USERNAME$}} ~~~~' }, - 'welcomevandal': { + welcomevandal: { description: 'for someone whose initial efforts appear to be vandalism', linkedArticle: true, syntax: '{{subst:welcomevandal|$ARTICLE$|$USERNAME$}}' }, - 'welcomespam': { + welcomespam: { description: 'welcome with additional discussion of anti-spamming policies', linkedArticle: true, syntax: '{{subst:welcomespam|$ARTICLE$|$USERNAME$}} ~~~~' }, - 'welcometest': { + welcometest: { description: 'for someone whose initial efforts appear to be tests', linkedArticle: true, syntax: '{{subst:welcometest|$ARTICLE$|$USERNAME$}} ~~~~' @@ -355,7 +353,7 @@ Twinkle.welcome.templates = { linkedArticle: true, syntax: '{{subst:welcome-unregistered|art=$ARTICLE$}} ~~~~' }, - 'thanks': { + thanks: { description: 'for unregistered users; short; encourages creating an account', linkedArticle: true, syntax: '== Welcome! ==\n{{subst:thanks|page=$ARTICLE$}} ~~~~' @@ -510,7 +508,7 @@ Twinkle.welcome.templates = { nonEnglish: { 'Non-English welcome templates': { - 'welcomeen': { + welcomeen: { description: 'welcome for users whose first language is not listed here', syntax: '{{subst:welcomeen}}' }, @@ -657,11 +655,11 @@ Twinkle.welcome.getTemplateWikitext = function(type, template, article) { } }); if (properties) { - return properties.syntax. - replace('$USERNAME$', Twinkle.getPref('insertUsername') ? mw.config.get('wgUserName') : ''). - replace('$ARTICLE$', article ? article : ''). - replace(/\$HEADER\$\s*/, '== Welcome ==\n\n'). - replace('$EXTRA$', ''); // EXTRA is not implemented yet + return properties.syntax + .replace('$USERNAME$', Twinkle.getPref('insertUsername') ? mw.config.get('wgUserName') : '') + .replace('$ARTICLE$', article ? article : '') + .replace(/\$HEADER\$\s*/, '== Welcome ==\n\n') + .replace('$EXTRA$', ''); // EXTRA is not implemented yet } return '{{subst:' + template + (article ? '|art=' + article : '') + '}}' + (Twinkle.getPref('customWelcomeSignature') ? ' ~~~~' : ''); @@ -752,5 +750,4 @@ Twinkle.welcome.callback.evaluate = function twinklewelcomeCallbackEvaluate(e) { Twinkle.addInitCallback(Twinkle.welcome, 'welcome'); }()); - // diff --git a/modules/twinklexfd.js b/modules/twinklexfd.js index 56ae17569..ff1190e26 100644 --- a/modules/twinklexfd.js +++ b/modules/twinklexfd.js @@ -1,9 +1,7 @@ // - (function() { - /* **************************************** *** twinklexfd.js: XFD module @@ -49,7 +47,6 @@ Twinkle.xfd = function twinklexfd() { Twinkle.addPortletLink(Twinkle.xfd.callback, 'XFD', 'tw-xfd', tooltip); }; - const utils = { /** Get ordinal number figure */ num2order: function(num) { @@ -84,7 +81,7 @@ const utils = { addNs: function(title, namespaceNumber) { const title_obj = mw.Title.newFromUserInput(title, namespaceNumber); if (!title_obj) { - return title; // user entered invalid input; do nothing + return title; // user entered invalid input; do nothing } return title_obj.toText(); }, @@ -137,25 +134,25 @@ Twinkle.xfd.callback = function twinklexfdCallback() { categories.append({ type: 'option', label: 'AfD (Articles for deletion)', - selected: namespace === 0, // Main namespace + selected: namespace === 0, // Main namespace value: 'afd' }); categories.append({ type: 'option', label: 'TfD (Templates for discussion)', - selected: [ 10, 828 ].indexOf(namespace) !== -1, // Template and module namespaces + selected: [ 10, 828 ].indexOf(namespace) !== -1, // Template and module namespaces value: 'tfd' }); categories.append({ type: 'option', label: 'FfD (Files for discussion)', - selected: namespace === 6, // File namespace + selected: namespace === 6, // File namespace value: 'ffd' }); categories.append({ type: 'option', label: 'CfD (Categories for discussion)', - selected: namespace === 14 || (namespace === 10 && /-stub$/.test(Morebits.pageNameNorm)), // Category namespace and stub templates + selected: namespace === 14 || (namespace === 10 && /-stub$/.test(Morebits.pageNameNorm)), // Category namespace and stub templates value: 'cfd' }); categories.append({ @@ -209,7 +206,7 @@ Twinkle.xfd.callback = function twinklexfdCallback() { const previewlink = document.createElement('a'); $(previewlink).click(() => { - Twinkle.xfd.callbacks.preview(result); // |result| is defined below + Twinkle.xfd.callbacks.preview(result); // |result| is defined below }); previewlink.style.cursor = 'pointer'; previewlink.textContent = 'Preview'; @@ -749,7 +746,6 @@ Twinkle.xfd.callback.change_category = function twinklexfdCallbackChangeCategory form.notifycreator.checked = !form.notifycreator.disabled; }; - Twinkle.xfd.callbacks = { // Requires having the tag text (params.tagText) set ahead of time autoEditRequest: function(pageobj, params) { @@ -768,7 +764,7 @@ Twinkle.xfd.callbacks = { talk_page.setNewSectionText(editRequest); talk_page.setCreateOption('recreate'); talk_page.setWatchlist(Twinkle.getPref('xfdWatchPage')); - talk_page.setFollowRedirect(true); // should never be needed, but if the article is moved, we would want to follow the redirect + talk_page.setFollowRedirect(true); // should never be needed, but if the article is moved, we would want to follow the redirect talk_page.setChangeTags(Twinkle.changeTags); talk_page.setCallbackParameters(params); talk_page.newSection(null, () => { @@ -1122,7 +1118,7 @@ Twinkle.xfd.callbacks = { // Tagging article const wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Adding deletion tag to article'); - wikipedia_page.setFollowRedirect(true); // should never be needed, but if the article is moved, we would want to follow the redirect + wikipedia_page.setFollowRedirect(true); // should never be needed, but if the article is moved, we would want to follow the redirect wikipedia_page.setChangeTags(Twinkle.changeTags); // Here to apply to triage wikipedia_page.setCallbackParameters(apiobj.params); wikipedia_page.load(Twinkle.xfd.callbacks.afd.taggingArticle); @@ -1216,7 +1212,7 @@ Twinkle.xfd.callbacks = { pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); pageobj.setCreateOption('createonly'); pageobj.save(() => { - Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki + Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki // Actions that should wait on the discussion page actually being created // and whose errors shouldn't output the user rationale @@ -1242,7 +1238,7 @@ Twinkle.xfd.callbacks = { if (!pageobj.exists()) { text = '{{subst:AfD log}}\n' + added_data; } else { - const old_text = pageobj.getPageText() + '\n'; // MW strips trailing blanks, but we like them, so we add a fake one + const old_text = pageobj.getPageText() + '\n'; // MW strips trailing blanks, but we like them, so we add a fake one text = old_text.replace(/(\n+)/, '$1' + added_data); if (text === old_text) { @@ -1272,7 +1268,6 @@ Twinkle.xfd.callbacks = { } }, - tfd: { main: function(pageobj) { const params = pageobj.getCallbackParameters(); @@ -1338,7 +1333,6 @@ Twinkle.xfd.callbacks = { Twinkle.xfd.callbacks.tfd.taggingTemplate(pageobj); } - // Updating data for the action completed event Morebits.wiki.actionCompleted.redirect = params.logpage; Morebits.wiki.actionCompleted.notice = "Nomination completed, now redirecting to today's log"; @@ -1477,12 +1471,11 @@ Twinkle.xfd.callbacks = { pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); pageobj.setCreateOption('recreate'); pageobj.save(() => { - Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki + Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki }); } }, - mfd: { main: function(apiobj) { const response = apiobj.getResponse(); @@ -1527,7 +1520,7 @@ Twinkle.xfd.callbacks = { // Tagging page if (mw.config.get('wgNamespaceNumber') !== 710) { // cannot tag TimedText pages wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Tagging page with deletion tag'); - wikipedia_page.setFollowRedirect(true); // should never be needed, but if the page is moved, we would want to follow the redirect + wikipedia_page.setFollowRedirect(true); // should never be needed, but if the page is moved, we would want to follow the redirect wikipedia_page.setCallbackParameters(apiobj.params); wikipedia_page.load(Twinkle.xfd.callbacks.mfd.taggingPage); } @@ -1593,7 +1586,7 @@ Twinkle.xfd.callbacks = { pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); pageobj.setCreateOption('createonly'); pageobj.save(() => { - Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki + Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki }); }, todaysList: function(pageobj) { @@ -1646,7 +1639,6 @@ Twinkle.xfd.callbacks = { } }, - ffd: { taggingImage: function(pageobj) { let text = pageobj.getPageText(); @@ -1664,7 +1656,7 @@ Twinkle.xfd.callbacks = { pageobj.setEditSummary('Listed for discussion at [[:' + params.discussionpage + ']].'); pageobj.setChangeTags(Twinkle.changeTags); pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); - pageobj.setCreateOption('recreate'); // it might be possible for a file to exist without a description page + pageobj.setCreateOption('recreate'); // it might be possible for a file to exist without a description page pageobj.save(); } else { Twinkle.xfd.callbacks.autoEditRequest(pageobj, params); @@ -1714,12 +1706,11 @@ Twinkle.xfd.callbacks = { pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); pageobj.setCreateOption('recreate'); pageobj.save(() => { - Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki + Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki }); } }, - cfd: { main: function(pageobj) { const params = pageobj.getCallbackParameters(); @@ -1789,7 +1780,7 @@ Twinkle.xfd.callbacks = { pageobj.setEditSummary(editsummary); pageobj.setChangeTags(Twinkle.changeTags); pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); - pageobj.setCreateOption('recreate'); // since categories can be populated without an actual page at that title + pageobj.setCreateOption('recreate'); // since categories can be populated without an actual page at that title pageobj.save(); } else { Twinkle.xfd.callbacks.autoEditRequest(pageobj, params); @@ -1821,12 +1812,11 @@ Twinkle.xfd.callbacks = { pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); pageobj.setCreateOption('recreate'); pageobj.save(() => { - Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki + Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki }); } }, - cfds: { taggingCategory: function(pageobj) { const text = pageobj.getPageText(); @@ -1842,7 +1832,7 @@ Twinkle.xfd.callbacks = { pageobj.setEditSummary('Listed for speedy renaming; see [[WP:CFDS|Categories for discussion/Speedy]].'); pageobj.setChangeTags(Twinkle.changeTags); pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); - pageobj.setCreateOption('recreate'); // since categories can be populated without an actual page at that title + pageobj.setCreateOption('recreate'); // since categories can be populated without an actual page at that title pageobj.save(() => { // No user notification for CfDS, so just add this nomination to the user's userspace log Twinkle.xfd.callbacks.addToLog(params, null); @@ -1870,12 +1860,11 @@ Twinkle.xfd.callbacks = { pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); pageobj.setCreateOption('recreate'); pageobj.save(() => { - Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki + Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki }); } }, - rfd: { // This gets called both on submit and preview to determine the redirect target findTarget: function(params, callback) { @@ -1995,7 +1984,7 @@ Twinkle.xfd.callbacks = { pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); pageobj.setCreateOption('recreate'); pageobj.save(() => { - Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki + Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki }); }, sendNotifications: function(pageobj) { @@ -2046,7 +2035,7 @@ Twinkle.xfd.callbacks = { pageobj.setCreateOption('recreate'); // since the talk page need not exist pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); pageobj.append(() => { - Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki + Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki // add this nomination to the user's userspace log Twinkle.xfd.callbacks.addToLog(params, null); }); @@ -2067,7 +2056,7 @@ Twinkle.xfd.callbacks = { pageobj.setEditSummary('Adding [[:' + Morebits.pageNameNorm + ']].'); pageobj.setChangeTags(Twinkle.changeTags); pageobj.save(() => { - Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki + Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki // add this nomination to the user's userspace log Twinkle.xfd.callbacks.addToLog(params, null); }); @@ -2138,7 +2127,7 @@ Twinkle.xfd.callback.evaluate = function(e) { wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Tagging template with deletion tag'); } } - wikipedia_page.setFollowRedirect(true); // should never be needed, but if the page is moved, we would want to follow the redirect + wikipedia_page.setFollowRedirect(true); // should never be needed, but if the page is moved, we would want to follow the redirect wikipedia_page.setCallbackParameters(params); wikipedia_page.load(Twinkle.xfd.callbacks.tfd.main); break; @@ -2181,13 +2170,13 @@ Twinkle.xfd.callback.evaluate = function(e) { // Used for customized actions in edit summaries and the notification template var summaryActions = { - 'cfd': 'deletion', + cfd: 'deletion', 'sfd-t': 'deletion', - 'cfm': 'merging', - 'cfr': 'renaming', + cfm: 'merging', + cfr: 'renaming', 'sfr-t': 'renaming', - 'cfs': 'splitting', - 'cfc': 'conversion' + cfs: 'splitting', + cfc: 'conversion' }; params.action = summaryActions[params.xfdcat]; @@ -2256,5 +2245,4 @@ Twinkle.xfd.callback.evaluate = function(e) { Twinkle.addInitCallback(Twinkle.xfd, 'xfd'); }()); - // diff --git a/morebits.js b/morebits.js index fbce84ca2..76f81ec37 100644 --- a/morebits.js +++ b/morebits.js @@ -33,12 +33,11 @@ * @namespace Morebits */ - (function() { /** @lends Morebits */ const Morebits = {}; -window.Morebits = Morebits; // allow global access +window.Morebits = Morebits; // allow global access /** * i18n support for strings in Morebits @@ -89,7 +88,6 @@ Morebits.i18n = { // shortcut const msg = Morebits.i18n.getMessage; - /** * Wiki-specific configurations for Morebits */ @@ -124,7 +122,6 @@ Morebits.l10n = { } }; - /** * Simple helper function to see what groups a user might belong. * @@ -176,7 +173,6 @@ Morebits.isPageRedirect = function() { */ Morebits.pageNameNorm = mw.config.get('wgPageName').replace(/_/g, ' '); - /** * Create a string for use in regex matching a page name. Accounts for * leading character's capitalization, underscores as spaces, and special @@ -288,7 +284,6 @@ Morebits.namespaceRegex = function(namespaces) { return regex; }; - /* **************** Morebits.quickForm **************** */ /** * Creation of simple and standard forms without much specific coding. @@ -431,7 +426,6 @@ Morebits.quickForm.element.prototype.render = function QuickFormElementRender(in return currentNode[0]; }; - /** @memberof Morebits.quickForm.element */ Morebits.quickForm.element.prototype.compute = function QuickFormElementCompute(data, in_id) { let node; @@ -951,7 +945,6 @@ Morebits.quickForm.element.generateTooltip = function QuickFormElementGenerateTo }); }; - // Some utility methods for manipulating quickForms after their creation: // (None of these work for "dyninput" type fields at present) @@ -1015,7 +1008,6 @@ Morebits.quickForm.getInputData = function(form) { return result; }; - /** * Returns all form elements with a given field name or ID. * @@ -1180,8 +1172,6 @@ Morebits.quickForm.setElementTooltipVisibility = function QuickFormSetElementToo $(Morebits.quickForm.getElementContainer(element)).find('.morebits-tooltipButton').toggle(visibility); }; - - /** * @external HTMLFormElement */ @@ -1413,7 +1403,6 @@ Morebits.ip = { } }; - /** * Helper functions to manipulate strings. * @@ -1575,7 +1564,6 @@ Morebits.string = { } }; - /** * Helper functions to manipulate arrays. * @@ -1612,7 +1600,6 @@ Morebits.array = { return arr.filter((item, idx) => arr.indexOf(item) !== idx); }, - /** * Break up an array into smaller arrays. * @@ -1723,7 +1710,6 @@ Morebits.select2 = { }; - /** * Temporarily hide a part of a string while processing the rest of it. * Used by {@link Morebits.wikitext.page#commentOutImage|Morebits.wikitext.page.commentOutImage}. @@ -1797,8 +1783,6 @@ Morebits.unbinder.getCallback = function UnbinderGetCallback(self) { }; }; - - /* **************** Morebits.date **************** */ /** * Create a date object with enhanced processing capabilities, a la @@ -1835,7 +1819,7 @@ Morebits.date = function() { if (!this._d) { // Try standard date - this._d = new (Function.prototype.bind.apply(Date, [Date].concat(args))); + this._d = new (Function.prototype.bind.apply(Date, [Date].concat(args)))(); } // Still no? @@ -2159,7 +2143,6 @@ Object.getOwnPropertyNames(Date.prototype).forEach((func) => { }; }); - /* **************** Morebits.wiki **************** */ /** * Various objects for wiki editing and API access, including @@ -2180,7 +2163,6 @@ Morebits.wiki.isPageRedirect = function wikipediaIsPageRedirect() { return Morebits.isPageRedirect(); }; - /* **************** Morebits.wiki.actionCompleted **************** */ /** * @memberof Morebits.wiki @@ -2266,7 +2248,6 @@ Morebits.wiki.removeCheckpoint = function() { } }; - /* **************** Morebits.wiki.api **************** */ /** * An easy way to talk to the MediaWiki API. Accepts either json or xml @@ -2331,11 +2312,11 @@ Morebits.wiki.api.prototype = { currentAction: '', onSuccess: null, onError: null, - parent: window, // use global context if there is no parent object + parent: window, // use global context if there is no parent object query: null, response: null, - responseXML: null, // use `response` instead; retained for backwards compatibility - statelem: null, // this non-standard name kept for backwards compatibility + responseXML: null, // use `response` instead; retained for backwards compatibility + statelem: null, // this non-standard name kept for backwards compatibility statusText: null, // result received from the API, normally "success" or "error" errorCode: null, // short text error code, if any, as documented in the MediaWiki API errorText: null, // full error description, if any @@ -2522,8 +2503,6 @@ Morebits.wiki.api.setApiUserAgent = function(ua) { morebitsWikiApiUserAgent = (ua ? ua + ' ' : '') + 'morebits.js ([[w:WT:TW]])'; }; - - /** * Change/revision tag applied to Morebits actions when no other tags are specified. * Unused by default per {@link https://en.wikipedia.org/w/index.php?oldid=970618849#Adding_tags_to_Twinkle_edits_and_actions|EnWiki consensus}. @@ -2534,7 +2513,6 @@ Morebits.wiki.api.setApiUserAgent = function(ua) { */ var morebitsWikiChangeTag = ''; - /** * Get a new CSRF token on encountering token errors. * @@ -2551,7 +2529,6 @@ Morebits.wiki.api.getToken = function() { return tokenApi.post().then((apiobj) => apiobj.response.query.tokens.csrftoken); }; - /* **************** Morebits.wiki.page **************** */ /** * Use the MediaWiki API to load a page and optionally edit it, move it, etc. @@ -2620,15 +2597,15 @@ Morebits.wiki.page = function(pageName, status) { pageExists: false, editSummary: null, changeTags: null, - testActions: null, // array if any valid actions + testActions: null, // array if any valid actions callbackParameters: null, statusElement: status instanceof Morebits.status ? status : new Morebits.status(status), // - edit pageText: null, - editMode: 'all', // save() replaces entire contents of the page by default - appendText: null, // can't reuse pageText for this because pageText is needed to follow a redirect - prependText: null, // can't reuse pageText for this because pageText is needed to follow a redirect + editMode: 'all', // save() replaces entire contents of the page by default + appendText: null, // can't reuse pageText for this because pageText is needed to follow a redirect + prependText: null, // can't reuse pageText for this because pageText is needed to follow a redirect newSectionText: null, newSectionTitle: null, createOption: null, @@ -2759,7 +2736,7 @@ Morebits.wiki.page = function(pageName, status) { }; if (ctx.editMode === 'all') { - ctx.loadQuery.rvprop = 'content|timestamp'; // get the page content at the same time, if needed + ctx.loadQuery.rvprop = 'content|timestamp'; // get the page content at the same time, if needed } else if (ctx.editMode === 'revert') { ctx.loadQuery.rvprop = 'timestamp'; ctx.loadQuery.rvlimit = 1; @@ -2767,7 +2744,7 @@ Morebits.wiki.page = function(pageName, status) { } if (ctx.followRedirect) { - ctx.loadQuery.redirects = ''; // follow all redirects + ctx.loadQuery.redirects = ''; // follow all redirects } if (typeof ctx.pageSection === 'number') { ctx.loadQuery.rvsection = ctx.pageSection; @@ -2863,7 +2840,7 @@ Morebits.wiki.page = function(pageName, status) { if (ctx.minorEdit) { query.minor = true; } else { - query.notminor = true; // force Twinkle config to override user preference setting for "all edits are minor" + query.notminor = true; // force Twinkle config to override user preference setting for "all edits are minor" } // Set bot edit attribute. If this parameter is present with any value, it is interpreted as true @@ -2878,7 +2855,7 @@ Morebits.wiki.page = function(pageName, status) { ctx.onSaveFailure(this); return; } - query.appendtext = ctx.appendText; // use mode to append to current page contents + query.appendtext = ctx.appendText; // use mode to append to current page contents break; case 'prepend': if (ctx.prependText === null) { @@ -2886,7 +2863,7 @@ Morebits.wiki.page = function(pageName, status) { ctx.onSaveFailure(this); return; } - query.prependtext = ctx.prependText; // use mode to prepend to current page contents + query.prependtext = ctx.prependText; // use mode to prepend to current page contents break; case 'new': if (!ctx.newSectionText) { // API doesn't allow empty new section text @@ -2895,7 +2872,7 @@ Morebits.wiki.page = function(pageName, status) { return; } query.section = 'new'; - query.text = ctx.newSectionText; // add a new section to current page + query.text = ctx.newSectionText; // add a new section to current page query.sectiontitle = ctx.newSectionTitle || ctx.editSummary; // done by the API, but non-'' values would get treated as text break; case 'revert': @@ -3034,8 +3011,6 @@ Morebits.wiki.page = function(pageName, status) { ctx.newSectionTitle = newSectionTitle; }; - - // Edit-related setter methods: /** * Set the edit summary that will be used when `save()` is called. @@ -3059,7 +3034,6 @@ Morebits.wiki.page = function(pageName, status) { ctx.changeTags = tags; }; - /** * @param {string} [createOption=null] - Can take the following four values: * - recreate: create the page if it does not exist, or edit it if it exists. @@ -3496,7 +3470,7 @@ Morebits.wiki.page = function(pageName, status) { } if (ctx.followRedirect) { - query.redirects = ''; // follow all redirects + query.redirects = ''; // follow all redirects } ctx.lookupCreationApi = new Morebits.wiki.api(msg('getting-creator', 'Retrieving page creation information'), query, fnLookupCreationSuccess, ctx.statusElement, ctx.onLookupCreationFailure); @@ -3861,7 +3835,7 @@ Morebits.wiki.page = function(pageName, status) { ctx.pageText = rev.content; ctx.pageID = page.pageid; } else { - ctx.pageText = ''; // allow for concatenation, etc. + ctx.pageText = ''; // allow for concatenation, etc. ctx.pageID = 0; // nonexistent in response, matches wgArticleId } ctx.csrfToken = response.tokens.csrftoken; @@ -3910,7 +3884,7 @@ Morebits.wiki.page = function(pageName, status) { } ctx.revertUser = rev && rev.user; if (!ctx.revertUser) { - if (rev && rev.userhidden) { // username was RevDel'd or oversighted + if (rev && rev.userhidden) { // username was RevDel'd or oversighted ctx.revertUser = '