diff options
| author | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2010-04-02 20:52:56 -0400 |
|---|---|---|
| committer | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2010-04-02 20:52:56 -0400 |
| commit | 4479097093127a20a40a9dceb604bf4290c09a2d (patch) | |
| tree | 5c1de22a8b396028c00f158a47b85222eac74657 /static/js/away.js | |
| parent | 43aa4e4b9ae94db0ac62699e7b35bed072902b69 (diff) | |
moved static content
Diffstat (limited to 'static/js/away.js')
| -rwxr-xr-x | 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 100755 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 |
