Skip to content

Instantly share code, notes, and snippets.

@cincodenada
Last active Apr 1, 2016
Embed
What would you like to do?
Robin Counter

Copy/paste the following into the target for a bookmark:

javascript:void%20function(){function%20o(s){n.forEach(function(o){var%20n=$(%22.robin-room-participant.robin--vote-class--%22+o).length;$(%22.robinmod-users-%22+o).text(n),console.log(%22Updated%20%22+o+%22%20count:%20%22+n)});var%20a=$(%22.robin-room-participant%22).length;$(%22.robinmod-users-total%22).text(a),console.log(%22Updated%20total%20count:%20%22+a),setTimeout(o,s)}$ourdiv=$(%22%23robinmod-counts%22);var%20n=[%22increase%22,%22continue%22,%22abandon%22,%22novote%22];$ourdiv.length||($ourdiv=$('%3Cdiv%20id=%22robinmod-counts%22%20style=%22margin:%205px%2015px%22%3EUsers%20here:%20%3Cspan%20class=%22robinmod-users-total%22%3E%3C/span%3E%20(%3Cspan%20class=%22robinmod-subcounts%22%3E%3C/span%3E)%20%3C/div%3E'),n.forEach(function(o){$ourdiv.find(%22.robinmod-subcounts%22).append('%3Cspan%20class=%22robin--vote-class--'+o+'%22%3E%3Cspan%20class=%22robin--icon%22%3E%3C/span%3E%3Cspan%20class=%22robinmod-users-'+o+'%22%3E%3C/span%3E%3C/span%3E')}),$(%22.robin-chat--sidebar%22).prepend($ourdiv)),o(3e4)}();

Then click it to add/update room status counts.

Sorry, github doesn't seem to let me make it into a direct link.

javascript:void%20function(){function%20o(s){n.forEach(function(o){var%20n=$(%22.robin-room-participant.robin--vote-class--%22+o).length;$(%22.robinmod-users-%22+o).text(n),console.log(%22Updated%20%22+o+%22%20count:%20%22+n)});var%20a=$(%22.robin-room-participant%22).length;$(%22.robinmod-users-total%22).text(a),console.log(%22Updated%20total%20count:%20%22+a),setTimeout(o,s)}$ourdiv=$(%22%23robinmod-counts%22);var%20n=[%22increase%22,%22continue%22,%22abandon%22,%22novote%22];$ourdiv.length||($ourdiv=$('%3Cdiv%20id=%22robinmod-counts%22%20style=%22margin:%205px%2015px%22%3EUsers%20here:%20%3Cspan%20class=%22robinmod-users-total%22%3E%3C/span%3E%20(%3Cspan%20class=%22robinmod-subcounts%22%3E%3C/span%3E)%20%3C/div%3E'),n.forEach(function(o){$ourdiv.find(%22.robinmod-subcounts%22).append('%3Cspan%20class=%22robin--vote-class--'+o+'%22%3E%3Cspan%20class=%22robin--icon%22%3E%3C/span%3E%3Cspan%20class=%22robinmod-users-'+o+'%22%3E%3C/span%3E%3C/span%3E')}),$(%22.robin-chat--sidebar%22).prepend($ourdiv)),o(3e4)}();
$ourdiv = $('#robinmod-counts')
var classlist = ['increase','continue','abandon','novote']
if(!$ourdiv.length) {
$ourdiv = $('<div id="robinmod-counts" style="margin: 5px 15px">Users here: <span class="robinmod-users-total"></span> (<span class="robinmod-subcounts"></span>) </div>')
classlist.forEach(function(curclass) {
$ourdiv.find('.robinmod-subcounts').append(
'<span class="robin--vote-class--' + curclass + '">' +
'<span class="robin--icon"></span>' +
'<span class="robinmod-users-' + curclass + '"></span>' +
'</span>')
})
$('.robin-chat--sidebar').prepend($ourdiv)
}
function update(timeout) {
classlist.forEach(function(curclass) {
var total = $('.robin-room-participant.robin--vote-class--' + curclass).length
$('.robinmod-users-' + curclass).text(total)
console.log('Updated ' + curclass + ' count: ' + total)
})
var total_total = $('.robin-room-participant').length
$('.robinmod-users-total').text(total_total)
console.log('Updated total count: ' + total_total)
setTimeout(update, timeout)
}
update(30000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment