Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gmail Unread Badge for Fluid
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