Skip to content

Instantly share code, notes, and snippets.

@sprngr
Last active April 3, 2016 00:18
Show Gist options
  • Save sprngr/877bc9e8e77270aa4aa92d073ecb83e6 to your computer and use it in GitHub Desktop.
Save sprngr/877bc9e8e77270aa4aa92d073ecb83e6 to your computer and use it in GitHub Desktop.
Tampermonkey script to enhance the experience around Robin (Reddit's April Fool's prank/social experiment)
// ==UserScript==
// @name Robin Enhancement Suite
// @namespace http://github.com/sprngr
// @version 0.5
// @description Trying to make Robin more awesome
// @author sprngr
// @match https://www.reddit.com/robin*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var notifications = $('.robin-chat--sidebar-widget.robin-chat--notification-widget');
var resWidget = '';
resWidget += '<h2 style="display:inline-block;"><span class="count"></span> Participants</h2>';
resWidget += '<p style="display:inline-block; padding-left:5px;"><small>(<span class="active"></span> Active / <span class="away"></span> Away)</small></p>';
resWidget += '<h3 style="margin: 5px 0px;"><span class="abandon-count"></span> Abandon | ';
resWidget += '<span class="stay-count"></span> Stay | ';
resWidget += '<span class="grow-count"></span> Grow | ';
resWidget += '<span class="novote-count"></span> No Vote</h3>';
notifications.prepend(resWidget);
$('.robin--username :not(a)').each(function(index) {
var username = $(this).text();
if (username != '[robin]') {
$(this).html('<a href="//reddit.com/u/'+username+'">'+username+'</a>');
}
});
update();
function update() {
// Total, Active/Away
var participantTotal = $('.robin-room-participant').length;
var participantActive = $('.robin-room-participant.robin--presence-class--present').length;
var participantAway = $('.robin-room-participant.robin--presence-class--away').length;
var abandonCount = $('.robin-room-participant.robin--vote-class--abandon').length;
var growCount = $('.robin-room-participant.robin--vote-class--increase').length;
var stayCount = $('.robin-room-participant.robin--vote-class--continue').length;
var noVoteCount = $('.robin-room-participant.robin--vote-class--novote').length;
$('.robin-chat--notification-widget h2 .count').text(participantTotal);
$('.robin-chat--notification-widget small .active').text(participantActive);
$('.robin-chat--notification-widget small .away').text(participantAway);
$('.robin-chat--notification-widget h3 .abandon-count').text(abandonCount);
$('.robin-chat--notification-widget h3 .stay-count').text(stayCount);
$('.robin-chat--notification-widget h3 .grow-count').text(growCount);
$('.robin-chat--notification-widget h3 .novote-count').text(noVoteCount);
$('.robin--username').each(function(index) {
var username = $(this).text();
if (username != '[robin]') {
$(this).html('<a style="color:inherit;" target="_blank" href="//reddit.com/u/'+username+'">'+username+'</a>');
}
});
setTimeout(update, 500);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment