diff options
| author | tim b <timb@camcompu.home> | 2010-04-03 21:00:32 -0700 |
|---|---|---|
| committer | tim b <timb@camcompu.home> | 2010-04-03 21:00:32 -0700 |
| commit | d32d26065494ccbd4a9ddba0789003e3daa5fa28 (patch) | |
| tree | 2b0feb1eae6cc43e0f0c24e90ec255d603d4ddc1 /static/js/away.js | |
| parent | dccf497aca0ea62b7931976103c89e3b01ab1860 (diff) | |
committing stuff so i can merge pulled repo
Diffstat (limited to 'static/js/away.js')
| -rw-r--r-- | static/js/away.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/static/js/away.js b/static/js/away.js new file mode 100644 index 0000000..cf4b19c --- /dev/null +++ b/static/js/away.js @@ -0,0 +1,28 @@ +var UnseenMsgCounter = 0; +var OrigTitle = $('title').text(); +var HasFocus = true; + +function onFocus() { + HasFocus = true; + UnseenMsgCounter = 0; + $('title').text(OrigTitle); +} + +function onBlur() { + HasFocus = false; +} + +$(window).blur(onBlur); +$(window).focus(onFocus); + +function titleUpdater() { + if (HasFocus || UnseenMsgCounter == 0 || $('title').text() != OrigTitle) { + $('title').text(OrigTitle); + } else { + var plural = UnseenMsgCounter > 1 ? 's' : ''; + $('title').text(UnseenMsgCounter + ' new dump' + plural + '! | ' + OrigTitle); + } + setTimeout(titleUpdater, 2000); +} + +setTimeout(titleUpdater, 2000);
\ No newline at end of file |
