Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.


Per this question: http://meta.stackoverflow.com/questions/57315/can-we-get-notification-in-the-tab-change-of-title This user script was created to help draw attention to notifications even when the tab isn't in focus. It changes the page title to include the 'unreadCount' from the Stack Exchange Super-Collider.


// ==UserScript==
// @name           SE Tab Notifier
// @namespace      http://fosco.com
// @description    Update Tab Title when Inbox has content
// @include        http://*.stackexchange.com/*
// @include        http://superuser.com/*
// @include        http://serverfault.com/*
// @include        http://meta.stackoverflow.com/*
// @include        http://stackoverflow.com/*
// @include        http://stackapps.com/*
// ==/UserScript==

var script = document.createElement("script");
script.textContent = "(" + grease.toString() + ")()";

function grease()
    var newNotifications = $('.network-items a.js-inbox-button .unread-count');
    var newReputations = $('.network-items a.js-achievements-button .unread-count');

    var oldTitle = $(document).attr('title');

    var notifyme = function ()
        var notificationCount = newNotifications.text().trim();
        var reputationCount = newReputations.text().trim();

        if(newNotifications.is(':visible') && newReputations.is(':visible'))
            $(document).attr('title','(' + notificationCount + '/' + reputationCount + ') ' + oldTitle);
        else if(newNotifications.is(':visible'))
            $(document).attr('title','(' + notificationCount + ') ' + oldTitle);
        else if(newReputations.is(':visible'))
            $(document).attr('title','(' + reputationCount + ') ' + oldTitle);
            //Reset back to original title if notifications have gone
            $(document).attr('title', oldTitle);
    window.setInterval(notifyme, 1000);




Greasemonkey, Tampermonkey, and most other userscript engines


gfosco AT gmail

share|improve this question
I have some trouble make this script run. I have installed tampermonkey extension for chrome as recommended here stackoverflow.com/questions/5258989/…. I have copy paste the script above but it isn't working. Also I would like to add joomla.stackexchange.com in @include but I don't understand where I am suppose to add the *. Thanks a lot! –  Arone Oct 9 at 10:30
@fosco I've made a fix to this one to get it working and added in rep as well as notifications, want me to post my changes as an edit? –  DavidG Oct 21 at 22:12
Sure @DavidG go for it. –  Fosco Oct 22 at 4:28
@Fosco Done, don't mind if you reject/edit btw. May also be worth mentioning that this works with Chrome/TamperMonkey too. –  DavidG Oct 22 at 8:34

You must log in to answer this question.

Browse other questions tagged .