Created
November 24, 2015 01:23
-
-
Save harai/dcce9cb5016bb6f4127a to your computer and use it in GitHub Desktop.
Title patch for Inbox by Gmail™
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
| // ==UserScript== | |
| // @name Title patch for Inbox by Gmail™ | |
| // @namespace com.github.harai | |
| // @description Count unread messages and display it as the page's title. | |
| // @include https://inbox.google.com/* | |
| // @version 1 | |
| // @grant none | |
| // ==/UserScript== | |
| setInterval(function() { | |
| if (window.parent !== window) { | |
| return; | |
| } | |
| var n = document.getElementsByClassName('ss').length; | |
| if (!document.title) { | |
| return; | |
| } | |
| var newTitle = document.title.replace(/^.*?Inbox/, (n ? '(' + n + ') ' : '') + 'Inbox'); | |
| if (newTitle === document.title) { | |
| return; | |
| } | |
| document.title = newTitle; | |
| }, 1000); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This UserScript enables Firefox and Chrome to show notification if the tab is pinned.