மீடியாவிக்கி:Gadget-twinkleconfig.js: திருத்தங்களுக்கு இடையிலான வேறுபாடு

உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
Shanmugamp7 (பேச்சு | பங்களிப்புகள்)
சி Shanmugamp7 (Talk) பயனரால் செய்யப்பட்ட திருத்தம் 3107223 இல்லாது செய்யப்பட்டது
Shanmugamp7 (பேச்சு | பங்களிப்புகள்)
Shanmugamp7 (Talk) பயனரால் செய்யப்பட்ட திருத்தம் 3108317 இல்லாது செய்யப்பட்டது
 
வரிசை 1:
// <nowiki>
 
 
(function($) {
 
 
வரிசை 9:
*** twinkleconfig.js: Preferences module
****************************************
* Mode of invocation: Adds configuration form to Wikipedia:Twinkle/Preferences and user,
subpages named "/Twinkle preferences", and adds an ad box to the top of user subpages belonging to the
subpages belonging to the currently logged-in user which end in '.js'
* Active on: What I just said. Yeah.
* Config directives in: TwinkleConfig
 
I, [[User:This, that and the other]], originally wrote this. If the code is misbehaving, or you have any
வரி 23 ⟶ 22:
Twinkle.config = {};
 
Twinkle.config.watchlistEnums = { yes: 'Add to watchlist', no: "Don't add to watchlist", 'default': 'Follow your site preferences' };
Twinkle.config.commonEnums = {
watchlist: { yes: "Add to watchlist", no: "Don't add to watchlist", "default": "Follow your site preferences" },
talkPageMode: { window: "In a window, replacing other user talks", tab: "In a new tab", blank: "In a totally new window" }
};
 
Twinkle.config.commonSets = {
csdCriteria: {
db: "'Custom rationale ({{db}})"',
g1: "'G1"', g2: "'G2"', g3: "'G3"', g4: "'G4"', g5: "'G5"', g6: "'G6"', g7: "'G7"', g8: "'G8"', g10: "'G10"', g11: "'G11"', g12: "'G12"', g13: "'G13"', g14: 'G14',
a1: "'A1"', a2: "'A2"', a3: "'A3"', a5: "'A5"', a7: "'A7"', a9: "'A9"', a10: "'A10"', a11: "'A11"',
u1: "'U1"', u2: "'U2"', u3: "'U3"', u5: "'U5"',
f1: "'F1"', f2: "'F2"', f3: "'F3"', f7: "'F7"', f8: "'F8"', f9: "'F9"', f10: "'F10"',
c1: "'C1"',
t2: "'T2"', t3: "'T3"',
r2: "'R2"', r3: "'R3"', r4: 'R4',
p1: "'P1"', p2: "'P2"'
},
csdCriteriaDisplayOrder: [
"'db"',
"'g1"', "'g2"', "'g3"', "'g4"', "'g5"', "'g6"', "'g7"', "'g8"', "'g10"', "'g11"', "'g12"', "'g13"', 'g14',
"'a1"', "'a2"', "'a3"', "'a5"', "'a7"', "'a9"', "'a10"', "'a11"',
"'u1"', "'u2"', "'u3"', "'u5"',
"'f1"', "'f2"', "'f3"', "'f7"', "'f8"', "'f9"', "'f10"',
"'c1"',
"'t2"', "'t3"',
"'r2"', "'r3"', 'r4',
"'p1"', "'p2"'
],
csdCriteriaNotification: {
db: "'Custom rationale ({{db}})"',
g1: "'G1"', g2: "'G2"', g3: "'G3"', g4: "'G4"', g6: 'G6 ("unnecessary disambig." and "copy-paste move" only)',
g10: "'G10"', g11: "'G11"', g12: "'G12"', g13: "'G13"', g14: 'G14',
a1: "'A1"', a2: "'A2"', a3: "'A3"', a5: "'A5"', a7: "'A7"', a9: "'A9"', a10: "'A10"', a11: "'A11"',
u3: "'U3"', u5: "'U5"',
f1: "'F1"', f2: "'F2"', f3: "'F3"', f7: "'F7", f8: "F8"', f9: "'F9"', f10: "'F10"',
c1: "'C1"',
t2: "'T2"', t3: "'T3"',
r2: "'R2"', r3: "'R3"', r4: 'R4',
p1: "'P1"', p2: "'P2"'
},
csdCriteriaNotificationDisplayOrder: [
"'db"',
"'g1"', "'g2"', "'g3"', "'g4"', "'g6"', "'g10"', "'g11"', "'g12"', "'g13"', 'g14',
"'a1"', "'a2"', "'a3"', "'a5"', "'a7"', "'a9"', "'a10"', "'a11"',
"'u3"', "'u5"',
"'f1"', "'f2"', "'f3"', "'f7"', "'f9"', "'f10"',
"'c1"',
"'t2"', "'t3"',
"'r2"', "'r3"', 'r4',
"'p1"', "'p2"'
],
csdAndDICriteria: {
db: "'Custom rationale ({{db}})"',
g1: "'G1"', g2: "'G2"', g3: "'G3"', g4: "'G4"', g5: "'G5"', g6: "'G6"', g7: "'G7"', g8: "'G8"', g10: "'G10"', g11: "'G11"', g12: "'G12"', g13: "'G13"', g14: 'G14',
a1: "'A1"', a2: "'A2"', a3: "'A3"', a5: "'A5"', a7: "'A7"', a9: "'A9"', a10: "'A10"', a11: "'A11"',
u1: "'U1"', u2: "'U2"', u3: "'U3"', u5: "'U5"',
f1: "'F1"', f2: "'F2"', f3: "'F3"', f4: "'F4"', f5: "'F5"', f6: "'F6"', f7: "'F7"', f8: "'F8"', f9: "'F9"', f10: "'F10"', f11: "'F11"',
c1: "'C1"',
t2: "'T2"', t3: "'T3"',
r2: "'R2"', r3: "'R3"', r4: 'R4',
p1: "'P1"', p2: "'P2"'
},
csdAndDICriteriaDisplayOrder: [
"'db"',
"'g1"', "'g2"', "'g3"', "'g4"', "'g5"', "'g6"', "'g7"', "'g8"', "'g10"', "'g11"', "'g12"', "'g13"', 'g14',
"'a1"', "'a2"', "'a3"', "'a5"', "'a7"', "'a9"', "'a10"', "'a11"',
"'u1"', "'u2"', "'u3"', "'u5"',
"'f1"', "'f2"', "'f3"', "'f4"', "'f5"', "'f6"', "'f7"', "'f8"', "'f9"', "'f10"', "'f11"',
"'c1"',
"'t2"', "'t3"',
"'r2"', "'r3"', 'r4',
"'p1"', "'p2"'
],
namespacesNoSpecial: {
"'0"': "'Article"',
"'1"': "'Talk (article)"',
"'2"': "'User"',
"'3"': "'User talk"',
"'4"': "'Wikipedia"',
"'5"': "'Wikipedia talk"',
"'6"': "'File"',
"'7"': "'File talk"',
"'8"': "'MediaWiki"',
"'9"': "'MediaWiki talk"',
"'10"': "'Template"',
"'11"': "'Template talk"',
"'12"': "'Help"',
"'13"': "'Help talk"',
"'14"': "'Category"',
"'15"': "'Category talk"',
"'100"': "'Portal"',
"'101"': "'Portal talk"',
"'108"': "'Book"',
"'109"': "'Book talk"',
"'118"': "'Draft"',
"'119"': "'Draft talk"',
"'710"': "'TimedText"',
"'711"': "'TimedText talk"',
"'828"': "'Module"',
"'829"': "'Module talk"'
}
};
வரி 133 ⟶ 129:
* adminOnly: <true for admin-only sections>,
* hidden: <true for advanced preferences that rarely need to be changed - they can still be modified by manually editing twinkleoptions.js>,
* inFriendlyConfig: <true for preferences located under FriendlyConfig rather than TwinkleConfig>,
* preferences: [
* {
வரி 155 ⟶ 150:
 
Twinkle.config.sections = [
{
title: "'General"',
preferences: [
// TwinkleConfig.summaryAd (string)
// Text to be appended to the edit summary of edits made using Twinkle
{
name: "'summaryAd"',
label: "\"Ad\" to be appended to Twinkle's edit summaries",
helptip: "'The summary ad should start with a space, and be kept short."',
type: "'string"'
},
 
// TwinkleConfig.deletionSummaryAd (string)
// Text to be appended to the edit summary of deletions made using Twinkle
{
name: "'deletionSummaryAd"',
label: "'Summary ad to use for deletion summaries"',
helptip: "'Normally the same as the edit summary ad above."',
adminOnly: true,
type: "'string"'
},
 
// TwinkleConfig.protectionSummaryAd (string)
// Text to be appended to the edit summary of page protections made using Twinkle
{
name: "'protectionSummaryAd"',
label: "'Summary ad to use for page protections"',
helptip: "'Normally the same as the edit summary ad above."',
adminOnly: true,
type: "'string"'
},
 
// TwinkleConfig.userTalkPageMode may take arguments:
// 'window': open a new window, remember the opened window
// 'tab': opens in a new tab, if possible.
// 'blank': force open in a new window, even if such a window exists
{
name: "'userTalkPageMode"',
label: "'When opening a user talk page, open it"',
type: "'enum"',
enumValues: { window: 'In a window, replacing other user talks', tab: 'In a new tab', blank: 'In a totally new window' }
enumValues: Twinkle.config.commonEnums.talkPageMode
},
 
// TwinkleConfig.dialogLargeFont (boolean)
{
name: "'dialogLargeFont"',
label: "'Use larger text in Twinkle dialogs"',
type: "'boolean"'
},
]
},
 
// Twinkle.config.disabledModules (array)
{
{
title: "ARV",
name: 'disabledModules',
preferences: [
label: 'Turn off the selected Twinkle modules',
{
helptip: 'Anything you select here will NOT be available for use, so act with care. Uncheck to reactivate.',
name: "spiWatchReport",
type: 'set',
label: "Add sockpuppet report pages to watchlist",
setValues: { arv: 'ARV', warn: 'Warn', welcome: 'Welcome', shared: 'Shared IP', talkback: 'Talkback', speedy: 'CSD', prod: 'PROD', xfd: 'XfD', image: 'Image (DI)', protect: 'Protect (RPP)', tag: 'Tag', diff: 'Diff', unlink: 'Unlink', 'fluff': 'Revert and rollback' }
type: "enum",
},
enumValues: Twinkle.config.commonEnums.watchlist
}
]
},
 
// Twinkle.config.disabledSysopModules (array)
{
{
title: "Block user",
name: 'disabledSysopModules',
adminOnly: true,
label: 'Turn off the selected admin-only modules',
preferences: [
helptip: 'Anything you select here will NOT be available for use, so act with care. Uncheck to reactivate.',
// TwinkleConfig.blankTalkpageOnIndefBlock (boolean)
adminOnly: true,
// if true, blank the talk page when issuing an indef block notice (per [[WP:UW#Indefinitely blocked users]])
type: 'set',
{
setValues: { block: 'Block', deprod: 'DePROD', batchdelete: 'D-batch', batchprotect: 'P-batch', batchundelete: 'Und-batch' }
name: "blankTalkpageOnIndefBlock",
}
label: "Blank the talk page when indefinitely blocking users",
]
helptip: "See <a href=\"" + mw.util.getUrl("WP:UW#Indefinitely blocked users") + "\">WP:UW</a> for more information.",
},
type: "boolean"
}
]
},
 
{
title: "Image deletion (DI)"'ARV',
preferences: [
{
// TwinkleConfig.notifyUserOnDeli (boolean)
name: 'spiWatchReport',
// If the user should be notified after placing a file deletion tag
label: 'Add sockpuppet report pages to watchlist',
{
name type: "notifyUserOnDeli"'enum',
enumValues: Twinkle.config.watchlistEnums
label: "Check the \"notify initial uploader\" box by default",
}
type: "boolean"
},]
},
 
{
// TwinkleConfig.deliWatchPage (string)
title: 'Block user',
// The watchlist setting of the page tagged for deletion. Either "yes", "no", or "default". Default is "default" (Duh).
adminOnly: true,
{
preferences: [
name: "deliWatchPage",
// TwinkleConfig.defaultToPartialBlocks (boolean)
label: "Add image page to watchlist when tagging",
// Whether to default partial blocks on or off
type: "enum",
{
enumValues: Twinkle.config.commonEnums.watchlist
name: 'defaultToPartialBlocks',
},
label: 'Select partial blocks by default when opening the block menu',
type: 'boolean'
},
 
// TwinkleConfig.deliWatchUserblankTalkpageOnIndefBlock (stringboolean)
// if true, blank the talk page when issuing an indef block notice (per [[WP:UWUL#Indefinitely blocked users]])
// The watchlist setting of the user talk page if a notification is placed. Either "yes", "no", or "default". Default is "default" (Duh).
{
name: "deliWatchUser"'blankTalkpageOnIndefBlock',
label: "Add'Blank userthe talk page ofwhen initialindefinitely uploader to watchlist whenblocking notifying"users',
helptip: 'See <a href="' + mw.util.getUrl('Wikipedia:WikiProject_User_warnings/Usage_and_layout#Indefinitely_blocked_users') + '">WP:UWUL</a> for more information.',
type: "enum",
type: 'boolean'
enumValues: Twinkle.config.commonEnums.watchlist
}
]
},
 
{
title: "Proposed'Image deletion (PRODDI)"',
preferences: [
// TwinkleConfig.watchProdPagesnotifyUserOnDeli (boolean)
// If the user should be notified after placing a file deletion tag
// If, when applying prod template to page, to watch the page
{
name: "watchProdPages"'notifyUserOnDeli',
label: 'Check the "Addnotify articleinitial touploader" watchlistbox whenby tagging"default',
type: "'boolean"'
},
 
// TwinkleConfig.prodReasonDefaultdeliWatchPage (string)
// The watchlist setting of the page tagged for deletion. Either "yes", "no", or "default". Default is "default" (Duh).
// The prefilled PROD reason.
{
name: "prodReasonDefault"'deliWatchPage',
label: "Prefilled'Add PRODimage reason"page to watchlist when tagging',
type: "string"'enum',
enumValues: Twinkle.config.watchlistEnums
},
},
 
// TwinkleConfig.deliWatchUser (string)
{
// The watchlist setting of the user talk page if a notification is placed. Either "yes", "no", or "default". Default is "default" (Duh).
name: "logProdPages",
{
label: "Keep a log in userspace of all pages you tag for PROD",
name: 'deliWatchUser',
helptip: "Since non-admins do not have access to their deleted contributions, the userspace log offers a good way to keep track of all pages you tag for PROD using Twinkle.",
label: 'Add user talk page of initial uploader to watchlist when notifying',
type: "boolean"
type: 'enum',
},
enumValues: Twinkle.config.watchlistEnums
{
}
name: "prodLogPageName",
]
label: "Keep the PROD userspace log at this user subpage",
},
helptip: "Enter a subpage name in this box. You will find your PROD log at User:<i>username</i>/<i>subpage name</i>. Only works if you turn on the PROD userspace log.",
type: "string"
}
]
},
 
{
title: 'Proposed deletion (PROD)',
title: "Revert and rollback", // twinklefluff module
preferences: [
// TwinkleConfig.openTalkPagewatchProdPages (arrayboolean)
// WhatIf, typeswhen ofapplying actionsprod thattemplate shouldto resultpage, into openingwatch of talkthe page
{
name: "openTalkPage"'watchProdPages',
label: "Open'Add userarticle talkto pagewatchlist afterwhen these types of reversions"tagging',
type: "set",'boolean'
},
setValues: { agf: "AGF rollback", norm: "Normal rollback", vand: "Vandalism rollback", torev: "\"Restore this version\"" }
},
 
// TwinkleConfig.openTalkPageOnAutoRevertmarkProdPagesAsPatrolled (boolboolean)
// If, when applying prod template to page, to mark the page as curated/patrolled (if the page was reached from NewPages)
// Defines if talk page should be opened when calling revert from contrib page, because from there, actions may be multiple, and opening talk page not suitable. If set to true, openTalkPage defines then if talk page will be opened.
{
name: "openTalkPageOnAutoRevert"'markProdPagesAsPatrolled',
label: "Open'Mark userpage talkas pagepatrolled/reviewed when invoking rollback fromtagging user(if contributions"possible)',
helptip: 'This should probably not be checked as doing so is against best practice consensus',
helptip: "Often, you may be rolling back many pages at a time from a vandal's contributions page, so it would be unsuitable to open the user talk page. Hence, this option is off by default. When this is on, the desired options must be enabled in the previous setting for this to work.",
type: "'boolean"'
},
 
// TwinkleConfig.markRevertedPagesAsMinorprodReasonDefault (arraystring)
// The prefilled PROD reason.
// What types of actions that should result in marking edit as minor
{
name: "markRevertedPagesAsMinor"'prodReasonDefault',
label: 'Prefilled PROD reason',
label: "Mark as minor edit for these types of reversions",
type: "set",'string'
},
setValues: { agf: "AGF rollback", norm: "Normal rollback", vand: "Vandalism rollback", torev: "\"Restore this version\"" }
},
 
{
// TwinkleConfig.watchRevertedPages (array)
name: 'logProdPages',
// What types of actions that should result in forced addition to watchlist
label: 'Keep a log in userspace of all pages you tag for PROD',
{
helptip: 'Since non-admins do not have access to their deleted contributions, the userspace log offers a good way to keep track of all pages you tag for PROD using Twinkle.',
name: "watchRevertedPages",
type: 'boolean'
label: "Add pages to watchlist for these types of reversions",
type: "set"},
{
setValues: { agf: "AGF rollback", norm: "Normal rollback", vand: "Vandalism rollback", torev: "\"Restore this version\"" }
name: 'prodLogPageName',
},
label: 'Keep the PROD userspace log at this user subpage',
helptip: 'Enter a subpage name in this box. You will find your PROD log at User:<i>username</i>/<i>subpage name</i>. Only works if you turn on the PROD userspace log.',
type: 'string'
}
]
},
 
{
// TwinkleConfig.offerReasonOnNormalRevert (boolean)
title: 'Revert and rollback', // twinklefluff module
// If to offer a prompt for extra summary reason for normal reverts, default to true
preferences: [
{
// TwinkleConfig.autoMenuAfterRollback (bool)
name: "offerReasonOnNormalRevert",
// Option to automatically open the warning menu if the user talk page is opened post-reversion
label: "Prompt for reason for normal rollbacks",
{
helptip: "\"Normal\" rollbacks are the ones that are invoked from the middle [rollback] link.",
name: 'autoMenuAfterRollback',
type: "boolean"
label: 'Automatically open the Twinkle warn menu on a user talk page after Twinkle rollback',
},
helptip: 'Only operates if the relevant box is checked below.',
type: 'boolean'
},
 
// TwinkleConfig.openTalkPage (array)
{
// What types of actions that should result in opening of talk page
name: "confirmOnFluff",
{
label: "Provide a confirmation message before reverting",
name: 'openTalkPage',
helptip: "For users of pen or touch devices, and chronically indecisive people.",
label: 'Open user talk page after these types of reversions',
type: "boolean"
type: 'set',
},
setValues: { agf: 'AGF rollback', norm: 'Normal rollback', vand: 'Vandalism rollback', torev: '"Restore this version"' }
},
 
// TwinkleConfig.showRollbackLinksopenTalkPageOnAutoRevert (arraybool)
// Defines if talk page should be opened when calling revert from contribs or recent changes pages. If set to true, openTalkPage defines then if talk page will be opened.
// Where Twinkle should show rollback links (diff, others, mine, contribs)
{
// Note from TTO: |contribs| seems to be equal to |others| + |mine|, i.e. redundant, so I left it out heres
name: 'openTalkPageOnAutoRevert',
{
label: 'Open user talk page when invoking rollback from user contributions or recent changes',
name: "showRollbackLinks",
helptip: 'When this is on, the desired options must be enabled in the previous setting for this to work.',
label: "Show rollback links on these pages",
type: "set",'boolean'
},
setValues: { diff: "Diff pages", others: "Contributions pages of other users", mine: "My contributions page" }
}
]
},
 
// TwinkleConfig.rollbackInPlace (bool)
{
//
title: "Shared IP tagging",
{
inFriendlyConfig: true,
name: 'rollbackInPlace',
preferences: [
label: "Don't reload the page when rolling back from contributions or recent changes",
{
helptip: "When this is on, Twinkle won't reload the contributions or recent changes feed after reverting, allowing you to revert more than one edit at a time.",
name: "markSharedIPAsMinor",
type: 'boolean'
label: "Mark shared IP tagging as a minor edit",
},
type: "boolean"
}
]
},
 
// TwinkleConfig.markRevertedPagesAsMinor (array)
{
// What types of actions that should result in marking edit as minor
title: "Speedy deletion (CSD)",
{
preferences: [
name: 'markRevertedPagesAsMinor',
{
label: 'Mark as minor edit for these types of reversions',
name: "speedySelectionStyle",
type: 'set',
label: "When to go ahead and tag/delete the page",
setValues: { agf: 'AGF rollback', norm: 'Normal rollback', vand: 'Vandalism rollback', torev: '"Restore this version"' }
type: "enum",
},
enumValues: { "buttonClick": 'When I click "Submit"', "radioClick": "As soon as I click an option" }
},
 
// TwinkleConfig.watchSpeedyPageswatchRevertedPages (array)
// WhetherWhat totypes addof speedyactions taggedthat pagesshould result in forced addition to watchlist
{
name: "watchSpeedyPages"'watchRevertedPages',
label: "'Add pagepages to watchlist whenfor taggingthese withtypes theseof criteria"reversions',
type: "'set"',
setValues: { agf: 'AGF rollback', norm: 'Normal rollback', vand: 'Vandalism rollback', torev: '"Restore this version"' }
setValues: Twinkle.config.commonSets.csdCriteria,
},
setDisplayOrder: Twinkle.config.commonSets.csdCriteriaDisplayOrder
},
 
// TwinkleConfig.markSpeedyPagesAsPatrolledofferReasonOnNormalRevert (boolean)
// If to offer a prompt for extra summary reason for normal reverts, default to true
// If, when applying speedy template to page, to mark the page as patrolled (if the page was reached from NewPages)
{
name: "markSpeedyPagesAsPatrolled"'offerReasonOnNormalRevert',
label: "Mark'Prompt pagefor asreason patrolledfor whennormal tagging (if possible)"rollbacks',
helptip: '"Normal" rollbacks are the ones that are invoked from the middle [rollback] link.',
type: "boolean"
type: 'boolean'
},
},
 
{
// TwinkleConfig.notifyUserOnSpeedyDeletionNomination (array)
name: 'confirmOnFluff',
// What types of actions should result that the author of the page being notified of nomination
label: 'Provide a confirmation message before reverting',
{
helptip: 'For users of pen or touch devices, and chronically indecisive people.',
name: "notifyUserOnSpeedyDeletionNomination",
type: 'boolean'
label: "Notify page creator only when tagging with these criteria",
},
helptip: "Even if you choose to notify from the CSD screen, the notification will only take place for those criteria selected here.",
type: "set",
setValues: Twinkle.config.commonSets.csdCriteriaNotification,
setDisplayOrder: Twinkle.config.commonSets.csdCriteriaNotificationDisplayOrder
},
 
// TwinkleConfig.welcomeUserOnSpeedyDeletionNotificationshowRollbackLinks (array of strings)
// Where Twinkle should show rollback links:
// On what types of speedy deletion notifications shall the user be welcomed
// diff, others, mine, contribs, history, recent
// with a "firstarticle" notice if his talk page has not yet been created.
// Note from TTO: |contribs| seems to be equal to |others| + |mine|, i.e. redundant, so I left it out heres
{
{
name: "welcomeUserOnSpeedyDeletionNotification",
name: 'showRollbackLinks',
label: "Welcome page creator alongside notification when tagging with these criteria",
label: 'Show rollback links on these pages',
helptip: "The welcome is issued only if the user is notified about the deletion, and only if their talk page does not already exist. The template used is {{firstarticle}}.",
type: "'set"',
setValues: { diff: 'Diff pages', others: 'Contributions pages of other users', mine: 'My contributions page', recent: 'Recent changes and related changes special pages', history: 'History pages' }
setValues: Twinkle.config.commonSets.csdCriteriaNotification,
}
setDisplayOrder: Twinkle.config.commonSets.csdCriteriaNotificationDisplayOrder
},]
},
 
{
// TwinkleConfig.promptForSpeedyDeletionSummary (array of strings)
title: 'Shared IP tagging',
{
preferences: [
name: "promptForSpeedyDeletionSummary",
{
label: "Allow editing of deletion summary when deleting under these criteria",
name: 'markSharedIPAsMinor',
adminOnly: true,
label: 'Mark shared IP tagging as a minor edit',
type: "set",
type: 'boolean'
setValues: Twinkle.config.commonSets.csdAndDICriteria,
}
setDisplayOrder: Twinkle.config.commonSets.csdAndDICriteriaDisplayOrder
},]
},
 
{
// TwinkleConfig.openUserTalkPageOnSpeedyDelete (array of strings)
title: 'Speedy deletion (CSD)',
// What types of actions that should result user talk page to be opened when speedily deleting (admin only)
preferences: [
{
{
name: "openUserTalkPageOnSpeedyDelete",
name: 'speedySelectionStyle',
label: "Open user talk page when deleting under these criteria",
label: 'When to go ahead and tag/delete the page',
adminOnly: true,
type: "set"'enum',
enumValues: { 'buttonClick': 'When I click "Submit"', 'radioClick': 'As soon as I click an option' }
setValues: Twinkle.config.commonSets.csdAndDICriteria,
},
setDisplayOrder: Twinkle.config.commonSets.csdAndDICriteriaDisplayOrder
},
 
// TwinkleConfig.deleteTalkPageOnDeletewatchSpeedyPages (booleanarray)
// Whether to add speedy tagged or deleted pages to watchlist
// If talk page if exists should also be deleted (CSD G8) when spedying a page (admin only)
{
name: "deleteTalkPageOnDelete"'watchSpeedyPages',
label: "Check'Add thepage \"alsoto deletewatchlist talk page\"when boxusing bythese default"criteria',
adminOnly type: true'set',
setValues: Twinkle.config.commonSets.csdCriteria,
type: "boolean"
setDisplayOrder: Twinkle.config.commonSets.csdCriteriaDisplayOrder
},
},
 
// TwinkleConfig.markSpeedyPagesAsPatrolled (boolean)
{
// If, when applying speedy template to page, to mark the page as triaged/patrolled (if the page was reached from NewPages)
name: "deleteRedirectsOnDelete",
{
label: "Check the \"also delete redirects\" box by default",
name: 'markSpeedyPagesAsPatrolled',
adminOnly: true,
label: 'Mark page as patrolled/reviewed when tagging (if possible)',
type: "boolean"
helptip: 'This should probably not be checked as doing so is against best practice consensus',
},
type: 'boolean'
},
 
// TwinkleConfig.deleteSysopDefaultToTagwelcomeUserOnSpeedyDeletionNotification (booleanarray of strings)
// On what types of speedy deletion notifications shall the user be welcomed
// Make the CSD screen default to "tag" instead of "delete" (admin only)
// with a "firstarticle" notice if their talk page has not yet been created.
{
{
name: "deleteSysopDefaultToTag",
name: 'welcomeUserOnSpeedyDeletionNotification',
label: "Default to speedy tagging instead of outright deletion",
label: 'Welcome page creator when notifying with these criteria',
adminOnly: true,
helptip: 'The welcome is issued only if the user is notified about the deletion, and only if their talk page does not already exist. The template used is {{firstarticle}}.',
type: "boolean"
type: 'set',
},
setValues: Twinkle.config.commonSets.csdCriteriaNotification,
setDisplayOrder: Twinkle.config.commonSets.csdCriteriaNotificationDisplayOrder
},
 
// TwinkleConfig.speedyWindowWidthnotifyUserOnSpeedyDeletionNomination (integerarray)
// DefinesWhat types of actions should result in the widthauthor of the Twinklepage SDbeing windownotified inof pixelsnomination
{
name: "speedyWindowWidth"'notifyUserOnSpeedyDeletionNomination',
label: "Width'Notify ofpage speedycreator deletionwhen windowtagging (pixels)"with these criteria',
helptip: 'Even if you choose to notify from the CSD screen, the notification will only take place for those criteria selected here.',
type: "integer"
type: 'set',
},
setValues: Twinkle.config.commonSets.csdCriteriaNotification,
setDisplayOrder: Twinkle.config.commonSets.csdCriteriaNotificationDisplayOrder
},
 
// TwinkleConfig.speedyWindowWidthwarnUserOnSpeedyDelete (integerarray)
// What types of actions should result in the author of the page being notified of speedy deletion (admin only)
// Defines the width of the Twinkle SD window in pixels
{
name: "speedyWindowHeight"'warnUserOnSpeedyDelete',
label: "Height'Notify ofpage speedycreator deletionwhen windowdeleting (pixels)"under these criteria',
helptip: "If'Even if you havechoose ato bignotify monitorfrom the CSD screen, youthe mightnotification likewill toonly take place for those criteria increaseselected thishere."',
type adminOnly: "integer"true,
type: 'set',
},
setValues: Twinkle.config.commonSets.csdCriteriaNotification,
setDisplayOrder: Twinkle.config.commonSets.csdCriteriaNotificationDisplayOrder
},
 
// TwinkleConfig.promptForSpeedyDeletionSummary (array of strings)
{
{
name: "logSpeedyNominations",
name: 'promptForSpeedyDeletionSummary',
label: "Keep a log in userspace of all CSD nominations",
label: 'Allow editing of deletion summary when deleting under these criteria',
helptip: "Since non-admins do not have access to their deleted contributions, the userspace log offers a good way to keep track of all pages you nominate for CSD using Twinkle. Files tagged using DI are also added to this log.",
type adminOnly: "boolean"true,
type: 'set',
},
setValues: Twinkle.config.commonSets.csdAndDICriteria,
{
setDisplayOrder: Twinkle.config.commonSets.csdAndDICriteriaDisplayOrder
name: "speedyLogPageName",
},
label: "Keep the CSD userspace log at this user subpage",
helptip: "Enter a subpage name in this box. You will find your CSD log at User:<i>username</i>/<i>subpage name</i>. Only works if you turn on the CSD userspace log.",
type: "string"
},
{
name: "noLogOnSpeedyNomination",
label: "Do not create a userspace log entry when tagging with these criteria",
type: "set",
setValues: Twinkle.config.commonSets.csdAndDICriteria,
setDisplayOrder: Twinkle.config.commonSets.csdAndDICriteriaDisplayOrder
}
]
},
 
// TwinkleConfig.deleteTalkPageOnDelete (boolean)
{
// If talk page if exists should also be deleted (CSD G8) when spedying a page (admin only)
title: "Tag",
{
inFriendlyConfig: true,
name: 'deleteTalkPageOnDelete',
preferences: [
label: 'Check the "also delete talk page" box by default',
{
adminOnly: true,
name: "watchTaggedPages",
type: 'boolean'
label: "Add page to watchlist when tagging",
},
type: "boolean"
},
{
name: "watchMergeDiscussions",
label: "Add talk pages to watchlist when starting merge discussions",
type: "boolean"
},
{
name: "markTaggedPagesAsMinor",
label: "Mark addition of tags as a minor edit",
type: "boolean"
},
{
name: "markTaggedPagesAsPatrolled",
label: "Check the \"mark page as patrolled\" box by default",
type: "boolean"
},
{
name: "groupByDefault",
label: "Check the \"group into {{multiple issues}}\" box by default",
type: "boolean"
},
{
name: "tagArticleSortOrder",
label: "Default view order for article tags",
type: "enum",
enumValues: { "cat": "By categories", "alpha": "In alphabetical order" }
},
{
name: "customTagList",
label: "Custom article maintenance tags to display",
helptip: "These appear as additional options at the bottom of the list of tags. For example, you could add new maintenance tags which have not yet been added to Twinkle's defaults.",
type: "customList",
customListValueTitle: "Template name (no curly brackets)",
customListLabelTitle: "Text to show in Tag dialog"
}
]
},
 
{
name: 'deleteRedirectsOnDelete',
title: "Talkback",
label: 'Check the "also delete redirects" box by default',
inFriendlyConfig: true,
adminOnly: true,
preferences: [
type: 'boolean'
{
},
name: "markTalkbackAsMinor",
label: "Mark talkbacks as minor edits",
type: "boolean"
},
{
name: "insertTalkbackSignature",
label: "Insert signature within talkbacks",
type: "boolean"
},
{
name: "talkbackHeading",
label: "Section heading to use for talkbacks",
type: "string"
},
{
name: "adminNoticeHeading",
label: "Section heading to use for administrators' noticeboard notices",
helptip: "Only relevant for AN and ANI.",
type: "string"
},
{
name: "mailHeading",
label: "Section heading to use for \"you've got mail\" notices",
type: "string"
}
]
},
 
// TwinkleConfig.deleteSysopDefaultToDelete (boolean)
{
// Make the CSD screen default to "delete" instead of "tag" (admin only)
title: "Unlink",
{
preferences: [
name: 'deleteSysopDefaultToDelete',
// TwinkleConfig.unlinkNamespaces (array)
label: 'Default to outright deletion instead of speedy tagging',
// In what namespaces unlink should happen, default in 0 (article) and 100 (portal)
helptip: 'If there is a CSD tag already present, Twinkle will always default to "delete" mode',
{
adminOnly: true,
name: "unlinkNamespaces",
type: 'boolean'
label: "Remove links from pages in these namespaces",
},
helptip: "Avoid selecting any talk namespaces, as Twinkle might end up unlinking on talk archives (a big no-no).",
type: "set",
setValues: Twinkle.config.commonSets.namespacesNoSpecial
}
]
},
 
// TwinkleConfig.speedyWindowWidth (integer)
{
// Defines the width of the Twinkle SD window in pixels
title: "Warn user",
{
preferences: [
name: 'speedyWindowWidth',
// TwinkleConfig.defaultWarningGroup (int)
label: 'Width of speedy deletion window (pixels)',
// if true, watch the page which has been dispatched an warning or notice, if false, default applies
type: 'integer'
{
},
name: "defaultWarningGroup",
 
label: "Default warning level",
// TwinkleConfig.speedyWindowWidth (integer)
type: "enum",
// Defines the width of the Twinkle SD window in pixels
enumValues: {
{
"1": "Level 1",
"2"name: "Level 2"'speedyWindowHeight',
label: 'Height of speedy deletion window (pixels)',
"3": "Level 3",
helptip: 'If you have a big monitor, you might like to increase this.',
"4": "Level 4",
"5"type: "Level 4im",'integer'
},
"6": "Single-issue notices",
 
"7": "Single-issue warnings",
{
"9": "Custom warnings"
name: 'logSpeedyNominations',
label: 'Keep a log in userspace of all CSD nominations',
helptip: 'Since non-admins do not have access to their deleted contributions, the userspace log offers a good way to keep track of all pages you nominate for CSD using Twinkle. Files tagged using DI are also added to this log.',
type: 'boolean'
},
{
name: 'speedyLogPageName',
label: 'Keep the CSD userspace log at this user subpage',
helptip: 'Enter a subpage name in this box. You will find your CSD log at User:<i>username</i>/<i>subpage name</i>. Only works if you turn on the CSD userspace log.',
type: 'string'
},
{
name: 'noLogOnSpeedyNomination',
label: 'Do not create a userspace log entry when tagging with these criteria',
type: 'set',
setValues: Twinkle.config.commonSets.csdAndDICriteria,
setDisplayOrder: Twinkle.config.commonSets.csdAndDICriteriaDisplayOrder
}
},]
},
 
{
// TwinkleConfig.showSharedIPNotice may take arguments:
title: 'Tag',
// true: to show shared ip notice if an IP address
preferences: [
// false: to not print the notice
{
name: "showSharedIPNotice"'watchTaggedPages',
label: "'Add extrapage noticeto onwatchlist sharedwhen IP talk pages"tagging',
type: 'boolean'
helptip: "Notice used is {{Shared IP advice}}",
},
type: "boolean"
}, {
name: 'watchMergeDiscussions',
label: 'Add talk pages to watchlist when starting merge discussions',
type: 'boolean'
},
{
name: 'markTaggedPagesAsMinor',
label: 'Mark addition of tags as a minor edit',
type: 'boolean'
},
{
name: 'markTaggedPagesAsPatrolled',
label: 'Check the "mark page as patrolled/reviewed" box by default',
type: 'boolean'
},
{
name: 'groupByDefault',
label: 'Check the "group into {{multiple issues}}" box by default',
type: 'boolean'
},
{
name: 'tagArticleSortOrder',
label: 'Default view order for article tags',
type: 'enum',
enumValues: { 'cat': 'By categories', 'alpha': 'In alphabetical order' }
},
{
name: 'customTagList',
label: 'Custom article/draft maintenance tags to display',
helptip: "These appear as additional options at the bottom of the list of tags. For example, you could add new maintenance tags which have not yet been added to Twinkle's defaults.",
type: 'customList',
customListValueTitle: 'Template name (no curly brackets)',
customListLabelTitle: 'Text to show in Tag dialog'
},
{
name: 'customFileTagList',
label: 'Custom file maintenance tags to display',
helptip: 'Additional tags that you wish to add for files.',
type: 'customList',
customListValueTitle: 'Template name (no curly brackets)',
customListLabelTitle: 'Text to show in Tag dialog'
},
{
name: 'customRedirectTagList',
label: 'Custom redirect category tags to display',
helptip: 'Additional tags that you wish to add for redirects.',
type: 'customList',
customListValueTitle: 'Template name (no curly brackets)',
customListLabelTitle: 'Text to show in Tag dialog'
}
]
},
 
{
// TwinkleConfig.watchWarnings (boolean)
title: 'Talkback',
// if true, watch the page which has been dispatched an warning or notice, if false, default applies
preferences: [
{
{
name: "watchWarnings",
name: 'markTalkbackAsMinor',
label: "Add user talk page to watchlist when notifying",
label: 'Mark talkbacks as minor edits',
type: "boolean"
type: 'boolean'
},
},
{
name: 'insertTalkbackSignature',
label: 'Insert signature within talkbacks',
type: 'boolean'
},
{
name: 'talkbackHeading',
label: 'Section heading to use for talkbacks',
type: 'string'
},
{
name: 'adminNoticeHeading',
label: "Section heading to use for administrators' noticeboard notices",
helptip: 'Only relevant for AN and ANI.',
type: 'string'
},
{
name: 'mailHeading',
label: "Section heading to use for \"you've got mail\" notices",
type: 'string'
}
]
},
 
{
title: 'Unlink',
name: "customWarningList",
preferences: [
label: "Custom warning templates to display",
// TwinkleConfig.unlinkNamespaces (array)
helptip: "You can add individual templates or user subpages. Custom warnings appear in the \"Custom warnings\" category within the warning dialog box.",
// In what namespaces unlink should happen, default in 0 (article), 10 (template), 100 (portal), and 118 (draft)
type: "customList",
{
customListValueTitle: "Template name (no curly brackets)",
name: 'unlinkNamespaces',
customListLabelTitle: "Text to show in warning list (also used as edit summary)"
label: 'Remove links from pages in these namespaces',
},
helptip: 'Avoid selecting any talk namespaces, as Twinkle might end up unlinking on talk archives (a big no-no).',
type: 'set',
setValues: Twinkle.config.commonSets.namespacesNoSpecial
}
]
},
 
{
title: 'Warn user',
name: "markXfdPagesAsPatrolled",
preferences: [
label: "Mark page as patrolled when nominating for AFD (if possible)",
// TwinkleConfig.defaultWarningGroup (int)
type: "boolean"
// Which level warning should be the default selected group, default is 1
}
{
]
name: 'defaultWarningGroup',
},
label: 'Default warning level',
type: 'enum',
enumValues: {
'1': 'Level 1',
'2': 'Level 2',
'3': 'Level 3',
'4': 'Level 4',
'5': 'Level 4im',
'6': 'Single-issue notices',
'7': 'Single-issue warnings',
// 8 was used for block templates before #260
'9': 'Custom warnings',
'10': 'All warning templates',
'11': 'Auto-select level (1-4)'
}
},
 
// TwinkleConfig.combinedSingletMenus (boolean)
{
// if true, show one menu with both single-issue notices and warnings instead of two separately
title: "Welcome user",
{
inFriendlyConfig: true,
name: 'combinedSingletMenus',
preferences: [
label: 'Replace the two separate single-issue menus into one combined menu',
{
helptip: 'Selecting either single-issue notices or single-issue warnings as your default will make this your default if enabled.',
name: "topWelcomes",
type: 'boolean'
label: "Place welcomes above existing content on user talk pages",
},
type: "boolean"
},
{
name: "watchWelcomes",
label: "Add user talk pages to watchlist when welcoming",
helptip: "Doing so adds to the personal element of welcoming a user - you will be able to see how they are coping as a newbie, and possibly help them.",
type: "boolean"
},
{
name: "insertUsername",
label: "Add your username to the template (where applicable)",
helptip: "Some welcome templates have an opening sentence like \"Hi, I'm &lt;username&gt;. Welcome\" etc. If you turn off this option, these templates will not display your username in that way.",
type: "boolean"
},
{
name: "quickWelcomeMode",
label: "Clicking the \"welcome\" link on a diff page will",
helptip: "If you choose to welcome automatically, the template you specify below will be used.",
type: "enum",
enumValues: { auto: "welcome automatically", norm: "prompt you to select a template" }
},
{
name: "quickWelcomeTemplate",
label: "Template to use when welcoming automatically",
helptip: "Enter the name of a welcome template, without the curly brackets. A link to the given article will be added.",
type: "string"
},
{
name: "customWelcomeList",
label: "Custom welcome templates to display",
helptip: "You can add other welcome templates, or user subpages that are welcome templates (prefixed with \"User:\"). Don't forget that these templates are substituted onto user talk pages.",
type: "customList",
customListValueTitle: "Template name (no curly brackets)",
customListLabelTitle: "Text to show in Welcome dialog"
},
{
name: "customWelcomeSignature",
label: "Automatically sign custom welcome templates",
helptip: "If your custom welcome templates contain a built-in signature within the template, turn off this option.",
type: "boolean"
}
]
},
 
// TwinkleConfig.showSharedIPNotice may take arguments:
{
// true: to show shared ip notice if an IP address
title: "XFD (deletion discussions)",
// false: to not print the notice
preferences: [
{
// TwinkleConfig.xfdWatchPage (string)
name: 'showSharedIPNotice',
// The watchlist setting of the page being nominated for XfD. Either "yes" (add to watchlist), "no" (don't
label: 'Add extra notice on shared IP talk pages',
// add to watchlist), or "default" (use setting from preferences). Default is "default" (duh).
helptip: 'Notice used is {{Shared IP advice}}',
{
type: 'boolean'
name: "xfdWatchPage",
},
label: "Add the nominated page to watchlist",
type: "enum",
enumValues: Twinkle.config.commonEnums.watchlist
},
 
// TwinkleConfig.xfdWatchDiscussionwatchWarnings (stringboolean)
// if true, watch the page which has been dispatched an warning or notice, if false, default applies
// The watchlist setting of the newly created XfD page (for those processes that create discussion pages for each nomination),
{
// or the list page for the other processes.
name: 'watchWarnings',
// Either "yes" (add to watchlist), "no" (don't add to watchlist), or "default" (use setting from preferences). Default is "default" (duh).
label: 'Add user talk page to watchlist when notifying',
{
type: 'boolean'
name: "xfdWatchDiscussion",
},
label: "Add the deletion discussion page to watchlist",
helptip: "This refers to the discussion subpage (for AfD and MfD) or the daily log page (for TfD, CfD, RfD and FfD)",
type: "enum",
enumValues: Twinkle.config.commonEnums.watchlist
},
 
// TwinkleConfig.xfdWatchListoldSelect (stringboolean)
// if true, use the native select menu rather the select2-based one
// The watchlist setting of the XfD list page, *if* the discussion is on a separate page. Either "yes" (add to watchlist), "no" (don't
{
// add to watchlist), or "default" (use setting from preferences). Default is "no" (Hehe. Seriously though, who wants to watch it?
name: 'oldSelect',
// Sorry in advance for any false positives.).
label: 'Use the non-searchable classic select menu',
{
type: 'boolean'
name: "xfdWatchList",
},
label: "Add the daily log/list page to the watchlist (where applicable)",
helptip: "This only applies for AfD and MfD, where the discussions are transcluded onto a daily log page (for AfD) or the main MfD page (for MfD).",
type: "enum",
enumValues: Twinkle.config.commonEnums.watchlist
},
 
{
// TwinkleConfig.xfdWatchUser (string)
name: 'customWarningList',
// The watchlist setting of the user if he receives a notification. Either "yes" (add to watchlist), "no" (don't
label: 'Custom warning templates to display',
// add to watchlist), or "default" (use setting from preferences). Default is "default" (duh).
helptip: 'You can add individual templates or user subpages. Custom warnings appear in the "Custom warnings" category within the warning dialog box.',
{
name type: "xfdWatchUser"'customList',
customListValueTitle: 'Template name (no curly brackets)',
label: "Add the user talk page to watchlist (when notifying)",
customListLabelTitle: 'Text to show in warning list (also used as edit summary)'
type: "enum",
}
enumValues: Twinkle.config.commonEnums.watchlist
}]
]},
},
 
{
title: "Hidden"'Welcome user',
preferences: [
hidden: true,
{
preferences: [
name: 'topWelcomes',
// twinkle.header.js: portlet setup
label: 'Place welcomes above existing content on user talk pages',
{
name type: "portletArea",'boolean'
},
type: "string"
}, {
name: 'watchWelcomes',
{
label: 'Add user talk pages to watchlist when welcoming',
name: "portletId",
helptip: 'Doing so adds to the personal element of welcoming a user - you will be able to see how they are coping as a newbie, and possibly help them.',
type: "string"
type: 'boolean'
},
{ },
{
name: "portletName",
name: 'insertUsername',
type: "string"
label: 'Add your username to the template (where applicable)',
},
helptip: "Some welcome templates have an opening sentence like \"Hi, I'm &lt;username&gt;. Welcome\" etc. If you turn off this option, these templates will not display your username in that way.",
{
name type: "portletType",'boolean'
},
type: "string"
}, {
name: 'quickWelcomeMode',
{
label: 'Clicking the "welcome" link on a diff page will',
name: "portletNext",
helptip: 'If you choose to welcome automatically, the template you specify below will be used.',
type: "string"
type: 'enum',
},
enumValues: { auto: 'welcome automatically', norm: 'prompt you to select a template' }
// twinklefluff.js: defines how many revision to query maximum, maximum possible is 50, default is 50
{ },
{
name: "revertMaxRevisions",
name: 'quickWelcomeTemplate',
type: "integer"
label: 'Template to use when welcoming automatically',
},
helptip: 'Enter the name of a welcome template, without the curly brackets. A link to the given article will be added.',
// twinklebatchdelete.js: How many pages should be processed at a time
type: 'string'
{
},
name: "batchdeleteChunks",
{
type: "integer"
name: 'customWelcomeList',
},
label: 'Custom welcome templates to display',
// twinklebatchdelete.js: How many pages left in the process of being completed should allow a new batch to be initialized
helptip: "You can add other welcome templates, or user subpages that are welcome templates (prefixed with \"User:\"). Don't forget that these templates are substituted onto user talk pages.",
{
type: 'customList',
name: "batchDeleteMinCutOff",
customListValueTitle: 'Template name (no curly brackets)',
type: "integer"
customListLabelTitle: 'Text to show in Welcome dialog'
},
},
// twinklebatchdelete.js: How many pages should be processed maximum
{
name: "batchMax"'customWelcomeSignature',
label: 'Automatically sign custom welcome templates',
type: "integer"
helptip: 'If your custom welcome templates contain a built-in signature within the template, turn off this option.',
},
type: 'boolean'
// twinklebatchprotect.js: How many pages should be processed at a time
{ }
]
name: "batchProtectChunks",
},
type: "integer"
 
},
{
// twinklebatchprotect.js: How many pages left in the process of being completed should allow a new batch to be initialized
title: 'XFD (deletion discussions)',
{
preferences: [
name: "batchProtectMinCutOff",
{
type: "integer"
name: 'logXfdNominations',
},
label: 'Keep a log in userspace of all pages you nominate for a deletion discussion (XfD)',
// twinklebatchundelete.js: How many pages should be processed at a time
helptip: 'The userspace log offers a good way to keep track of all pages you nominate for XfD using Twinkle.',
{
type: 'boolean'
name: "batchundeleteChunks",
},
type: "integer"
}, {
name: 'xfdLogPageName',
// twinklebatchundelete.js: How many pages left in the process of being completed should allow a new batch to be initialized
label: 'Keep the deletion discussion userspace log at this user subpage',
{
helptip: 'Enter a subpage name in this box. You will find your XfD log at User:<i>username</i>/<i>subpage name</i>. Only works if you turn on the XfD userspace log.',
name: "batchUndeleteMinCutOff",
type: "integer"'string'
},
{
// twinkledeprod.js: How many pages should be processed at a time
name: 'noLogOnXfdNomination',
{
label: 'Do not create a userspace log entry when nominating at this venue',
name: "proddeleteChunks",
type: "integer"'set',
setValues: { afd: 'AfD', tfd: 'TfD', ffd: 'FfD', cfd: 'CfD', cfds: 'CfD/S', mfd: 'MfD', rfd: 'RfD', rm: 'RM' }
}
},
]
 
}
// TwinkleConfig.xfdWatchPage (string)
// The watchlist setting of the page being nominated for XfD. Either "yes" (add to watchlist), "no" (don't
// add to watchlist), or "default" (use setting from preferences). Default is "default" (duh).
{
name: 'xfdWatchPage',
label: 'Add the nominated page to watchlist',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
 
// TwinkleConfig.xfdWatchDiscussion (string)
// The watchlist setting of the newly created XfD page (for those processes that create discussion pages for each nomination),
// or the list page for the other processes.
// Either "yes" (add to watchlist), "no" (don't add to watchlist), or "default" (use setting from preferences). Default is "default" (duh).
{
name: 'xfdWatchDiscussion',
label: 'Add the deletion discussion page to watchlist',
helptip: 'This refers to the discussion subpage (for AfD and MfD) or the daily log page (for TfD, CfD, RfD and FfD)',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
 
// TwinkleConfig.xfdWatchList (string)
// The watchlist setting of the XfD list page, *if* the discussion is on a separate page. Either "yes" (add to watchlist), "no" (don't
// add to watchlist), or "default" (use setting from preferences). Default is "no" (Hehe. Seriously though, who wants to watch it?
// Sorry in advance for any false positives.).
{
name: 'xfdWatchList',
label: 'Add the daily log/list page to the watchlist (where applicable)',
helptip: 'This only applies for AfD and MfD, where the discussions are transcluded onto a daily log page (for AfD) or the main MfD page (for MfD).',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
 
// TwinkleConfig.xfdWatchUser (string)
// The watchlist setting of the user talk page if they receive a notification. Either "yes" (add to watchlist), "no" (don't
// add to watchlist), or "default" (use setting from preferences). Default is "default" (duh).
{
name: 'xfdWatchUser',
label: 'Add user talk page of initial contributor to watchlist (when notifying)',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
 
// TwinkleConfig.xfdWatchRelated (string)
// The watchlist setting of the target of a redirect being nominated for RfD. Either "yes" (add to watchlist), "no" (don't
// add to watchlist), or "default" (use setting from preferences). Default is "default" (duh).
{
name: 'xfdWatchRelated',
label: "Add the redirect's target page to watchlist (when notifying)",
helptip: 'This only applies for RfD, when leaving a notification on the talk page of the target of the redirect',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
 
{
name: 'markXfdPagesAsPatrolled',
label: 'Mark page as patrolled/reviewed when nominating for AFD (if possible)',
type: 'boolean'
}
]
},
 
{
title: 'Hidden',
hidden: true,
preferences: [
// twinkle.js: portlet setup
{
name: 'portletArea',
type: 'string'
},
{
name: 'portletId',
type: 'string'
},
{
name: 'portletName',
type: 'string'
},
{
name: 'portletType',
type: 'string'
},
{
name: 'portletNext',
type: 'string'
},
// twinklefluff.js: defines how many revision to query maximum, maximum possible is 50, default is 50
{
name: 'revertMaxRevisions',
type: 'integer'
},
// twinklewarn.js: When using the autolevel select option, how many days makes a prior warning stale
// Huggle is three days ([[Special:Diff/918980316]] and [[Special:Diff/919417999]]) while ClueBotNG is two:
// https://github.com/DamianZaremba/cluebotng/blob/4958e25d6874cba01c75f11debd2e511fd5a2ce5/bot/action_functions.php#L62
{
name: 'autolevelStaleDays',
type: 'integer'
},
// twinklebatchdelete.js: How many pages should be processed maximum
{
name: 'batchMax',
type: 'integer',
adminOnly: true
},
// twinklebatchdelete.js: How many pages should be processed at a time
{
name: 'batchdeleteChunks',
type: 'integer',
adminOnly: true
},
// twinklebatchprotect.js: How many pages should be processed at a time
{
name: 'batchProtectChunks',
type: 'integer',
adminOnly: true
},
// twinklebatchundelete.js: How many pages should be processed at a time
{
name: 'batchundeleteChunks',
type: 'integer',
adminOnly: true
},
// twinkledeprod.js: How many pages should be processed at a time
{
name: 'proddeleteChunks',
type: 'integer',
adminOnly: true
}
]
}
 
]; // end of Twinkle.config.sections
 
//{
// name: "",
// label: "",
// type: ""
// },
 
 
Twinkle.config.init = function twinkleconfigInit() {
 
// create the config page at Wikipedia:Twinkle/Preferences
if ((mw.config.get("'wgNamespaceNumber"') === mw.config.get("'wgNamespaceIds"').project && mw.config.get("'wgTitle"') === "'Twinkle/Preferences"') ||&&
mw.config.get('wgAction') === 'view') {
(mw.config.get("wgNamespaceNumber") === mw.config.get("wgNamespaceIds").user && mw.config.get("wgTitle").lastIndexOf("/Twinkle preferences") === (mw.config.get("wgTitle").length - 20))) &&
mw.config.get("wgAction") === "view") {
// create the config page at Wikipedia:Twinkle/Preferences, and at user subpages (for testing purposes)
 
if (!document.getElementById("'twinkle-config"')) {
return; // maybe the page is misconfigured, or something - but any attempt to modify it will be pointless
}
 
// set style (the url() CSS function doesn't seem to work from wikicode - ?!)
document.getElementById("'twinkle-config-titlebar"').style.backgroundImage = "'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB%2FqqA%2BAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEhQTFRFr73ZobTPusjdsMHZp7nVwtDhzNbnwM3fu8jdq7vUt8nbxtDkw9DhpbfSvMrfssPZqLvVztbno7bRrr7W1d%2Fs1N7qydXk0NjpkW7Q%2BgAAADVJREFUeNoMwgESQCAAAMGLkEIi%2FP%2BnbnbpdB59app5Vdg0sXAoMZCpGoFbK6ciuy6FX4ABAEyoAef0BXOXAAAAAElFTkSuQmCC)"';
 
var contentdiv = document.getElementById("'twinkle-config-content"');
contentdiv.textContent = ""''; // clear children
 
// let user know about possible conflict with monobook.skin js/vectorcommon.js file
// (settings in that file will still work, but they will be overwritten by twinkleoptions.js settings)
if (window.TwinkleConfig || window.FriendlyConfig) {
var contentnotice = document.createElement("p");
var contentnotice = document.createElement('p');
// I hate innerHTML, but this is one thing it *is* good for...
contentnotice.innerHTML = '<table class="plainlinks ombox ombox-content"><tr><td class="mbox-image">' +
contentnotice.innerHTML = "<b>Before modifying your preferences here,</b> make sure you have removed any old <code>TwinkleConfig</code> and <code>FriendlyConfig</code> settings from your <a href=\"" + mw.util.getUrl("Special:MyPage/skin.js") + "\" title=\"Special:MyPage/skin.js\">user JavaScript file</a>.";
'<img alt="" src="https://upload.wikimedia.org/wikipedia/commons/3/38/Imbox_content.png" /></td>' +
contentdiv.appendChild(contentnotice);
'<td class="mbox-text"><p><big><b>Before modifying your settings here,</b> you must remove your old Twinkle and Friendly settings from your personal skin JavaScript.</big></p>' +
 
'<p>To do this, you can <a href="' + mw.util.getUrl('User:' + mw.config.get('wgUserName') + '/' + mw.config.get('skin') +
// look and see if the user does in fact have any old settings in their skin JS file
'.js', { action: 'edit' }) + '" target="_blank"><b>edit your personal skin javascript file</b></a> or <a href="' +
var skinjs = new Morebits.wiki.page("User:" + mw.config.get("wgUserName") + "/" + mw.config.get("skin") + ".js");
mw.util.getUrl('User:' + mw.config.get('wgUserName') + '/common.js', { action: 'edit'}) + '" target="_blank"><b>your common.js file</b></a>, removing all lines of code that refer to <code>TwinkleConfig</code> and <code>FriendlyConfig</code>.</p>' +
skinjs.setCallbackParameters(contentnotice);
'</td></tr></table>';
skinjs.load(Twinkle.config.legacyPrefsNotice);
contentdiv.appendChild(contentnotice);
}
 
// start a table of contents
var toctable = document.createElement("'div"');
toctable.className = "'toc"';
toctable.style.marginLeft = "'0.4em"';
// create TOC title
var toctitle = document.createElement("'div"');
toctitle.id = "'toctitle"';
var toch2 = document.createElement("'h2"');
toch2.textContent = "'Contents "';
toctitle.appendChild(toch2);
// add TOC show/hide link
var toctoggle = document.createElement("'span"');
toctoggle.className = "'toctoggle"';
toctoggle.appendChild(document.createTextNode("'["'));
var toctogglelink = document.createElement("'a"');
toctogglelink.className = "'internal"';
toctogglelink.setAttribute("'href"', "'#tw-tocshowhide"');
toctogglelink.textContent = "'hide"';
toctoggle.appendChild(toctogglelink);
toctoggle.appendChild(document.createTextNode("']"'));
toctitle.appendChild(toctoggle);
toctable.appendChild(toctitle);
// create item container: this is what we add stuff to
var tocul = document.createElement("'ul"');
toctogglelink.addEventListener("'click"', function twinkleconfigTocToggle() {
var $tocul = $(tocul);
$tocul.toggle();
if ($tocul.find("':visible"').length) {
toctogglelink.textContent = "'hide"';
} else {
toctogglelink.textContent = "'show"';
}
}, false);
வரி 913 ⟶ 1,020:
var tocnumber = 1;
 
var contentform = document.createElement("'form"');
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);
 
var container = document.createElement("'table"');
container.style.width = "'100%"';
contentform.appendChild(container);
 
$(Twinkle.config.sections).each(function(sectionkey, section) {
if (section.hidden || (section.adminOnly && !Morebits.userIsInGroup("sysop")userIsSysop)) {
return true; // i.e. "continue" in this context
}
 
var configgetter; // retrieve the live config values
if (section.inFriendlyConfig) {
configgetter = Twinkle.getFriendlyPref;
} else {
configgetter = Twinkle.getPref;
}
 
// add to TOC
var tocli = document.createElement("'li"');
tocli.className = "'toclevel-1"';
var toca = document.createElement("'a"');
toca.setAttribute("'href"', "'#twinkle-config-section-"' + tocnumber.toString());
toca.appendChild(document.createTextNode(section.title));
tocli.appendChild(toca);
tocul.appendChild(tocli);
 
var row = document.createElement("'tr"');
var cell = document.createElement("'td"');
cell.setAttribute("'colspan"', "'3"');
var heading = document.createElement("'h4"');
heading.style.borderBottom = "'1px solid gray"';
heading.style.marginTop = "'0.2em"';
heading.id = "'twinkle-config-section-"' + (tocnumber++).toString();
heading.appendChild(document.createTextNode(section.title));
cell.appendChild(heading);
வரி 959 ⟶ 1,059:
// add each of the preferences to the form
$(section.preferences).each(function(prefkey, pref) {
if (pref.adminOnly && !Morebits.userIsInGroup("sysop")userIsSysop) {
return true; // i.e. "continue" in this context
}
 
row = document.createElement("'tr"');
row.style.marginBottom = "'0.2em"';
// create odd row banding
if (rowcount++ % 2 === 0) {
row.style.backgroundColor = "'rgba(128, 128, 128, 0.1)"';
}
cell = document.createElement("'td"');
 
var label, input;
switch (pref.type) {
 
case "'boolean"': // create a checkbox
cell.setAttribute("'colspan"', "'2"');
 
label = document.createElement("'label"');
input = document.createElement("'input"');
input.setAttribute("'type"', "'checkbox"');
input.setAttribute("'id"', pref.name);
input.setAttribute("'name"', pref.name);
if (configgetterTwinkle.getPref(pref.name) === true) {
input.setAttribute("'checked"', "'checked"');
}
label.appendChild(input);
label.appendChild(document.createTextNode("' "' + pref.label));
cell.appendChild(label);
break;
 
case "'string"': // create an input box
case "'integer"':
// add label to first column
cell.style.textAlign = "'right"';
cell.style.paddingRight = "'0.5em"';
label = document.createElement("'label"');
label.setAttribute("'for"', pref.name);
label.appendChild(document.createTextNode(pref.label + "':"'));
cell.appendChild(label);
row.appendChild(cell);
 
// add input box to second column
cell = document.createElement("'td"');
cell.style.paddingRight = "'1em"';
input = document.createElement("'input"');
input.setAttribute("'type"', "'text"');
input.setAttribute("'id"', pref.name);
input.setAttribute("'name"', pref.name);
if (pref.type === "'integer"') {
input.setAttribute("'size"', 6);
input.setAttribute("'type"', "'number"');
input.setAttribute("'step"', "'1"'); // integers only
}
if (configgetterTwinkle.getPref(pref.name)) {
input.setAttribute("'value"', configgetterTwinkle.getPref(pref.name));
}
cell.appendChild(input);
break;
 
case "'enum"': // create a combo box
// add label to first column
// note: duplicates the code above, under string/integer
cell.style.textAlign = "'right"';
cell.style.paddingRight = "'0.5em"';
label = document.createElement("'label"');
label.setAttribute("'for"', pref.name);
label.appendChild(document.createTextNode(pref.label + "':"'));
cell.appendChild(label);
row.appendChild(cell);
 
// add input box to second column
cell = document.createElement("'td"');
cell.style.paddingRight = "'1em"';
input = document.createElement("'select"');
input.setAttribute("'id"', pref.name);
input.setAttribute("'name"', pref.name);
$.each(pref.enumValues, function(enumvalue, enumdisplay) {
var option = document.createElement("'option"');
option.setAttribute("'value"', enumvalue);
if (configgetterTwinkle.getPref(pref.name) === enumvalue) {
option.setAttribute("'selected"', "'selected"');
}
option.appendChild(document.createTextNode(enumdisplay));
வரி 1,048 ⟶ 1,148:
break;
 
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.appendChild(document.createTextNode(pref.label + "':"'));
cell.appendChild(label);
 
var checkdiv = document.createElement("'div"');
checkdiv.style.paddingLeft = "'1em"';
var worker = function(itemkey, itemvalue) {
var checklabel = document.createElement("'label"');
checklabel.style.marginRight = "'0.7em"';
checklabel.style.display = "'inline-block"';
var check = document.createElement("'input"');
check.setAttribute("'type"', "'checkbox"');
check.setAttribute("'id"', pref.name + "'_"' + itemkey);
check.setAttribute("'name"', pref.name + "'_"' + itemkey);
if (configgetterTwinkle.getPref(pref.name) && configgetterTwinkle.getPref(pref.name).indexOf(itemkey) !== -1) {
check.setAttribute("'checked"', "'checked"');
}
// cater for legacy integer array values for unlinkNamespaces (this can be removed a few years down the track...)
if (pref.name === "'unlinkNamespaces"') {
if (configgetterTwinkle.getPref(pref.name) && configgetterTwinkle.getPref(pref.name).indexOf(parseInt(itemkey, 10)) !== -1) {
check.setAttribute("'checked"', "'checked"');
}
}
வரி 1,090 ⟶ 1,190:
break;
 
case "'customList"':
// add label to first column
cell.style.textAlign = "'right"';
cell.style.paddingRight = "'0.5em"';
label = document.createElement("'label"');
label.setAttribute("'for"', pref.name);
label.appendChild(document.createTextNode(pref.label + "':"'));
cell.appendChild(label);
row.appendChild(cell);
 
// add button to second column
cell = document.createElement("'td"');
cell.style.paddingRight = "'1em"';
var button = document.createElement("'button"');
button.setAttribute("'id"', pref.name);
button.setAttribute("'name"', pref.name);
button.setAttribute("'type"', "'button"');
button.addEventListener("'click"', Twinkle.config.listDialog.display, false);
// use jQuery data on the button to store the current config value
$(button).data({
value: configgetterTwinkle.getPref(pref.name),
pref: pref,
inFriendlyConfig: section.inFriendlyConfig
});
button.appendChild(document.createTextNode("'Edit items"'));
cell.appendChild(button);
break;
 
default:
alert("'twinkleconfig: unknown data type for preference "' + pref.name);
break;
}
வரி 1,125 ⟶ 1,224:
 
// add help tip
cell = document.createElement("'td"');
cell.style.fontSize = "'90%"';
 
cell.style.color = "'gray"';
if (pref.helptip) {
// convert mentions of templates in the helptip to clickable links
cell.innerHTML = pref.helptip.replace(/{{(.+?)}}/g,
'{{<a href="' + mw.util.getUrl("'Template:"') + '$1" target="_blank">$1</a>}}');
}
// add reset link (custom lists don't need this, as their config value isn't displayed on the form)
if (pref.type !== "'customList"') {
var resetlink = document.createElement("'a"');
resetlink.setAttribute("'href"', "'#tw-reset"');
resetlink.setAttribute("'id"', "'twinkle-config-reset-"' + pref.name);
resetlink.addEventListener("'click"', Twinkle.config.resetPrefLink, false);
if (resetlink.style.styleFloat)cssFloat { // IE (inc.= IE9)'right';
resetlink.style.styleFloatmargin = "right"'0 0.6em';
resetlink.appendChild(document.createTextNode('Reset'));
} else { // standards
resetlink.style.cssFloat = "right";
}
resetlink.style.margin = "0 0.6em";
resetlink.appendChild(document.createTextNode("Reset"));
cell.appendChild(resetlink);
}
வரி 1,157 ⟶ 1,252:
});
 
var footerbox = document.createElement("'div"');
footerbox.setAttribute("'id"', "'twinkle-config-buttonpane"');
footerbox.style.backgroundColor = "'#BCCADF"';
footerbox.style.padding = "'0.5em"';
var button = document.createElement("'button"');
button.setAttribute("'id"', "'twinkle-config-submit"');
button.setAttribute("'type"', "'submit"');
button.appendChild(document.createTextNode("'Save changes"'));
footerbox.appendChild(button);
var footerspan = document.createElement("'span"');
footerspan.className = "'plainlinks"';
footerspan.style.marginLeft = "'2.4em"';
footerspan.style.fontSize = "'90%"';
var footera = document.createElement("'a"');
footera.setAttribute("'href"', "'#tw-reset-all"');
footera.setAttribute("'id"', "'twinkle-config-resetall"');
footera.addEventListener("'click"', Twinkle.config.resetAllPrefs, false);
footera.appendChild(document.createTextNode("'Restore defaults"'));
footerspan.appendChild(footera);
footerbox.appendChild(footerspan);
வரி 1,181 ⟶ 1,276:
// since all the section headers exist now, we can try going to the requested anchor
if (location.hash) {
window.location.hash = location.hash;
}
 
} else if (mw.config.get("'wgNamespaceNumber"') === mw.config.get("'wgNamespaceIds"').user &&
mw.config.get("'wgTitle"').indexOf(mw.config.get("'wgUserName"')) === 0 &&
mw.config.get("'wgPageName"').slice(-3) === "'.js"') {
 
var box = document.createElement("'div"');
// Styled in twinkle.css
box.setAttribute("'id"', "'twinkle-config-headerbox"');
box.style.border = "1px #f60 solid";
box.style.background = "#fed";
box.style.padding = "0.6em";
box.style.margin = "0.5em auto";
box.style.textAlign = "center";
 
var link,
scriptPageName = mw.config.get("'wgPageName"').slice(mw.config.get("'wgPageName"').lastIndexOf("'/"') + 1,
mw.config.get("'wgPageName"').lastIndexOf("'.js"'));
 
if (scriptPageName === "'twinkleoptions"') {
// place "why not try the preference panel" notice
box.setAttribute('class', 'config-twopt-box');
box.style.fontWeight = "bold";
box.style.width = "80%";
box.style.borderWidth = "2px";
 
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
box.appendChild(document.createTextNode("'You can customize Twinkle to suit your preferences by using the "'));
}
link = document.createElement("'a"');
link.setAttribute("'href"', mw.util.getUrl(mw.config.get("'wgFormattedNamespaces"')[mw.config.get("'wgNamespaceIds"').project] + "':Twinkle/Preferences"') );
link.appendChild(document.createTextNode("'Twinkle preferences panel"'));
box.appendChild(link);
box.appendChild(document.createTextNode("', or by editing this page."'));
$(box).insertAfter($("'#contentSub"'));
 
} else if (["'monobook"', "'vector"', "'cologneblue"', "'modern"', "'timeless', 'minerva', 'common"'].indexOf(scriptPageName) !== -1) {
// place "Looking for Twinkle options?" notice
box.setAttribute('class', 'config-userskin-box');
box.style.width = "60%";
 
box.appendChild(document.createTextNode("'If you want to set Twinkle preferences, you can use the "'));
link = document.createElement("'a"');
link.setAttribute("'href"', mw.util.getUrl(mw.config.get("'wgFormattedNamespaces"')[mw.config.get("'wgNamespaceIds"').project] + "':Twinkle/Preferences"') );
link.appendChild(document.createTextNode("'Twinkle preferences panel"'));
box.appendChild(link);
box.appendChild(document.createTextNode("'."'));
$(box).insertAfter($("'#contentSub"'));
}
}
};
 
// Morebits.wiki.page callback from init code
Twinkle.config.legacyPrefsNotice = function twinkleconfigLegacyPrefsNotice(pageobj) {
var text = pageobj.getPageText();
var contentnotice = pageobj.getCallbackParameters();
if (text.indexOf("TwinkleConfig") !== -1 || text.indexOf("FriendlyConfig") !== -1) {
contentnotice.innerHTML = '<table class="plainlinks ombox ombox-content"><tr><td class="mbox-image">' +
'<img alt="" src="http://upload.wikimedia.org/wikipedia/en/3/38/Imbox_content.png" /></td>' +
'<td class="mbox-text"><p><big><b>Before modifying your settings here,</b> you must remove your old Twinkle and Friendly settings from your personal skin JavaScript.</big></p>' +
'<p>To do this, you can <a href="' + mw.config.get("wgScript") + '?title=User:' + encodeURIComponent(mw.config.get("wgUserName")) + '/' + mw.config.get("skin") + '.js&action=edit" target="_blank"><b>edit your personal JavaScript</b></a>, removing all lines of code that refer to <code>TwinkleConfig</code> and <code>FriendlyConfig</code>.</p>' +
'</td></tr></table>';
} else {
$(contentnotice).remove();
}
};
வரி 1,253 ⟶ 1,327:
 
Twinkle.config.listDialog.addRow = function twinkleconfigListDialogAddRow(dlgtable, value, label) {
var contenttr = document.createElement("'tr"');
// "remove" button
var contenttd = document.createElement("'td"');
var removeButton = document.createElement("'button"');
removeButton.setAttribute("'type"', "'button"');
removeButton.addEventListener("'click"', function() {
$(contenttr).remove();
}, false);
removeButton.textContent = "'Remove"';
contenttd.appendChild(removeButton);
contenttr.appendChild(contenttd);
 
// value input box
contenttd = document.createElement("'td"');
var input = document.createElement("'input"');
input.setAttribute("'type"', "'text"');
input.className = "'twinkle-config-customlist-value"';
input.style.width = "'97%"';
if (value) {
input.setAttribute("'value"', value);
}
contenttd.appendChild(input);
வரி 1,276 ⟶ 1,352:
 
// label input box
contenttd = document.createElement("'td"');
input = document.createElement("'input"');
input.setAttribute("'type"', "'text"');
input.className = "'twinkle-config-customlist-label"';
input.style.width = "'98%"';
if (label) {
input.setAttribute("'value"', label);
}
contenttd.appendChild(input);
வரி 1,292 ⟶ 1,368:
Twinkle.config.listDialog.display = function twinkleconfigListDialogDisplay(e) {
var $prefbutton = $(e.target);
var curvalue = $prefbutton.data("'value"');
var curpref = $prefbutton.data("'pref"');
 
var dialog = new Morebits.simpleWindow(720, 400);
dialog.setTitle(curpref.label);
dialog.setScriptName("'Twinkle preferences"');
 
var dialogcontent = document.createElement("'div"');
var dlgtable = document.createElement("'table"');
dlgtable.className = "'wikitable"';
dlgtable.style.margin = "'1.4em 1em"';
dlgtable.style.width = "'auto"';
 
var dlgtbody = document.createElement("'tbody"');
 
// header row
var dlgtr = document.createElement("'tr"');
// top-left cell
var dlgth = document.createElement("'th"');
dlgth.style.width = "'5%"';
dlgtr.appendChild(dlgth);
// value column header
dlgth = document.createElement("'th"');
dlgth.style.width = "'35%"';
dlgth.textContent = (curpref.customListValueTitle ? curpref.customListValueTitle : "'Value")';
dlgtr.appendChild(dlgth);
// label column header
dlgth = document.createElement("'th"');
dlgth.style.width = "'60%"';
dlgth.textContent = (curpref.customListLabelTitle ? curpref.customListLabelTitle : "'Label")';
dlgtr.appendChild(dlgth);
dlgtbody.appendChild(dlgtr);
வரி 1,337 ⟶ 1,413:
 
// final "add" button
var dlgtfoot = document.createElement("'tfoot"');
dlgtr = document.createElement("'tr"');
var dlgtd = document.createElement("'td"');
dlgtd.setAttribute("'colspan"', "'3"');
var addButton = document.createElement("'button"');
addButton.style.minWidth = "'8em"';
addButton.setAttribute("'type"', "'button"');
addButton.addEventListener("'click"', function(e) {
Twinkle.config.listDialog.addRow(dlgtbody);
}, false);
addButton.textContent = "'Add"';
dlgtd.appendChild(addButton);
dlgtr.appendChild(dlgtd);
வரி 1,357 ⟶ 1,433:
 
// buttonpane buttons: [Save changes] [Reset] [Cancel]
var button = document.createElement("'button"');
button.setAttribute("'type"', "'submit"'); // so Morebits.simpleWindow puts the button in the button pane
button.addEventListener("'click"', function(e) {
Twinkle.config.listDialog.save($prefbutton, dlgtbody);
dialog.close();
}, false);
button.textContent = "'Save changes"';
dialogcontent.appendChild(button);
button = document.createElement("'button"');
button.setAttribute("'type"', "'submit"'); // so Morebits.simpleWindow puts the button in the button pane
button.addEventListener("'click"', function(e) {
Twinkle.config.listDialog.reset($prefbutton, dlgtbody);
}, false);
button.textContent = "'Reset"';
dialogcontent.appendChild(button);
button = document.createElement("'button"');
button.setAttribute("'type"', "'submit"'); // so Morebits.simpleWindow puts the button in the button pane
button.addEventListener("'click"', function(e) {
dialog.close(); // the event parameter on this function seems to be broken
}, false);
button.textContent = "'Cancel"';
dialogcontent.appendChild(button);
 
வரி 1,389 ⟶ 1,465:
// reset value on button
var $button = $(button);
var curpref = $button.data("'pref"');
var oldvalue = $button.data("'value"');
Twinkle.config.resetPref(curpref, $button.data("inFriendlyConfig"));
 
// reset form
var $tbody = $(tbody);
$tbody.find("'tr"').slice(1).remove(); // all rows except the first (header) row
// add the new values
var curvalue = $button.data("'value"');
$.each(curvalue, function(k, v) {
Twinkle.config.listDialog.addRow(tbody, v.value, v.label);
வரி 1,403 ⟶ 1,479:
 
// save the old value
$button.data("'value"', oldvalue);
};
 
வரி 1,410 ⟶ 1,486:
var current = {};
$(tbody).find('input[type="text"]').each(function(inputkey, input) {
if ($(input).hasClass("'twinkle-config-customlist-value"')) {
current = { value: input.value };
} else {
வரி 1,420 ⟶ 1,496:
}
});
$(button).data("'value"', result);
};
 
வரி 1,430 ⟶ 1,506:
// search tactics
$(Twinkle.config.sections).each(function(sectionkey, section) {
if (section.hidden || (section.adminOnly && !Morebits.userIsInGroup("sysop")userIsSysop)) {
return true; // continue: skip impossibilities
}
வரி 1,440 ⟶ 1,516:
return true; // continue
}
Twinkle.config.resetPref(pref, section.inFriendlyConfig);
foundit = true;
return false; // break
வரி 1,452 ⟶ 1,528:
};
 
Twinkle.config.resetPref = function twinkleconfigResetPref(pref, inFriendlyConfig) {
switch (pref.type) {
 
case "'boolean"':
document.getElementById(pref.name).checked = (inFriendlyConfig ?Twinkle.defaultConfig[pref.name];
Twinkle.defaultConfig.friendly[pref.name] : Twinkle.defaultConfig.twinkle[pref.name]);
break;
 
case "'string"':
case "'integer"':
case "'enum"':
document.getElementById(pref.name).value = (inFriendlyConfig ?Twinkle.defaultConfig[pref.name];
Twinkle.defaultConfig.friendly[pref.name] : Twinkle.defaultConfig.twinkle[pref.name]);
break;
 
case "'set"':
$.each(pref.setValues, function(itemkey, itemvalue) {
if (document.getElementById(pref.name + "'_"' + itemkey)) {
document.getElementById(pref.name + "'_"' + itemkey).checked = Twinkle.defaultConfig[pref.name].indexOf((inFriendlyConfigitemkey) !== ?-1;
Twinkle.defaultConfig.friendly[pref.name] : Twinkle.defaultConfig.twinkle[pref.name]).indexOf(itemkey) !== -1);
}
});
break;
 
case "'customList"':
$(document.getElementById(pref.name)).data("'value"', (inFriendlyConfig ?Twinkle.defaultConfig[pref.name]);
Twinkle.defaultConfig.friendly[pref.name] : Twinkle.defaultConfig.twinkle[pref.name]));
break;
 
default:
alert("'twinkleconfig: unknown data type for preference "' + pref.name);
break;
}
வரி 1,490 ⟶ 1,562:
// no confirmation message - the user can just refresh/close the page to abort
$(Twinkle.config.sections).each(function(sectionkey, section) {
if (section.hidden || (section.adminOnly && !Morebits.userIsInGroup("sysop")userIsSysop)) {
return true; // continue: skip impossibilities
}
$(section.preferences).each(function(prefkey, pref) {
if (!pref.adminOnly || Morebits.userIsInGroup("sysop")userIsSysop) {
Twinkle.config.resetPref(pref, section.inFriendlyConfig);
}
});
வரி 1,504 ⟶ 1,576:
 
Twinkle.config.save = function twinkleconfigSave(e) {
Morebits.status.init( document.getElementById("'twinkle-config-content"') );
 
var userjs = mw.config.get('wgFormattedNamespaces')[mw.config.get('wgNamespaceIds').user] + ':' + mw.config.get('wgUserName') + '/twinkleoptions.js';
Morebits.wiki.actionCompleted.notice = "Save";
var wikipedia_page = new Morebits.wiki.page(userjs, 'Saving preferences to ' + userjs);
 
var userjs = mw.config.get("wgFormattedNamespaces")[mw.config.get("wgNamespaceIds").user] + ":" + mw.config.get("wgUserName") + "/twinkleoptions.js";
var wikipedia_page = new Morebits.wiki.page(userjs, "Saving preferences to " + userjs);
wikipedia_page.setCallbackParameters(e.target);
wikipedia_page.load(Twinkle.config.writePrefs);
வரி 1,515 ⟶ 1,585:
return false;
};
 
// The JSON stringify method in the following code was excerpted from
// http://www.JSON.org/json2.js
// version of 2011-02-23
 
// Douglas Crockford, the code's author, has released it into the Public Domain.
// See http://www.JSON.org/js.html
 
var JSON;
if (!JSON) {
JSON = {};
}
 
(function() {
var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent = ' ', // hardcoded indent
meta = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' };
 
function quote(string) {
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
 
function str(key, holder) {
var i, k, v, length, mind = gap, partial, value = holder[key];
 
if (value && typeof value === 'object' && $.isFunction(value.toJSON)) {
value = value.toJSON(key);
}
 
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
return String(value);
case 'object':
if (!value) {
return 'null';
}
gap += indent;
partial = [];
if ($.isArray(value)) {
length = value.length;
for (i = 0; i < length; ++i) {
partial[i] = str(i, value) || 'null';
}
v = partial.length === 0 ? '[]' : gap ?
'[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
'[' + partial.join(',') + ']';
gap = mind;
return v;
}
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
v = partial.length === 0 ? '{}' : gap ?
'{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
'{' + partial.join(',') + '}';
gap = mind;
return v;
default:
throw new Error( "JSON.stringify: unknown data type" );
}
}
 
if (!$.isFunction(JSON.stringify)) {
JSON.stringify = function (value, ignoredParam1, ignoredParam2) {
ignoredParam1 = ignoredParam2; // boredom
gap = '';
return str('', {'': value});
};
}
}());
 
Twinkle.config.writePrefs = function twinkleconfigWritePrefs(pageobj) {
var form = pageobj.getCallbackParameters();
var statelem = pageobj.getStatusElement();
 
// this is the object which gets serialized into JSON; only
// preferences that this script knows about are kept
var newConfig = {
var newConfig = {optionsVersion: 2};
twinkle: {},
friendly: {}
};
 
// keeping track of all preferences that we encounter
// any others that are set in the user's current config are kept
// this way, preferences that this script doesn't know about are not lost
// (it does mean obsolete prefs will never go away, but... ah well...)
var foundTwinklePrefs = [], foundFriendlyPrefs = [];
 
// a comparison function is needed later on
வரி 1,623 ⟶ 1,599:
// compare({}, {}) === false, but it's good enough for our purposes here
var compare = function(a, b) {
if ($Array.isArray(a)) {
if (a.length !== b.length) {
return false;
வரி 1,630 ⟶ 1,606:
for (var i = 0; asort[i]; ++i) {
// comparison of the two properties of custom lists
if ((typeof asort[i] === "'object"') && (asort[i].label !== bsort[i].label ||
asort[i].value !== bsort[i].value)) {
return false;
வரி 1,638 ⟶ 1,614:
}
return true;
} else {
return a === b;
}
return a === b;
 
};
 
$(Twinkle.config.sections).each(function(sectionkey, section) {
if (section.adminOnly && !Morebits.userIsInGroup("sysop")userIsSysop) {
return; // i.e. "continue" in this context
}
வரி 1,653 ⟶ 1,629:
 
// only read form values for those prefs that have them
if (!section.hidden && (!pref.adminOnly || Morebits.userIsInGroup("sysop"))userIsSysop) {
switchif (pref!section.typehidden) {
switch (pref.type) {
case 'boolean': // read from the checkbox
userValue = form[pref.name].checked;
break;
 
case "boolean"'string': // read from the checkboxinput box or combo box
case 'enum':
userValue = form[pref.name].checked;
userValue = form[pref.name].value;
break;
break;
 
case "string"'integer': // read from the input box or combo box
userValue = parseInt(form[pref.name].value, 10);
case "enum":
if (isNaN(userValue)) {
userValue = form[pref.name].value;
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.');
break;
userValue = null;
}
break;
 
case "integer"'set': // read from the inputset boxof check boxes
userValue = parseInt(form[pref.name].value, 10);
if (isNaN(userValue)pref.setDisplayOrder) {
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.");
userValue = null;
}
break;
 
case "set": // read from the set of check boxes
userValue = [];
if (pref.setDisplayOrder) {
// read only those keys specified in the display order
$.each(pref.setDisplayOrder, function(itemkey, item) {
if (form[pref.name + "'_"' + item].checked) {
userValue.push(item);
}
});
} else {
// read all the keys in the list of values
$.each(pref.setValues, function(itemkey, itemvalue) {
if (form[pref.name + "'_"' + itemkey].checked) {
userValue.push(itemkey);
}
});
}
break;
 
case "'customList"': // read from the jQuery data stored on the button object
userValue = $(form[pref.name]).data("'value"');
break;
 
default:
alert("'twinkleconfig: unknown data type for preference "' + pref.name);
break;
}
} else if (Twinkle.prefs) {
// Retain the hidden preferences that may have customised by the user from twinkleoptions.js
// undefined if not set
userValue = Twinkle.prefs[pref.name];
}
}
 
// only save those preferences that are *different* from the default
if (userValue !== undefined && !compare(userValue, Twinkle.defaultConfig[pref.name])) {
if (section.inFriendlyConfig) {
newConfig[pref.name] = userValue;
if (userValue !== undefined && !compare(userValue, Twinkle.defaultConfig.friendly[pref.name])) {
newConfig.friendly[pref.name] = userValue;
}
foundFriendlyPrefs.push(pref.name);
} else {
if (userValue !== undefined && !compare(userValue, Twinkle.defaultConfig.twinkle[pref.name])) {
newConfig.twinkle[pref.name] = userValue;
}
foundTwinklePrefs.push(pref.name);
}
});
});
 
if (Twinkle.prefs) {
$.each(Twinkle.prefs.twinkle, function(tkey, tvalue) {
if (foundTwinklePrefs.indexOf(tkey) === -1) {
newConfig.twinkle[tkey] = tvalue;
}
});
$.each(Twinkle.prefs.friendly, function(fkey, fvalue) {
if (foundFriendlyPrefs.indexOf(fkey) === -1) {
newConfig.friendly[fkey] = fvalue;
}
});
}
 
var text =
"'// twinkleoptions.js: personal Twinkle preferences file\n"' +
"'//\n"' +
"'// NOTE: The easiest way to change your Twinkle preferences is by using the\n"' +
"'// Twinkle preferences panel, at [["' + Morebits.pageNameNorm + "']].\n"' +
"'//\n"' +
"'// This file is AUTOMATICALLY GENERATED. Any changes you make (aside from\n"' +
"'// changing the configuration parameters in a valid-JavaScript way) will be\n"' +
"'// overwritten the next time you click \"save\" in the Twinkle preferences\n"' +
"'// panel. If modifying this file, make sure to use correct JavaScript.\n"' +
"'// <no' + 'wiki>\n"' +
"'\n' +
'window.Twinkle.prefs = "';
text += JSON.stringify(newConfig, null, 2);
text +=
"';\n"' +
"'\n"' +
"'// End</no' of+ twinkleoptions.js'wiki>\n";' +
'// End of twinkleoptions.js\n';
 
pageobj.setPageText(text);
pageobj.setEditSummary("'Saving Twinkle preferences: automatic edit from [[":' + Morebits.pageNameNorm + "']] ([[WP:TW|TW]])"');
pageobj.setCreateOption("'recreate"');
pageobj.save(Twinkle.config.saveSuccess);
};
 
Twinkle.config.saveSuccess = function twinkleconfigSaveSuccess(pageobj) {
pageobj.getStatusElement().info("'successful"');
 
var noticebox = document.createElement("'div"');
noticebox.className = "'successbox"';
noticebox.style.fontSize = "'100%"';
noticebox.style.marginTop = "'2em"';
noticebox.innerHTML = "'<p><b>Your Twinkle preferences have been saved.</b></p><p>To see the changes, you will need to <b>clear your browser cache entirely</b> (see <a href=\""' + mw.util.getUrl("'WP:BYPASS"') + "\'" title=\"WP:BYPASS\">WP:BYPASS</a> for instructions).</p>"';
Morebits.status.root.appendChild(noticebox);
var noticeclear = document.createElement("'br"');
noticeclear.style.clear = "'both"';
Morebits.status.root.appendChild(noticeclear);
};
வரி 1,770 ⟶ 1,732:
 
 
// </nowiki>
"https://ta.wikipedia.org/wiki/மீடியாவிக்கி:Gadget-twinkleconfig.js" இலிருந்து மீள்விக்கப்பட்டது