Post categories



Recommended Wordpress Hosting from WPEngine

  • I use these guys for some of my clients; absolutely rock solid and blazingly fast - check them out!





Here are a couple of ads whose clicks and views help me pay for my server hosting











UserScript: Set the Outlook Web Access (OWA) title to the unread email count

Posted on: 1 Comment

Below is a simple UserScript (install with TamperMonkey or GreaseMonkey) to refresh the light OWA page and set the title of the page (tab) to the number of unread emails. I’ve only tried this in the light OWA mode 2010, but it seems to do the job, and refreshes the page once a minute.

I wrote this as I spend 95% of my day at work on my Linux box, and didn’t feel like having to run a full Exchange-to-imap gateway (like DavMail) so I just use the lightweight Outlook mail in a tab. Just be careful when composing an email using the light mode as it’ll just refresh the page regardless…!

// ==UserScript==
// @name           Outlook Web Access Light Title Inbox Count
// @namespace      seb.so
// @author         Seb Maynard
// @version        0.1
// @include        https://*/owa/*
// @include        http://*/owa/*
// ==/UserScript==
(function() {
    var originalTitle = unsafeWindow.document.title;
    var setTitleFunc = function(title) {
        title = title.replace(/\(/g, "").replace(/\)/g, "");
        window.document.title = title;
    };
    var f = function() {
        var setTitle = false;
        var as = unsafeWindow.document.getElementsByTagName('a');
        for (var i = 0, l = as.length; i < l; i++) {
            if (as[i].getAttribute('title') == 'Inbox') {
                var unrd = as[i].nextSibling;
                if (unrd && unrd.className == "unrd") {
                    setTitleFunc(unrd.innerHTML + " new");
                    setTitle = true;
                }
            }
        }
        if (!setTitle) setTitleFunc("- ");
    };
    setInterval("window.location=window.location", 60 * 1000);
    f();
})();