User:Pythoncoder/Scripts/voteSymbols.js

// Revised from User:Ais523/votesymbols.js // Code for adding icons to !votes in AfDs, RfAs, etc... // Doesn't affect the page, just shows the icons when this code is installed. // Please see Image:Votesymbols.js-enhanced_SfD.png and // c:Category:Norro style 1 icons for copyright info on the images that are added.

function lowerNoPunct(s) { return s.toLowerCase.split('.').join().split(',').join().split('!').join().split(':').join().split(';').join().split('+').join(); } function mergeWords(a, b, j, k) { try { if(lowerNoPunct(j[k])==a&&lowerNoPunct(j[k+1])==b) { j.splice(k, 2, a+' '+b); }   return j;  } catch(e) { return j; } }

$(function { if(mw.config.get('wgNamespaceNumber')===0) return; //avoid article space, generally speaking  if(mw.config.get('wgNamespaceNumber')===6) return; //file  if(mw.config.get('wgNamespaceNumber')===8) return; //mediawiki  if(mw.config.get('wgNamespaceNumber')===10) return; //template  if(mw.config.get('wgNamespaceNumber')===12) return; //category  if(mw.config.get('wgNamespaceNumber')===14) return; //help  if(mw.config.get('wgNamespaceNumber')===118) return; //draft  if(mw.config.get('wgNamespaceNumber')===100) return; //portal  var vs=  "//upload.wikimedia.org/wikipedia/commons/thumb/9/94/Symbol_support_vote.svg/30px-Symbol_support_vote.svg.png#"+  "//upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Symbol_keep_vote.svg/30px-Symbol_keep_vote.svg.png#"+  "//upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Symbol_oppose_vote.svg/30px-Symbol_oppose_vote.svg.png#"+  "//upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_delete_vote.svg/30px-Symbol_delete_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_neutral_vote.svg/30px-Symbol_neutral_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Symbol_merge_vote.svg/30px-Symbol_merge_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/5/50/Symbol_move_vote.svg/30px-Symbol_move_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Symbol_redirect_vote.svg/30px-Symbol_redirect_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Symbol_opinion_vote.svg/30px-Symbol_opinion_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Symbol_comment_vote.svg/30px-Symbol_comment_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Symbol_unsupport_vote.svg/30px-Symbol_unsupport_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Symbol_question.svg/30px-Symbol_question.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/2/2a/Symbol_dab_class.svg/30px-Symbol_dab_class.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/5/54/Symbol_wait.svg/30px-Symbol_wait.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Symbol_rename_vote.svg/30px-Symbol_rename_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Symbol_support2_vote.svg/30px-Symbol_support2_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Symbol_no_support_vote.svg/30px-Symbol_no_support_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Symbol_split_vote.svg/30px-Symbol_split_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/6/61/Symbol_abstain_vote.svg/30px-Symbol_abstain_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/0/09/Symbol_draft_class.svg/30px-Symbol_draft_class.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/1/13/Symbol_user_class.svg/30px-Symbol_user_class.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/d/db/Symbol_list_class.svg/30px-Symbol_list_class.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Symbol_reply.svg/30px-Symbol_reply.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/6/66/Symbol_create_protect_vote.svg/30px-Symbol_create_protect_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/8/85/Symbol_unrelated.svg/30px-Symbol_unrelated.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/8/8c/Symbol_information_vote.svg/30px-Symbol_information_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/1/18/Symbol_version_future.svg/30px-Symbol_version_future.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Bouncing_Snowball.png/30px-Bouncing_Snowball.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/1/1b/Symbol_plain_white.svg/30px-Symbol_plain_white.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Symbol_speedy_delete_vote.svg/30px-Symbol_speedy_delete_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Symbol_speedy_keep_vote.svg/30px-Symbol_speedy_keep_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/2/22/Symbol_speedy_redirect_vote.svg/30px-Symbol_speedy_redirect_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/8/84/Symbol_strong_support_vote.svg/30px-Symbol_strong_support_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/5/5e/Symbol_oppose_vote_oversat.svg/30px-Symbol_oppose_vote_oversat.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/8/8c/GA_candidate.svg/30px-GA_candidate.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/f/f5/BA_candidate.svg/30px-BA_candidate.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Symbol_conditional_support.svg/30px-Symbol_conditional_support.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Symbol_wait_blue.svg/30px-Symbol_wait_blue.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/8/83/Symbol_template_class_pink.svg/30px-Symbol_template_class_pink.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Symbol_mark_historical_vote.svg/30px-Symbol_mark_historical_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/6/63/Symbol_speedy_merge_vote.svg/30px-Symbol_speedy_merge_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Symbol_speedy_rename_vote.svg/30px-Symbol_speedy_rename_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Symbol_suggestion_vote.svg/30px-Symbol_suggestion_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Symbol_template_class.svg/30px-Symbol_template_class.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/1/14/Symbol_death.svg/30px-Symbol_death.svg.png#"+ ""; var vt=vs.split("#"); var la=[]; la['support']=0; la['agree']=0; la['endorse']=0; la['accept']=0; la['good block']=0; la['keep']=1; la['allow']=1; la['permit']=1; la['oppose']=2; la['disagree']=2; la['overturn']=2; la['object']=2; la['disallow']=2; la['decline']=2; la['bad block']=2; la['opposition']=2; la['objection']=2; la['delete']=3; la['remove']=3; la['pull']=3; la['neutral']=4; la['meh']=4; la['ambivalent']=4; la['unsure']=4; la['merge']=5; la['upmerge']=5; la['move']=6; la['transwiki']=6; la['convert']=6; la['transwikify']=6; la['redirect']=7; la['retarget']=7; la['repost']=7; la['relist']=8; la['change']=8; la['recuse']=8; la['refine']=8; la['mixed']=8; // Note that icon 8 on the list is often used for debate-specific !votes // The original keyword for icon 8 is "opinion" (see Chinese Wikipedia) // but that causes a lot of false positives here la['comment']=9; la['note']=9; la['comments']=9; la['statement']=9; la['delist']=10; la['demote']=10; la['question']=11; la['query']=11; la['request']=11; la['inquiry']=11; la['disambiguate']=12; la['dab']=12; la['dabify']=12; la['set index']=12; la['sia']=12; la['wait']=13; la['hold']=13; la['postpone']=13; la['rename']=14; la['undelete']=15; la['restore']=15; la['close']=16; la['speedy close']=16; la['no consensus']=16; la['bad rfc']=16; la['invalid rfc']=16; la['split']=17; la['abstain']=18; la['abstention']=18; la['unnecessary']=18; la['moot']=18; la['mu']=18; la['irrelevant']=18; la['void']=18; la['draftify']=19; la['incubate']=19; la['userfy']=20; la['listify']=21; la['blurb']=21; la['reply']=22; la['salt']=23; la['withdraw']=24; la['withdrawn']=24; la['information']=25; la['info']=25; la['update']=26; la['answer']=26; la['snow']=27; la['snowball']=27; la['blank']=28;la['keep blanked']=28; la['speedy']=29; la['speedy delete']=29; la['speedy keep']=30; la['speedy redirect']=31; la['strong support']=32; la['strongly support']=32; la['strong agree']=32; la['strongly agree']=32; la['strongest support']=32; la['strong oppose']=33; la['strongly oppose']=33; la['strong disagree']=33; la['strongly disagree']=33; la['strong object']=33; la['strongly object']=33; la['strong opposition']=33; la['strong objection']=33; la['strongest oppose']=33; la['weak support']=34; la['weakly support']=34; la['weak agree']=34; la['weakly agree']=34; la['weakest support']=34; la['weak oppose']=35; la['weakly oppose']=35; la['weak disagree']=35; la['weakly disagree']=35; la['weak object']=35; la['weakly object']=35; la['weak opposition']=35; la['weak objection']=35; la['weakest oppose']=35; la['partial support']=36; la['conditional support']=36; la['semi-support']=36; la['ongoing']=37; la['tag']=38; la['retag']=38; la['historical']=39; la['tag historical']=39; la['deprecate']=39; la['speedy merge']=40; la['speedy rename']=41; la['suggestion']=42; la['suggest']=42; la['substitute']=43; la['subst']=43; la['rd']=44; la['recent death']=44;

var boldTagContent=document.body.getElementsByTagName("B"); i=boldTagContent.length; while(i--) { var j,k; j=boldTagContent[i].textContent j=j.split("<").join(" ").split(">").join(" ").split("/").join(" ").split(" "); k=0; var x=""; while(k<j.length) { mergeWords('no','consensus',j,k); if(lowerNoPunct(j[k])=="don't"||lowerNoPunct(j[k])=='not'      ||lowerNoPunct(j[k])=='no'||lowerNoPunct(j[k])=='without') break;

mergeWords('speedy','close',j,k); mergeWords('speedy','delete',j,k); mergeWords('speedy','keep',j,k); mergeWords('speedy','redirect',j,k); mergeWords('speedy','merge',j,k); mergeWords('speedy','rename',j,k); mergeWords('strong','support',j,k); mergeWords('strongly','support',j,k); mergeWords('weak','support',j,k); mergeWords('weakly','support',j,k); mergeWords('strong','oppose',j,k); mergeWords('strongly','oppose',j,k); mergeWords('weak','oppose',j,k); mergeWords('weakly','oppose',j,k); mergeWords('strong','agree',j,k); mergeWords('strongly','agree',j,k); mergeWords('weak','agree',j,k); mergeWords('weakly','agree',j,k); mergeWords('strong','disagree',j,k); mergeWords('strongly','disagree',j,k); mergeWords('weak','disagree',j,k); mergeWords('weakly','disagree',j,k); mergeWords('partial','support',j,k); mergeWords('conditional','support',j,k); mergeWords('good','block',j,k); mergeWords('bad','block',j,k); mergeWords('set','index',j,k); mergeWords('keep','blanked',j,k); mergeWords('tag','historical',j,k); mergeWords('strong','object',j,k); mergeWords('strongly','object',j,k); mergeWords('weak','object',j,k); mergeWords('weakly','object',j,k); mergeWords('strong','opposition',j,k); mergeWords('weak','opposition',j,k); mergeWords('strongest','support',j,k); mergeWords('strongest','oppose',j,k); mergeWords('weakest','support',j,k); mergeWords('weakest','oppose',j,k); mergeWords('strong','objection',j,k); mergeWords('weak','objection',j,k); mergeWords('bad','rfc',j,k); mergeWords('invalid','rfc',j,k); mergeWords('recent','death',j,k); var l=la[lowerNoPunct(j[k])]; if (l!==undefined && typeof l === 'number') { x+=' ' }     k++; }   if(x!=="") boldTagContent[i].innerHTML=x+boldTagContent[i].innerHTML; } }); //