Forked from jakebellacera/gmail-fluidapp-userscript.js
Last active
August 29, 2015 14:15
-
-
Save johanoloflindberg/048328f39d358f723386 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// use for patterns: | |
// *gmail.com* | |
// *mail.google.com* | |
// *google.com*mail* | |
window.fluid.dockBadge = ''; | |
setTimeout(updateDockBadge, 3000); | |
setInterval(updateDockBadge, 15000); | |
function updateDockBadge() { | |
var inboxLink = document.querySelector('a[title^="Inbox"]'); | |
var regex = /\s*Inbox\s*\((\d+)\)[^\d]*/; | |
var res = inboxLink.title.match(regex); | |
if (res && res.length > 1) { | |
var newBadge = res[1]; | |
window.fluid.dockBadge = newBadge; | |
} else { | |
regex = /^Inbox$/; | |
if(regex.test(inboxLink.title)){ | |
window.fluid.dockBadge = ''; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment