Skip to content

Instantly share code, notes, and snippets.

@PullJosh
Last active June 7, 2018 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PullJosh/849547df25436e23adc0 to your computer and use it in GitHub Desktop.
Save PullJosh/849547df25436e23adc0 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Scratch Messages in Title
// @version 0.1
// @description Updates the page title to show number of messages (updates every 5 seconds)
// @match http://scratch.mit.edu/*
// @copyright 2014, Josh Pullen
// ==/UserScript==
var basetitle = document.getElementsByTagName("title")[0].innerHTML;
setInterval(function(){
if (parseInt($(".notificationsCount").html()) == 0) {
document.title = basetitle;
} else {
document.title = "(" + $(".notificationsCount").html() + ") " + basetitle;
}
},2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment