Skip to content

Commit

Permalink
fixed indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
RustyCat-1 committed Oct 16, 2024
1 parent f16852c commit 533633c
Showing 1 changed file with 50 additions and 56 deletions.
106 changes: 50 additions & 56 deletions modules/twinklespeedy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@


/*
****************************************
*** twinklespeedy.js: CSD module
****************************************
* Mode of invocation: Tab ("CSD")
* Active on: Non-special, existing pages
*
* NOTE FOR DEVELOPERS:
* If adding a new criterion, add it to the appropriate places at the top of
* twinkleconfig.js. Also check out the default values of the CSD preferences
* in twinkle.js, and add your new criterion to those if you think it would be
* good.
*/
****************************************
*** twinklespeedy.js: CSD module
****************************************
* Mode of invocation: Tab ("CSD")
* Active on: Non-special, existing pages
*
* NOTE FOR DEVELOPERS:
* If adding a new criterion, add it to the appropriate places at the top of
* twinkleconfig.js. Also check out the default values of the CSD preferences
* in twinkle.js, and add your new criterion to those if you think it would be
* good.
*/

Twinkle.speedy = function twinklespeedy() {
// Disable on:
Expand Down Expand Up @@ -173,7 +173,7 @@ Twinkle.speedy.initDialog = function twinklespeedyInitDialog(callbackfunc) {
value: 'notify',
name: 'notify',
tooltip: 'A notification template will be placed on the talk page of the creator, IF you have a notification enabled in your Twinkle preferences ' +
'for the criterion you choose AND this box is checked. The creator may be welcomed as well.',
'for the criterion you choose AND this box is checked. The creator may be welcomed as well.',
checked: !Morebits.userIsSysop || !(Twinkle.speedy.hasCSD || Twinkle.getPref('deleteSysopDefaultToDelete')),
event: function(event) {
event.stopPropagation();
Expand Down Expand Up @@ -700,21 +700,15 @@ Twinkle.speedy.categoryList = [
tooltip: 'Categories that have been unpopulated for at least seven days. This does not apply to categories being discussed at WP:CFD, disambiguation categories, and certain other exceptions. If the category isn\'t relatively new, it possibly contained articles earlier, and deeper investigation is needed'
},
{
label: 'G8: Categories populated by a deleted or retargeted template',
value: 'templatecat',
tooltip: 'This is for situations where a category is effectively empty, because the template(s) that formerly placed pages in that category are now deleted. This excludes categories that are still in use.',
label: 'C4: Permanently unused maintenance categories',
value: 'c4',
tooltip: 'Unused maintenance categories, such as empty dated maintenance categories for dates in the past, tracking categories no longer used by a template after a rewrite, or empty subcategories of Category:Wikipedia sockpuppets or Category:Suspected Wikipedia sockpuppets. Empty maintenance categories are not necessarily unused—this criterion is for categories which will always be empty, not just currently empty.',
subgroup: {
name: 'templatecat_rationale',
name: 'c4_rationale',
type: 'input',
label: 'Optional explanation:',
size: 60
}
},
{
label: 'G8: Redirects to non-existent targets',
value: 'redirnone',
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
}
];

Expand All @@ -738,9 +732,9 @@ Twinkle.speedy.userList = [
tooltip: 'User pages of users that do not exist (Check Special:Listusers)'
},
{
label: 'U5: WP:NOTWEBHOST violations by a non-contributor',
label: 'U5: Blatant WP:NOTWEBHOST violations',
value: 'notwebhost',
tooltip: 'Pages in userspace consisting of writings, information, discussions, or activities not closely related to Wikipedia\'s goals, where the owner has made few or no edits outside of user pages, except for plausible drafts and pages adhering to WP:UPYES. It applies regardless of the age of the page in question.',
tooltip: 'Pages in userspace consisting of writings, information, discussions, or activities not closely related to Wikipedia\'s goals, where the owner has made few or no edits o utside of user pages, except for plausible drafts and pages adhering to WP:UPYES. It applies regardless of the age of the page in question.',
hideWhenRedirect: true
},
{
Expand Down Expand Up @@ -1019,7 +1013,6 @@ Twinkle.speedy.normalizeHash = {
'talk': 'g8',
'subpage': 'g8',
'redirnone': 'g8',
'templatecat': 'g8',
'imagepage': 'g8',
'attack': 'g10',
'negublp': 'g10',
Expand Down Expand Up @@ -1058,6 +1051,7 @@ Twinkle.speedy.normalizeHash = {
'imgcopyvio': 'f9',
'nopermission': 'f11',
'catempty': 'c1',
'c4': 'c4',
'userreq': 'u1',
'nouser': 'u2',
'notwebhost': 'u5'
Expand Down Expand Up @@ -1132,17 +1126,17 @@ Twinkle.speedy.callbacks = {
Morebits.status.warn('You (' + initialContrib + ') created this page; skipping user notification');
initialContrib = null;

// don't notify users when their user talk page is nominated/deleted
// don't notify users when their user talk page is nominated/deleted
} else if (initialContrib === mw.config.get('wgTitle') && mw.config.get('wgNamespaceNumber') === 3) {
Morebits.status.warn('Notifying initial contributor: this user created their own user talk page; skipping notification');
initialContrib = null;

// quick hack to prevent excessive unwanted notifications, per request. Should actually be configurable on recipient page...
// quick hack to prevent excessive unwanted notifications, per request. Should actually be configurable on recipient page...
} else if ((initialContrib === 'Cyberbot I' || initialContrib === 'SoxBot') && params.normalizeds[0] === 'f2') {
Morebits.status.warn('Notifying initial contributor: page created procedurally by bot; skipping notification');
initialContrib = null;

// Check for already existing tags
// Check for already existing tags
} else if (Twinkle.speedy.hasCSD && params.warnUser && !confirm('The page is has a deletion-related tag, and thus the creator has likely been notified. Do you want to notify them for this deletion as well?')) {
Morebits.status.info('Notifying initial contributor', 'canceled by user; skipping notification.');
initialContrib = null;
Expand Down Expand Up @@ -1260,8 +1254,8 @@ Twinkle.speedy.callbacks = {
deleteTalk: function(params) {
// delete talk page
if (params.deleteTalkPage &&
params.normalized !== 'f8' &&
!document.getElementById('ca-talk').classList.contains('new')) {
params.normalized !== 'f8' &&
!document.getElementById('ca-talk').classList.contains('new')) {
var talkpage = new Morebits.wiki.page(mw.config.get('wgFormattedNamespaces')[mw.config.get('wgNamespaceNumber') + 1] + ':' + mw.config.get('wgTitle'), 'Deleting talk page');
talkpage.setEditSummary('[[WP:CSD#G8|G8]]: Talk page of deleted page "' + Morebits.pageNameNorm + '"');
talkpage.setChangeTags(Twinkle.changeTags);
Expand Down Expand Up @@ -1502,7 +1496,7 @@ Twinkle.speedy.callbacks = {
var thispage = new Morebits.wiki.page(Morebits.pageNameNorm);
thispage.setCallbackParameters(params);
thispage.lookupCreation(Twinkle.speedy.callbacks.noteToCreator);
// or, if not notifying, add this nomination to the user's userspace log without the initial contributor's name
// or, if not notifying, add this nomination to the user's userspace log without the initial contributor's name
} else if (params.lognomination) {
Twinkle.speedy.callbacks.user.addToLog(params, null);
}
Expand All @@ -1511,19 +1505,19 @@ Twinkle.speedy.callbacks = {
addToLog: function(params, initialContrib) {
var usl = new Morebits.userspaceLogger(Twinkle.getPref('speedyLogPageName'));
usl.initialText =
"This is a log of all [[WP:CSD|speedy deletion]] nominations made by this user using [[WP:TW|Twinkle]]'s CSD module.\n\n" +
'If you no longer wish to keep this log, you can turn it off using the [[Wikipedia:Twinkle/Preferences|preferences panel]], and ' +
'nominate this page for speedy deletion under [[WP:CSD#U1|CSD U1]].' +
(Morebits.userIsSysop ? '\n\nThis log does not track outright speedy deletions made using Twinkle.' : '');
"This is a log of all [[WP:CSD|speedy deletion]] nominations made by this user using [[WP:TW|Twinkle]]'s CSD module.\n\n" +
'If you no longer wish to keep this log, you can turn it off using the [[Wikipedia:Twinkle/Preferences|preferences panel]], and ' +
'nominate this page for speedy deletion under [[WP:CSD#U1|CSD U1]].' +
(Morebits.userIsSysop ? '\n\nThis log does not track outright speedy deletions made using Twinkle.' : '');

var formatParamLog = function(normalize, csdparam, input) {
if ((normalize === 'G4' && csdparam === 'xfd') ||
(normalize === 'G6' && csdparam === 'page') ||
(normalize === 'G6' && csdparam === 'fullvotepage') ||
(normalize === 'G6' && csdparam === 'sourcepage') ||
(normalize === 'A2' && csdparam === 'source') ||
(normalize === 'A10' && csdparam === 'article') ||
(normalize === 'F1' && csdparam === 'filename')) {
(normalize === 'G6' && csdparam === 'page') ||
(normalize === 'G6' && csdparam === 'fullvotepage') ||
(normalize === 'G6' && csdparam === 'sourcepage') ||
(normalize === 'A2' && csdparam === 'source') ||
(normalize === 'A10' && csdparam === 'article') ||
(normalize === 'F1' && csdparam === 'filename')) {
input = '[[:' + input + ']]';
} else if (normalize === 'G5' && csdparam === 'user') {
input = '[[:User:' + input + ']]';
Expand Down Expand Up @@ -1624,7 +1618,7 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values)
if (form['csd.userreq_rationale']) {
var u1rationale = form['csd.userreq_rationale'].value;
if (mw.config.get('wgNamespaceNumber') === 3 && !(/\//).test(mw.config.get('wgTitle')) &&
(!u1rationale || !u1rationale.trim())) {
(!u1rationale || !u1rationale.trim())) {
alert('CSD U1: Please specify a rationale when nominating user talk pages.');
parameters = null;
return false;
Expand Down Expand Up @@ -1718,12 +1712,6 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values)
}
break;

case 'templatecat': // G8
if (form['csd.templatecat_rationale'] && form['csd.templatecat_rationale'].value) {
currentParams.rationale = form['csd.templatecat_rationale'].value;
}
break;

case 'attack': // G10
currentParams.blanked = 'yes';
// it is actually blanked elsewhere in code, but setting the flag here
Expand Down Expand Up @@ -1814,6 +1802,12 @@ Twinkle.speedy.getParameters = function twinklespeedyGetParameters(form, values)
}
break;

case 'c4': // C4
if (form['csd.c4_rationale'] && form['csd.c4_rationale'].value) {
currentParams.rationale = form['csd.c4_rationale'].value;
}
break;

default:
break;
}
Expand Down Expand Up @@ -1871,9 +1865,9 @@ Twinkle.speedy.getUserTalkParameters = function twinklespeedyGetUserTalkParamete
};

/**
* @param {Event} e
* @returns {Array}
*/
* @param {Event} e
* @returns {Array}
*/
Twinkle.speedy.resolveCsdValues = function twinklespeedyResolveCsdValues(e) {
var values = (e.target.form ? e.target.form : e.target).getChecked('csd');
if (values.length === 0) {
Expand All @@ -1887,7 +1881,7 @@ Twinkle.speedy.callback.evaluateSysop = function twinklespeedyCallbackEvaluateSy
var form = e.target.form ? e.target.form : e.target;

if (e.target.type === 'checkbox' || e.target.type === 'text' ||
e.target.type === 'select') {
e.target.type === 'select') {
return;
}

Expand Down Expand Up @@ -1923,7 +1917,7 @@ Twinkle.speedy.callback.evaluateSysop = function twinklespeedyCallbackEvaluateSy

var warnusertalk = form.warnusertalk.checked && normalizeds.some(function (norm, index) {
return Twinkle.getPref('warnUserOnSpeedyDelete').indexOf(norm) !== -1 &&
!(norm === 'g6' && values[index] !== 'copypaste');
!(norm === 'g6' && values[index] !== 'copypaste');
});

var welcomeuser = warnusertalk && normalizeds.some(function (norm) {
Expand Down Expand Up @@ -1952,7 +1946,7 @@ Twinkle.speedy.callback.evaluateUser = function twinklespeedyCallbackEvaluateUse
var form = e.target.form ? e.target.form : e.target;

if (e.target.type === 'checkbox' || e.target.type === 'text' ||
e.target.type === 'select') {
e.target.type === 'select') {
return;
}

Expand All @@ -1978,7 +1972,7 @@ Twinkle.speedy.callback.evaluateUser = function twinklespeedyCallbackEvaluateUse

var notifyuser = form.notify.checked && normalizeds.some(function(norm, index) {
return Twinkle.getPref('notifyUserOnSpeedyDeletionNomination').indexOf(norm) !== -1 &&
!(norm === 'g6' && values[index] !== 'copypaste');
!(norm === 'g6' && values[index] !== 'copypaste');
});
var welcomeuser = notifyuser && normalizeds.some(function(norm) {
return Twinkle.getPref('welcomeUserOnSpeedyDeletionNotification').indexOf(norm) !== -1;
Expand Down

0 comments on commit 533633c

Please sign in to comment.