NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Robin Vote Counter // @namespace http://tampermonkey.net/ // @version 0.1 // @description count Robin votes // @author fucking_weebs // @match https://www.reddit.com/robin/* // @grant none // @require http://code.jquery.com/jquery-latest.js // ==/UserScript== /* jshint -W097 */ 'use strict'; var updateCounter = function() { var stay = 0, grow = 0, abandon = 0, novote = 0; $("#robinUserList .robin-room-participant").each(function(i) { var status = $(this).attr('class').match(/robin--vote-class--(.+)/)[1]; if(status == "novote") { novote += 1; } else if(status == "increase") { grow += 1; } else if(status == "continue") { stay += 1; } else if(status == "abandon") { abandon += 1; } }); $("#robinVoteWidget #content").html(''); $("#robinVoteWidget #content").append("<h3>Vote Counter<h3>"); $("#robinVoteWidget #content").append("Grow: " + grow + "<br />"); $("#robinVoteWidget #content").append("Abandon: " + abandon + "<br />"); $("#robinVoteWidget #content").append("Stay: " + stay + "<br />"); $("#robinVoteWidget #content").append("Abstaining: " + novote + "<br />"); } $(document).ready(function() { $("#robinVoteWidget").append("<div id='counter'></div>"); $("#robinVoteWidget #counter").append("<div id='content'></div>"); $("#robinVoteWidget #content").css("width", "150px"); $("#robinVoteWidget #counter").append("<button>Refresh Counter</button>"); $("#counter").css("margin", "0 auto"); $("#counter").css("width", "300px"); $("#content").css("float", "left"); $("#counter button").css("margin", "0 auto"); $("#counter button").css("float", "right"); $("#counter button").css("width", "75px"); $("#counter button").css("top", "0px"); $("#counter").css("font-size", "13px"); $("#counter button").click(updateCounter); updateCounter(); });