User:Gary/nominations viewer.js: Difference between revisions

Content deleted Content added
Improve vote-matching
Update vote detection for semicolons
Line 34:
if (!NominationsViewer.enabledPages) {
NominationsViewer.enabledPages = {
// 'User:Gary/Sandbox': 'nominations',
 
'Wikipedia:Featured article candidates': 'nominations',
Line 734:
*/
function getVoteTextAndPatterns() {
// Look for text that is enclosed within bold text, or level-4 headings.(or greater)
// headings.
const wrapPattern = "('''|====)";
 
Line 748 ⟶ 749:
let opposeText = 'oppose';
 
// Use different words for review pages.
if (nomType('reviews')) {
supportText = 'keep';
opposeText = 'delist';
 
// Pictures has their own specific method of declaring votes.
} else if (nomType('pictures')) {
openPattern = "\\*(\\s)?'''.*?";
closePattern = ".*?'''";
}
 
const createPattern = (text) =>
new 'gi'RegExp(
`(${openPattern}${supportTexttext}${closePattern}|;${textPattern}${text})`,
), 'gi'
),;
 
return {
supportText,
supportPattern: new RegExpcreatePattern(supportText),
`${openPattern}${supportText}${closePattern}`,
'gi'
),
opposeText,
opposePattern: new RegExpcreatePattern({
`${openPattern}${opposeText}${closePattern}`,
'gi'}),
),
};
}