r/TagPro•
_faceless_

[SUGGESTION] Have the GROUPS tab display the current number of public groups

Suggestion

...if the number of public groups is >0. E.g. GROUPS: 2

Posted Jul 19, 2016, 5:35 PM UTC

134
InTheMoodTagproMastahOfDisastahRollFastah•

If this does not get approved, maybe a userscript?

2
nabbynznabby • diameter•

This works if you're not already in a group...

// ==UserScript==
// @name            Public Group Count
// @description     Shows how many public groups are happening right now.
// @version         0.0.3
// @include         http://*.koalabeast.com*
// @include         http://*.jukejuice.com*
// @include         http://*.newcompte.fr*
// @exclude         http://*.koalabeast.com:*
// @exclude         http://*.jukejuice.com:*
// @exclude         http://*.newcompte.fr:*
// @author          nabby
// ==/UserScript==

console.log('START: ' + GM_info.script.name + ' (v' + GM_info.script.version + ' by ' + GM_info.script.author + ')');


function getGroups() {
    if (!$('#nav-groups').find('.group-indicator').length) { //won't work if we're already in a public group
        $.get('/groups/').done(function(data) {
            var groups = $(data).find('#groups-list').find('.group-item');

			if (groups.length) {
				var groupNames = '';

				$.each(groups, function(key, value) {
					groupNames += $(value).find('div.group-name').text().trim() + "\n" + $(value).find('div:contains("Leader:"):last').text().trim() + "\n" + $(value).find('div:contains("Players:"):last').text().trim() + "\n\n";
				});

				$('#nav-groups a').text('Groups (' + groups.length + ')').attr('title', groupNames);
			}
        });
    }
}
getGroups(); //call once

setInterval(getGroups, 60000); //then update every 60 seconds

Edit: Added loop
Edit 2: Added group names/leader/#players on hover

2
_faceless_OPFaceless || Origin•

^tears I added this script, but the servers are so dead I can't test it out for functionality. ^more ^tears ^^^RIP ^^^TP

2
RondingRonding // Orbit // West Bombwich Albion // tagpro.eu•

Related suggestion: also show public groups on other servers on the group page.

2