From 4479097093127a20a40a9dceb604bf4290c09a2d Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Fri, 2 Apr 2010 20:52:56 -0400 Subject: moved static content --- static/js/away.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 static/js/away.js (limited to 'static/js/away.js') 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 -- cgit v1.2.3-70-g09d2