only update title if it changes

This commit is contained in:
Sam 2014-01-09 10:26:53 +11:00
parent a48fb956f0
commit 4b54e10d27
1 changed files with 8 additions and 5 deletions

View File

@ -39,11 +39,14 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
if (notifyCount > 0 && !Discourse.User.currentProp('dynamic_favicon')) {
title = "(" + notifyCount + ") " + title;
}
// chrome bug workaround see: http://stackoverflow.com/questions/2952384/changing-the-window-title-when-focussing-the-window-doesnt-work-in-chrome
window.setTimeout(function() {
document.title = ".";
document.title = title;
}, 200);
if(title !== document.title) {
// chrome bug workaround see: http://stackoverflow.com/questions/2952384/changing-the-window-title-when-focussing-the-window-doesnt-work-in-chrome
window.setTimeout(function() {
document.title = ".";
document.title = title;
}, 200);
}
}.observes('title', 'hasFocus', 'notifyCount'),
faviconChanged: function() {