diff options
Diffstat (limited to 'static/js/pichat.js')
| -rw-r--r-- | static/js/pichat.js | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/static/js/pichat.js b/static/js/pichat.js index c92cb62..b212fbd 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -51,7 +51,7 @@ function escapeHtml(txt) { } URLRegex = /((\b(http\:\/\/|https\:\/\/|ftp\:\/\/)|(www\.))+(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi; -PicRegex = /\.(jpg|jpeg|png|gif|bmp)$/i; +PicRegex = /\.(jpg|jpeg|png|gif|bmp|svg)$/i; function getImagesAsArray(text) { var imgs = [] @@ -632,7 +632,7 @@ function paletteToggle(){ function setupUpload(elementId, roomKey) { var onSubmit = function(file, ext) { - if (!(ext && /^(jpg|png|jpeg|gif|bmp)$/i.test(ext))) { + if (!(ext && /^(jpg|png|jpeg|gif|bmp|svg)$/i.test(ext))) { alert('SORRY, NOT AN IMAGE DUDE... '); return false; } @@ -972,3 +972,34 @@ parseUri.options = { function parseDomain(host){ return host.toLowerCase().replace(/^www\./, "") } + +// Away notification + +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); |
