diff options
| author | sostler <sbostler@gmail.com> | 2010-04-14 07:04:20 -0400 |
|---|---|---|
| committer | sostler <sbostler@gmail.com> | 2010-04-14 07:04:20 -0400 |
| commit | b79243c7d06987672cffea75695e1036911dac13 (patch) | |
| tree | 483f6b710c0b00803ef5d9ea943dd65b6d038b17 /static/js/pichat.js | |
| parent | bf2f16d125d1905dc5867d371a0324ee09984494 (diff) | |
Mute file uploads
Diffstat (limited to 'static/js/pichat.js')
| -rw-r--r-- | static/js/pichat.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/static/js/pichat.js b/static/js/pichat.js index d52212d..dc91a51 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -244,7 +244,8 @@ function submitMessage() { var onSuccess = function(json) { if (typeof pageTracker !== 'undefined') { - pageTracker._trackEvent('Message', 'Submit', typeof Room !== 'undefined' ? Room : 'UnknownRoom'); + pageTracker._trackEvent('Message', 'Submit', + typeof Room !== 'undefined' ? Room : 'UnknownRoom'); } div.attr('id', 'message-' + json) .removeClass('loading').addClass('loaded'); @@ -628,21 +629,26 @@ function setupUpload(elementId, roomKey) { } }; var onComplete = function(file, response) { - if (response.match(/FILE_TOO_BIG/)) { - var maxSize = response.split(" ")[1] / 1024; + r = $.trim(response); + if (r.match(/FILE_TOO_BIG/)) { + var maxSize = r.split(" ")[1] / 1024; alert("Sorry. Your file is just too fucking big. " + maxSize + "KB or less please."); return; - } else if (response.match(/FILE_NOT_IMAGE/)) { + } else if (r.match(/FILE_NOT_IMAGE/)) { alert("What did you upload? Doesn't seem like an image. Sorry."); return; - } else if (response.match(/INVALID_RESOLUTION/)) { - var maxWidth = response.split(" ")[1]; - var maxHeight = response.split(" ")[2]; + } else if (r.match(/INVALID_RESOLUTION/)) { + var maxWidth = r.split(" ")[1]; + var maxHeight = r.split(" ")[2]; alert("Sorry, the maximum image resolution is " + maxWidth + "x" + maxHeight); return; + } else if (r != "OK") { + alert(r); + return; } + if (typeof pageTracker !== 'undefined') { var r = typeof Room !== 'undefined' ? Room : 'UnknownRoom'; pageTracker._trackEvent('Message', 'Upload', r); |
