-
-
Save johanoloflindberg/491a025590209b57f187 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
| window.fluid.dockBadge = ''; | |
| setTimeout(updateDockBadge, 1000); | |
| setTimeout(updateDockBadge, 3000); | |
| setInterval(updateDockBadge, 5000); | |
| function updateDockBadge() { | |
| var navigation = document.querySelector('[role=navigation]') | |
| var doc = navigation.contentDocument || navigation.ownerDocument; | |
| if (!doc) { return; } | |
| var anchors = [].slice.call(doc.querySelectorAll('a')) | |
| var result = anchors.reduce(function(prev, curr, i) { | |
| var match = curr.innerText.match(/\s*Inbox\s*\((\d+)\)[^\d]*/) | |
| if (match) return match; | |
| else return prev; | |
| }, null); | |
| if (result && result[1]) { | |
| window.fluid.dockBadge = result[1]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment