Skip to content

Instantly share code, notes, and snippets.

@harai
Created November 24, 2015 01:23
Show Gist options
  • Select an option

  • Save harai/dcce9cb5016bb6f4127a to your computer and use it in GitHub Desktop.

Select an option

Save harai/dcce9cb5016bb6f4127a to your computer and use it in GitHub Desktop.
Title patch for Inbox by Gmail™
// ==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);
@harai
Copy link
Author

harai commented Nov 24, 2015

This UserScript enables Firefox and Chrome to show notification if the tab is pinned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment