Skip to content

Instantly share code, notes, and snippets.

@chrisyip
Forked from kirbysayshi/fluid_gmail.js
Last active January 1, 2016 19:59
Show Gist options
  • Save chrisyip/8193727 to your computer and use it in GitHub Desktop.
Save chrisyip/8193727 to your computer and use it in GitHub Desktop.
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