Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

#19 - bugfix for handling dynamic document titles

  • Loading branch information...
commit 9cc67d64281720092e905cd22a490e0e79c20f5d 1 parent 46d9ae2
@simong authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 tinycon.js
View
9 tinycon.js
@@ -11,7 +11,6 @@
var Tinycon = {};
var currentFavicon = null;
var originalFavicon = null;
- var originalTitle = document.title;
var faviconImage = null;
var canvas = null;
var options = {};
@@ -145,6 +144,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 {
Please sign in to comment.
Something went wrong with that request. Please try again.