On PMSE, we don't get overloaded with flags, but they do occasionally come in. The 13 current 2K users on this site have access to a moderation dashboard that will show flags, but this is buried in the "Tools" menu in the top navigation.

As a moderator, these flags are displayed in the toolbar next to the user badges. On Meta Stack Overflow, this is known as the "bat signal". By having this bat signal display in the toolbar, I instantly know if there are items that require attention. However, for 2K users, the flags are only displayed if there are at least 5, which rarely, if ever, happens on a beta site. I did some searching, and I found a Userscript, created by Michael Mrozek, that will embed the flag count in the toolbar, regardless of the number:

Flag count on the Workplace SE Beta (2K View) courtesy of Userscript:

Flags displayed on the Workplace SE Beta

As you can see, I now get alerts if there are flags in the system as a 2K+ user on another beta site I participate on, and this is what it would look like for you on PMSE, if you have 2K+ reputation.

By giving you what I call the "moderator experience", I'm hoping that this can help get more eyes on the flag queue so that we all can quickly take action when needed, whether that be a comment, a close vote, another escalation flag, an edit, etc.


To install the script, you'll either need Google Chrome, or Firefox with Greasemonkey installed. Save the code below into a file called "flags.user.js", and then drag and drop it into the "Tools -> Extensions" menu in Chrome.

// ==UserScript==
// @name          SO Flags in Toolbar
// @namespace      stackoverflow
// @author         Michael Mrozek (http://stackoverflow.com/users/309308)
// @description    Show the number of flags in the top bar next to the tools link
// @include        http://*.stackoverflow.com/*
// @include        http://*.serverfault.com/*
// @include        http://serverfault.com/*
// @include        http://*.superuser.com/*
// @include        http://superuser.com/*
// @include        http://*.stackexchange.com/*
// @include        http://mathoverflow.net/*
// @include        http://area51.stackexchange.com/*
// ==/UserScript==

function with_jquery(f) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.textContent = "(" + f.toString() + ")(jQuery)";

with_jquery(function($) {
        console.info("flags script...");

        // tools link means tools or review
        tools_link = $('#hlinks-nav > a[href]:first');
        // use for Area 51, once we know /tools/flagged is the source for the number of flags for 10K users.
        //tools_link = $('#hlinks-nav');

        // don't waste resources if the user doesn't have permissions to view flags
        var reputation = parseInt($('#hlinks-user').find('.reputation-score').html().replace(',',''));
        var isBeta = $('#hlogo').find('.beta-title').length == 1;
        if( (isBeta == false && reputation < 10000) ||
            (isBeta == true && reputation < 2000) )
            return; // not 10k/2k

        if( $('#hlinks-nav > .mod-flag-indicator').length > 0 )
            return; // whatdya know, the flags are actually showing because there is more than 5 flags!

        console.info("flags: user is 10k...");

        base_url = location.href.substring(0, location.href.indexOf("/", 7));
        $.get("/tools", function(tools_data) {
                tools = $(tools_data);
                var flagVal = $(tools_data).find('.bounty-indicator-tab').html();
//                 flagVal='1';    // uncomment to test ui
                if(flagVal != null) {
                    link = $('<a href="/tools/flagged" class="mod-flag-indicator supernovabg" title="we have posts flagged for moderator attention, perhaps you can help">'+flagVal+''+'</a><span>&nbsp;</span>');
                    // use for Area 51, but am not sure if flag source layout is the same as other sites
//                    tools_link.prepend(link);  // use for Area 51, but am not sure if flag source layout is the same as other sites
  • 1
    Good find! I wonder if there's a way to have something like this implemented site wide. – Mark Phillips Nov 2 '12 at 13:41
  • I already have a Meta Stack Overflow Feature Request submitted for that. Hoping they make the change, as it should just be a matter of changing a 5 to a 1 somewhere in the database or code. :) – jmort253 Nov 2 '12 at 15:04

You must log in to answer this question.

Browse other questions tagged .