Created
November 8, 2012 17:11
-
-
Save masnick/4040131 to your computer and use it in GitHub Desktop.
Userscript to display unread badge on Fluid SSB for Gmail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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