-
-
Save chrisyip/8193727 to your computer and use it in GitHub Desktop.
Gmail Unread Badge for Fluid
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
setTimeout(updateDockBadge, 1000) | |
setTimeout(updateDockBadge, 3000) | |
setInterval(updateDockBadge, 5000) | |
function updateDockBadge() { | |
var inboxLink = document.querySelector('a[href*="shva=1#inbox"]') | |
, badge = window.fluid.dockBadge | |
if (inboxLink && inboxLink.href && inboxLink.href.indexOf('mail.google.com') > -1) { | |
var match = inboxLink.title.match(/\((\d+)\)$/) | |
badge = Array.isArray(match) ? match[1] : null | |
} | |
window.fluid.dockBadge = badge || '' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment