Skip to content

Instantly share code, notes, and snippets.

@masnick
Created November 8, 2012 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masnick/4040131 to your computer and use it in GitHub Desktop.
Save masnick/4040131 to your computer and use it in GitHub Desktop.
Userscript to display unread badge on Fluid SSB for Gmail
function updateDockBadge() {
var link = $('a[title*=Inbox].n0').first().html();
var fromLink = /Inbox \(([0-9]+)\)/.exec(link);
if(fromLink == null) {
window.fluid.dockBadge = null;
console.log("C");
}
else {
window.fluid.dockBadge = fromLink[1];
console.log("D "+fromLink[1]);
}
}
// Insert jQuery
var q = document.createElement('script'); q.setAttribute('src','https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'); document.body.appendChild(q);
// Be sure that jQuery is ready,
// then initialize.
(function tryReady() {
if (typeof jQuery == "undefined")
setTimeout(tryReady, 200);
else
init();
function init() {
window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 1000);
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 5000);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment