Created
February 4, 2013 15:17
-
-
Save krzysu/4707342 to your computer and use it in GitHub Desktop.
manage document title to set info about number of notifications
This file contains 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
# manage document title | |
Title = | |
regex: /\(\d*\) \| / | |
# set number of new items in document title | |
set: (number) -> | |
# update value | |
if document.title.match(@regex)? | |
document.title = document.title.replace(@regex, '(' + number + ') | ') | |
# set value | |
else | |
document.title = '(' + number + ') | ' + document.title | |
# remove number from title | |
reset: -> | |
if document.title.match(@regex)? | |
document.title = document.title.replace(@regex, '') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment