diff options
| author | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2010-06-20 22:48:50 -0400 |
|---|---|---|
| committer | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2010-06-20 22:48:50 -0400 |
| commit | bed8d70d0f1321d0a4463b768b7b2d12a18eb3da (patch) | |
| tree | 76dd5db015c7624923792d3f255932b980fbef06 /static | |
| parent | 1aeada8bd0a408cb58fc3ec0c2ed56d1b1901135 (diff) | |
sostler prod commit
Diffstat (limited to 'static')
| -rw-r--r-- | static/js/pichat.js | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/static/js/pichat.js b/static/js/pichat.js index 2ea4b3b..a169090 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -95,12 +95,14 @@ function linkReplace(url) { linkUrl = url; else linkUrl = 'http://' + url; - + + // Ugly hack. Don't open new links in chat, only in logs. + var shouldOpen = $('#chatrap').length == 0; var uri = parseUri(url) switch(getUriType(uri)) { case 'image': LastMsgContainsImage = true; - return "<a href='" + linkUrl + "' class='img-wrapper' onclick='return false'><img src='" + linkUrl + "'></a>"; break; + return "<a target='_blank' href='" + linkUrl + "' class='img-wrapper' onclick='return " + shouldOpen + "'><img src='" + linkUrl + "'></a>"; break; case 'youtube': Youtube.startAnimation(); return "<a target='_blank' class='youtube' href='" + linkUrl + "'>" + @@ -662,7 +664,6 @@ function setupUpload(elementId, roomKey) { }; var onComplete = function(file, response) { var r = $.trim(response); - g = r; if (r.match(/FILE_TOO_BIG/)) { var maxSize = r.split(" ")[1] / 1024; alert("Sorry. Your file is just too fucking big. " @@ -692,7 +693,7 @@ function setupUpload(elementId, roomKey) { autoSubmit: true, name: 'image', data: { room: roomKey }, - onSubmit: onSubmit, + onSubmit: onSubmit, onComplete: onComplete }); } @@ -704,17 +705,22 @@ function setupUploadAvatar(elementId) { }; var onComplete = function(file, resp) { $('#spinner').hide(); - if (resp == 'INVALID_REQUEST') { + var r = $.trim(resp); + if (r == 'INVALID_REQUEST') { location.reload(); - } else if (resp == 'NOT_LOGGED_IN') { + } else if (r == 'NOT_LOGGED_IN') { location.reload(); - } else if (resp == 'INVALID_IMAGE') { + } else if (r == 'INVALID_IMAGE') { alert("Sorry, dump.fm can't deal with your image. Pick another :("); return; - } - var s = '<img id="avatarPic" src="' + resp + '" width="150" />'; - $('#avatarPic').replaceWith(s).show(); - $('#avatar').text(resp); + } else 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; + } + var s = '<img id="dashavatarPic" src="' + r + '" width="150" />'; + $('#dashavatarPic').replaceWith(s).show(); }; new AjaxUpload(elementId, { action: '/upload/avatar', |
