forked from wikimedia-gadgets/twinkle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
twinkleconfig.js
1736 lines (1575 loc) · 60.5 KB
/
twinkleconfig.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// <nowiki>
(function($) {
/*
****************************************
*** twinkleconfig.js: Preferences module
****************************************
* Mode of invocation: Adds configuration form to Wikipedia:Twinkle/Preferences,
and adds an ad box to the top of user subpages belonging to the
currently logged-in user which end in '.js'
* Active on: What I just said. Yeah.
I, [[User:This, that and the other]], originally wrote this. If the code is misbehaving, or you have any
questions, don't hesitate to ask me. (This doesn't at all imply [[WP:OWN]]ership - it's just meant to
point you in the right direction.) -- TTO
*/
Twinkle.config = {};
Twinkle.config.watchlistEnums = {
'yes': 'Add to watchlist (indefinitely)',
'no': "Don't add to watchlist",
'default': 'Follow your site preferences',
'1 week': 'Watch for 1 week',
'1 month': 'Watch for 1 month',
'3 months': 'Watch for 3 months',
'6 months': 'Watch for 6 months'
};
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', a7: 'A7', a9: 'A9', a10: 'A10', a11: 'A11',
u1: 'U1', u2: 'U2', u5: 'U5',
f1: 'F1', f2: 'F2', f3: 'F3', f7: 'F7', f8: 'F8', f9: 'F9',
c1: 'C1', c4: 'C4',
r2: 'R2', r3: 'R3', r4: 'R4'
},
csdCriteriaDisplayOrder: [
'db',
'g1', 'g2', 'g3', 'g4', 'g5', 'g6', 'g7', 'g8', 'g10', 'g11', 'g12', 'g13', 'g14',
'a1', 'a2', 'a3', 'a7', 'a9', 'a10', 'a11',
'u1', 'u2', 'u5',
'f1', 'f2', 'f3', 'f7', 'f8', 'f9',
'c1', 'c4',
'r2', 'r3', 'r4'
],
csdCriteriaNotification: {
db: 'Custom rationale ({{db}})',
g1: 'G1', g2: 'G2', g3: 'G3', g4: 'G4', g6: 'G6 ("copy-paste move" only)',
g10: 'G10', g11: 'G11', g12: 'G12', g13: 'G13', g14: 'G14',
a1: 'A1', a2: 'A2', a3: 'A3', a7: 'A7', a9: 'A9', a10: 'A10', a11: 'A11',
u5: 'U5',
f1: 'F1', f2: 'F2', f3: 'F3', f7: 'F7', f9: 'F9',
c1: 'C1',
r2: 'R2', r3: 'R3', r4: 'R4'
},
csdCriteriaNotificationDisplayOrder: [
'db',
'g1', 'g2', 'g3', 'g4', 'g6', 'g10', 'g11', 'g12', 'g13', 'g14',
'a1', 'a2', 'a3', 'a7', 'a9', 'a10', 'a11',
'u5',
'f1', 'f2', 'f3', 'f7', 'f9',
'c1',
'r2', 'r3', 'r4'
],
csdAndImageDeletionCriteria: {
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', a7: 'A7', a9: 'A9', a10: 'A10', a11: 'A11',
u1: 'U1', u2: 'U2', u5: 'U5',
f1: 'F1', f2: 'F2', f3: 'F3', f4: 'F4', f5: 'F5', f6: 'F6', f7: 'F7', f8: 'F8', f9: 'F9', f11: 'F11',
c1: 'C1', c4: 'C4',
r2: 'R2', r3: 'R3', r4: 'R4'
},
csdAndImageDeletionCriteriaDisplayOrder: [
'db',
'g1', 'g2', 'g3', 'g4', 'g5', 'g6', 'g7', 'g8', 'g10', 'g11', 'g12', 'g13', 'g14',
'a1', 'a2', 'a3', 'a7', 'a9', 'a10', 'a11',
'u1', 'u2', 'u5',
'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f11',
'c1', 'c4',
'r2', 'r3', 'r4'
],
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',
118: 'Draft',
119: 'Draft talk',
710: 'TimedText',
711: 'TimedText talk',
828: 'Module',
829: 'Module talk'
}
};
/**
* Section entry format:
*
* {
* title: <human-readable section title>,
* module: <name of the associated module, used to link to sections>,
* 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>,
* preferences: [
* {
* name: <TwinkleConfig property name>,
* label: <human-readable short description - used as a form label>,
* helptip: <(optional) human-readable text (using valid HTML) that complements the description, like limits, warnings, etc.>
* adminOnly: <true for admin-only preferences>,
* type: <string|boolean|integer|enum|set|customList> (customList stores an array of JSON objects { value, label }),
* enumValues: <for type = "enum": a JSON object where the keys are the internal names and the values are human-readable strings>,
* setValues: <for type = "set": a JSON object where the keys are the internal names and the values are human-readable strings>,
* setDisplayOrder: <(optional) for type = "set": an array containing the keys of setValues (as strings) in the order that they are displayed>,
* customListValueTitle: <for type = "customList": the heading for the left "value" column in the custom list editor>,
* customListLabelTitle: <for type = "customList": the heading for the right "label" column in the custom list editor>
* },
* . . .
* ]
* },
* . . .
*
*/
Twinkle.config.sections = [
{
title: 'General',
module: 'general',
preferences: [
// 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' }
},
// TwinkleConfig.dialogLargeFont (boolean)
{
name: 'dialogLargeFont',
label: 'Use larger text in Twinkle dialogs',
type: 'boolean'
},
// Twinkle.config.disabledModules (array)
{
name: 'disabledModules',
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.',
type: 'set',
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', rollback: 'Revert and rollback' }
},
// Twinkle.config.disabledSysopModules (array)
{
name: 'disabledSysopModules',
label: 'Turn off the selected admin-only modules',
helptip: 'Anything you select here will NOT be available for use, so act with care. Uncheck to reactivate.',
adminOnly: true,
type: 'set',
setValues: { block: 'Block', deprod: 'DePROD', batchdelete: 'D-batch', batchprotect: 'P-batch', batchundelete: 'Und-batch' }
}
]
},
{
title: 'ARV',
module: 'arv',
preferences: [
{
name: 'spiWatchReport',
label: 'Add sockpuppet report pages to watchlist',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
}
]
},
{
title: 'Block user',
module: 'block',
adminOnly: true,
preferences: [
// TwinkleConfig.defaultToBlock64 (boolean)
// Whether to default to just blocking the /64 on or off
{
name: 'defaultToBlock64',
label: 'For IPv6 addresses, select the option to block the /64 range by default',
type: 'boolean'
},
// TwinkleConfig.defaultToPartialBlocks (boolean)
// Whether to default partial blocks on or off
{
name: 'defaultToPartialBlocks',
label: 'Select partial blocks by default when opening the block menu',
helptip: 'If the user is already blocked, this will be overridden in favor of defaulting to the current block type',
type: 'boolean'
},
// TwinkleConfig.blankTalkpageOnIndefBlock (boolean)
// if true, blank the talk page when issuing an indef block notice (per [[WP:UWUL#Indefinitely blocked users]])
{
name: 'blankTalkpageOnIndefBlock',
label: 'Blank the talk page when indefinitely blocking 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: 'boolean'
}
]
},
{
title: 'Image deletion (DI)',
module: 'image',
preferences: [
// TwinkleConfig.notifyUserOnDeli (boolean)
// If the user should be notified after placing a file deletion tag
{
name: 'notifyUserOnDeli',
label: 'Check the "notify initial uploader" box by default',
type: 'boolean'
},
// TwinkleConfig.deliWatchPage (string)
// The watchlist setting of the page tagged for deletion.
{
name: 'deliWatchPage',
label: 'Add image page to watchlist when tagging',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
// TwinkleConfig.deliWatchUser (string)
// The watchlist setting of the user talk page if a notification is placed.
{
name: 'deliWatchUser',
label: 'Add user talk page of initial uploader to watchlist when notifying',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
}
]
},
{
title: 'Page protection ' + (Morebits.userIsSysop ? '(PP)' : '(RPP)'),
module: 'protect',
preferences: [
{
name: 'watchRequestedPages',
label: 'Add page to watchlist when requesting protection',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
{
name: 'watchPPTaggedPages',
label: 'Add page to watchlist when tagging with protection template',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
{
name: 'watchProtectedPages',
label: 'Add page to watchlist when protecting',
helptip: 'If also tagging the page after protection, that preference will be favored.',
adminOnly: true,
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
}
]
},
{
title: 'Proposed deletion (PROD)',
module: 'prod',
preferences: [
// TwinkleConfig.watchProdPages (string)
// Watchlist setting when applying prod template to page
{
name: 'watchProdPages',
label: 'Add article to watchlist when tagging',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
// TwinkleConfig.markProdPagesAsPatrolled (boolean)
// If, when applying prod template to page, to mark the page as curated/patrolled (if the page was reached from NewPages)
{
name: 'markProdPagesAsPatrolled',
label: 'Mark page as patrolled/reviewed when tagging (if possible)',
helptip: 'This should probably not be checked as doing so is against best practice consensus',
type: 'boolean'
},
// TwinkleConfig.prodReasonDefault (string)
// The prefilled PROD reason.
{
name: 'prodReasonDefault',
label: 'Prefilled PROD reason',
type: 'string'
},
{
name: 'logProdPages',
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.',
type: 'boolean'
},
{
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: 'Revert and rollback',
module: 'rollback',
preferences: [
// TwinkleConfig.autoMenuAfterRollback (bool)
// Option to automatically open the warning menu if the user talk page is opened post-reversion
{
name: 'autoMenuAfterRollback',
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: 'openTalkPage',
label: 'Open user talk page after these types of reversions',
type: 'set',
setValues: { agf: 'AGF rollback', norm: 'Normal rollback', vand: 'Vandalism rollback' }
},
// TwinkleConfig.openTalkPageOnAutoRevert (bool)
// 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.
{
name: 'openTalkPageOnAutoRevert',
label: 'Open user talk page when invoking rollback from user contributions or recent changes',
helptip: 'When this is on, the desired options must be enabled in the previous setting for this to work.',
type: 'boolean'
},
// TwinkleConfig.rollbackInPlace (bool)
//
{
name: 'rollbackInPlace',
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.",
type: 'boolean'
},
// TwinkleConfig.markRevertedPagesAsMinor (array)
// What types of actions that should result in marking edit as minor
{
name: 'markRevertedPagesAsMinor',
label: 'Mark as minor edit for these types of reversions',
type: 'set',
setValues: { agf: 'AGF rollback', norm: 'Normal rollback', vand: 'Vandalism rollback', torev: '"Restore this version"' }
},
// TwinkleConfig.watchRevertedPages (array)
// What types of actions that should result in forced addition to watchlist
{
name: 'watchRevertedPages',
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"' }
},
// TwinkleConfig.watchRevertedExpiry
// If any of the above items are selected, whether to expire the watch
{
name: 'watchRevertedExpiry',
label: 'When reverting a page, how long to watch it for',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
// TwinkleConfig.offerReasonOnNormalRevert (boolean)
// If to offer a prompt for extra summary reason for normal reverts, default to true
{
name: 'offerReasonOnNormalRevert',
label: 'Prompt for reason for normal rollbacks',
helptip: '"Normal" rollbacks are the ones that are invoked from the middle [rollback] link.',
type: 'boolean'
},
{
name: 'confirmOnRollback',
label: 'Require confirmation before reverting (all devices)',
helptip: 'For users of pen or touch devices, and chronically indecisive people.',
type: 'boolean'
},
{
name: 'confirmOnMobileRollback',
label: 'Require confirmation before reverting (mobile devices only)',
helptip: 'Avoid accidental reversions when on mobile devices.',
type: 'boolean'
},
// TwinkleConfig.showRollbackLinks (array)
// Where Twinkle should show rollback links:
// diff, others, mine, contribs, history, recent
// Note from TTO: |contribs| seems to be equal to |others| + |mine|, i.e. redundant, so I left it out heres
{
name: 'showRollbackLinks',
label: 'Show rollback links on these pages',
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' }
}
]
},
{
title: 'Shared IP tagging',
module: 'shared',
preferences: [
{
name: 'markSharedIPAsMinor',
label: 'Mark shared IP tagging as a minor edit',
type: 'boolean'
}
]
},
{
title: 'Speedy deletion (CSD)',
module: 'speedy',
preferences: [
{
name: 'speedySelectionStyle',
label: 'When to go ahead and tag/delete the page',
type: 'enum',
enumValues: { buttonClick: 'When I click "Submit"', radioClick: 'As soon as I click an option' }
},
// TwinkleConfig.watchSpeedyPages (array)
// Whether to add speedy tagged or deleted pages to watchlist
{
name: 'watchSpeedyPages',
label: 'Add page to watchlist when using these criteria',
type: 'set',
setValues: Twinkle.config.commonSets.csdCriteria,
setDisplayOrder: Twinkle.config.commonSets.csdCriteriaDisplayOrder
},
// TwinkleConfig.watchSpeedyExpiry
// If any of the above items are selected, whether to expire the watch
{
name: 'watchSpeedyExpiry',
label: 'When tagging a page, how long to watch it for',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
// 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: 'markSpeedyPagesAsPatrolled',
label: 'Mark page as patrolled/reviewed when tagging (if possible)',
helptip: 'This should probably not be checked as doing so is against best practice consensus',
type: 'boolean'
},
// TwinkleConfig.watchSpeedyUser (string)
// The watchlist setting of the user talk page if they receive a notification.
{
name: 'watchSpeedyUser',
label: 'Add user talk page of initial contributor to watchlist (when notifying)',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
// TwinkleConfig.welcomeUserOnSpeedyDeletionNotification (array of strings)
// On what types of speedy deletion notifications shall the user be welcomed
// with a "firstarticle" notice if their talk page has not yet been created.
{
name: 'welcomeUserOnSpeedyDeletionNotification',
label: 'Welcome page creator when notifying with these criteria',
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: Twinkle.config.commonSets.csdCriteriaNotification,
setDisplayOrder: Twinkle.config.commonSets.csdCriteriaNotificationDisplayOrder
},
// TwinkleConfig.notifyUserOnSpeedyDeletionNomination (array)
// What types of actions should result in the author of the page being notified of nomination
{
name: 'notifyUserOnSpeedyDeletionNomination',
label: 'Notify page creator 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.warnUserOnSpeedyDelete (array)
// What types of actions should result in the author of the page being notified of speedy deletion (admin only)
{
name: 'warnUserOnSpeedyDelete',
label: 'Notify page creator when deleting under these criteria',
helptip: 'Even if you choose to notify from the CSD screen, the notification will only take place for those criteria selected here.',
adminOnly: true,
type: 'set',
setValues: Twinkle.config.commonSets.csdCriteriaNotification,
setDisplayOrder: Twinkle.config.commonSets.csdCriteriaNotificationDisplayOrder
},
// TwinkleConfig.promptForSpeedyDeletionSummary (array of strings)
{
name: 'promptForSpeedyDeletionSummary',
label: 'Allow editing of deletion summary when deleting under these criteria',
adminOnly: true,
type: 'set',
setValues: Twinkle.config.commonSets.csdAndImageDeletionCriteria,
setDisplayOrder: Twinkle.config.commonSets.csdAndImageDeletionCriteriaDisplayOrder
},
// TwinkleConfig.deleteTalkPageOnDelete (boolean)
// If talk page if exists should also be deleted (CSD G8) when spedying a page (admin only)
{
name: 'deleteTalkPageOnDelete',
label: 'Check the "also delete talk page" box by default',
adminOnly: true,
type: 'boolean'
},
{
name: 'deleteRedirectsOnDelete',
label: 'Check the "also delete redirects" box by default',
adminOnly: true,
type: 'boolean'
},
// TwinkleConfig.deleteSysopDefaultToDelete (boolean)
// Make the CSD screen default to "delete" instead of "tag" (admin only)
{
name: 'deleteSysopDefaultToDelete',
label: 'Default to outright deletion instead of speedy tagging',
helptip: 'If there is a CSD tag already present, Twinkle will always default to "delete" mode',
adminOnly: true,
type: 'boolean'
},
// TwinkleConfig.speedyWindowWidth (integer)
// Defines the width of the Twinkle SD window in pixels
{
name: 'speedyWindowWidth',
label: 'Width of speedy deletion window (pixels)',
type: 'integer'
},
// TwinkleConfig.speedyWindowWidth (integer)
// Defines the width of the Twinkle SD window in pixels
{
name: 'speedyWindowHeight',
label: 'Height of speedy deletion window (pixels)',
helptip: 'If you have a big monitor, you might like to increase this.',
type: 'integer'
},
{
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.csdAndImageDeletionCriteria,
setDisplayOrder: Twinkle.config.commonSets.csdAndImageDeletionCriteriaDisplayOrder
}
]
},
{
title: 'Tag',
module: 'tag',
preferences: [
{
name: 'watchTaggedVenues',
label: 'Add page to watchlist when tagging these type of pages',
type: 'set',
setValues: { articles: 'Articles', drafts: 'Drafts', redirects: 'Redirects', files: 'Files' }
},
{
name: 'watchTaggedPages',
label: 'When tagging a page, how long to watch it for',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
{
name: 'watchMergeDiscussions',
label: 'Add talk pages to watchlist when starting merge discussions',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
{
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'
}
]
},
{
title: 'Talkback',
module: 'talkback',
preferences: [
{
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 talkback and please see',
tooltip: 'Should NOT include the equals signs ("==") used for wikitext formatting',
type: 'string'
},
{
name: 'mailHeading',
label: "Section heading to use for \"you've got mail\" notices",
tooltip: 'Should NOT include the equals signs ("==") used for wikitext formatting',
type: 'string'
}
]
},
{
title: 'Unlink',
module: 'unlink',
preferences: [
// TwinkleConfig.unlinkNamespaces (array)
// In what namespaces unlink should happen, default in 0 (article), 10 (template), 100 (portal), and 118 (draft)
{
name: 'unlinkNamespaces',
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',
module: 'warn',
preferences: [
// TwinkleConfig.defaultWarningGroup (int)
// 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
{
name: 'combinedSingletMenus',
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.',
type: 'boolean'
},
// TwinkleConfig.showSharedIPNotice may take arguments:
// true: to show shared ip notice if an IP address
// false: to not print the notice
{
name: 'showSharedIPNotice',
label: 'Add extra notice on shared IP talk pages',
helptip: 'Notice used is {{Shared IP advice}}',
type: 'boolean'
},
// TwinkleConfig.watchWarnings (string)
// Watchlist setting for the page which has been dispatched an warning or notice
{
name: 'watchWarnings',
label: 'Add user talk page to watchlist when notifying',
type: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
// TwinkleConfig.oldSelect (boolean)
// if true, use the native select menu rather the select2-based one
{
name: 'oldSelect',
label: 'Use the non-searchable classic select menu',
type: 'boolean'
},
{
name: 'customWarningList',
label: 'Custom warning templates to display',
helptip: 'You can add individual templates or user subpages. Custom warnings appear in the "Custom warnings" category within the warning dialog box.',
type: 'customList',
customListValueTitle: 'Template name (no curly brackets)',
customListLabelTitle: 'Text to show in warning list (also used as edit summary)'
}
]
},
{
title: 'Welcome user',
module: 'welcome',
preferences: [
{
name: 'topWelcomes',
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: 'enum',
enumValues: Twinkle.config.watchlistEnums
},
{
name: 'insertUsername',
label: 'Add your username to the template (where applicable)',
helptip: "Some welcome templates have an opening sentence like \"Hi, I'm <username>. 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 (which only appears if the editor\'s user talk page has not been created yet) will',
helptip: 'If you choose to welcome automatically, the template you specify below will be used.',
type: 'enum',
enumValues: { auto: 'immediately post the welcome template specified below', 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'
}
]
},
{
title: 'XFD (deletion discussions)',
module: 'xfd',
preferences: [
{
name: 'logXfdNominations',
label: 'Keep a log in userspace of all pages you nominate for a deletion discussion (XfD)',
helptip: 'The userspace log offers a good way to keep track of all pages you nominate for XfD using Twinkle.',
type: 'boolean'
},
{
name: 'xfdLogPageName',
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.',
type: 'string'
},
{
name: 'noLogOnXfdNomination',
label: 'Do not create a userspace log entry when nominating at this venue',
type: '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.
{
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.
{
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.
{
name: 'xfdWatchList',
label: 'Add the daily log/list page to the watchlist (AfD and MfD)',
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.
{
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.
{
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: [
// twinklerollback.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'
},
// How many pages should be queried by deprod and batchdelete/protect/undelete
{
name: 'batchMax',
type: 'integer',
adminOnly: true
},
// How many pages should be processed at a time by deprod and batchdelete/protect/undelete
{
name: 'batchChunks',
type: 'integer',
adminOnly: true
}
]
}
]; // end of Twinkle.config.sections
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') {
if (!document.getElementById('twinkle-config')) {
return; // maybe the page is misconfigured, or something - but any attempt to modify it will be pointless
}
// set style to nothing to prevent conflict with external css
document.getElementById('twinkle-config').removeAttribute('style');
document.getElementById('twinkle-config-titlebar').removeAttribute('style');
const contentdiv = document.getElementById('twinkle-config-content');
contentdiv.textContent = ''; // clear children
// let user know about possible conflict with skin js/common.js file
// (settings in that file will still work, but they will be overwritten by twinkleoptions.js settings)
if (window.TwinkleConfig || window.FriendlyConfig) {
const contentnotice = document.createElement('p');
contentnotice.innerHTML = '<table class="plainlinks morebits-ombox morebits-ombox-content"><tr><td class="morebits-mbox-image">' +
'<img alt="" src="https://upload.wikimedia.org/wikipedia/commons/3/38/Imbox_content.png" /></td>' +
'<td class="morebits-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') +
'.js', { action: 'edit' }) + '" target="_blank"><b>edit your personal skin javascript file</b></a> or <a href="' +
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>' +
'</td></tr></table>';
contentdiv.appendChild(contentnotice);
}
// start a table of contents
const toctable = document.createElement('div');
toctable.className = 'toc';
toctable.style.marginLeft = '0.4em';
// create TOC title
const toctitle = document.createElement('div');
toctitle.id = 'toctitle';