Skip to content

Commit

Permalink
Yet more fixes for the document.title count
Browse files Browse the repository at this point in the history
  • Loading branch information
miksago committed May 23, 2011
1 parent 57cb05f commit ec66e58
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions public/javascripts/application.js
Expand Up @@ -252,9 +252,11 @@
var title = document.title;
var matches = title.match(/\[(\d+) (\w+)\]/);

console.log(matches);

if (matches && matches[2] == 'new') {
var count = parseInt(matches[1], 10);
document.title = 'Todos [' + (count++) + 'new]';
document.title = 'Todos [' + (++count) + ' new]';
} else {
document.title = 'Todos [1 new]';
}
Expand All @@ -266,7 +268,7 @@

if (matches && matches[2] == 'updated') {
var count = parseInt(matches[1], 10);
document.title = 'Todos [' + (count++) + ' update]';
document.title = 'Todos [' + (++count) + ' updated]';
} else {
document.title = 'Todos [1 updated]';
}
Expand All @@ -276,9 +278,9 @@
var title = document.title;
var matches = title.match(/\[(\d+) (\w+)\]/);

if (matches && matches[2] == 'new') {
if (matches && matches[2] == 'removed') {
var count = parseInt(matches[1], 10);
document.title = 'Todos [' + (count++) + ' removed]';
document.title = 'Todos [' + (++count) + ' removed]';
} else {
document.title = 'Todos [1 removed]';
}
Expand Down

0 comments on commit ec66e58

Please sign in to comment.