-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathVoteCounter.js
More file actions
31 lines (25 loc) · 1.65 KB
/
Copy pathVoteCounter.js
File metadata and controls
31 lines (25 loc) · 1.65 KB
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
/*
- Gives an approximate count of keeps, deletes, supports, opposes, etc. in deletion discussions and RFCs.
- For AFD, MFD, and GAR, displays them at top of page.
- For everything else, displays them by the section heading.
- Counts are approximate. If people do weird things like '''Delete/Merge''', it will be counted twice.
- Adds an extra delete vote to AFDs and MFDs, as it's assumed the nominator is voting delete.
- If you run across terms that aren't counted but should be, leave a message on the talk page. Let's add as many relevant terms as we can :)
*/
const { VoteCounterController } = require( './modules/VoteCounterController.js' );
$( async () => {
await mw.loader.using( [ 'mediawiki.api' ], async () => {
await ( new VoteCounterController() ).execute();
} );
} );
/*
TEST CASES:
- don't count sections (AFD): https://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Judd_Hamilton_(2nd_nomination)
- count sections (RFC): https://en.wikipedia.org/wiki/Wikipedia:Reliable_sources/Noticeboard/Archive_393#Discussion_(The_Economist)
- count sections and adjust !votes (RFD): https://en.wikipedia.org/wiki/Wikipedia:Redirects_for_discussion/Log/2022_January_1
BUGS:
- There's an extra delete vote in closed RFDs
*/
// TODO: write a parser that keeps track of pairs of ''', to fix issue with '''vote''' text '''vote''' sometimes counting the text between them
// TODO: handle CFD big merge lists, e.g. https://en.wikipedia.org/wiki/Wikipedia:Categories_for_discussion/Log/2021_December_10#Category:Cornish_emigrans_and_related_subcats
// TODO: put a "days/hours left" timer at the top of AFDs. will need to check for relisting messages, and for page creation date