Skip to content
Browse files

#19 - bugfix for handling dynamic document titles

  • Loading branch information...
1 parent e538042 commit fa2a3230e72107b2b64e7f3a8af3f17982a958e4 @simong simong committed with tiff Jan 21, 2014
Showing with 8 additions and 1 deletion.
  1. +8 −1 tinycon.js
View
9 tinycon.js
@@ -13,7 +13,6 @@
var Tinycon = {};
var currentFavicon = null;
var originalFavicon = null;
- var originalTitle = document.title;
var faviconImage = null;
var canvas = null;
var options = {};
@@ -158,6 +157,14 @@
var updateTitle = function(label) {
if (options.fallback) {
+ // Grab the current title that we can prefix with the label
+ var originalTitle = document.title;
+
+ // Strip out the old label if there is one
+ if (originalTitle[0] === '(') {
+ originalTitle = originalTitle.slice(originalTitle.indexOf(' '));
+ }
+
if ((label + '').length > 0) {
document.title = '(' + label + ') ' + originalTitle;
} else {

0 comments on commit fa2a323

Please sign in to comment.
Something went wrong with that request. Please try again.