summaryrefslogtreecommitdiff
path: root/static/js/pichat.js
diff options
context:
space:
mode:
authorsostler <sbostler@gmail.com>2010-03-04 00:13:08 -0500
committersostler <sbostler@gmail.com>2010-03-04 00:13:08 -0500
commita7e335a9b036b1837fd1b0b1b61cb676b61179b6 (patch)
tree1a6b9d443b86006cde1284f0bc35b4b57d36091a /static/js/pichat.js
parent79cfa2701828fb9bed1f0dd5d618970f274e6df5 (diff)
parent9d4e112788a7047279698152c1c1db1662d89b0d (diff)
Merge branch 'master' of ssh://dump.fm/pichat/repo
Diffstat (limited to 'static/js/pichat.js')
-rwxr-xr-xstatic/js/pichat.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/static/js/pichat.js b/static/js/pichat.js
index dbc110b..b322ae9 100755
--- a/static/js/pichat.js
+++ b/static/js/pichat.js
@@ -32,6 +32,20 @@ function linkReplace(url){
}
}
+function linkifyWithoutImage(text) {
+ LastMsgContainsImage = false
+ var URLRegex = /((\b(http\:\/\/|https\:\/\/|ftp\:\/\/)|(www\.))+(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
+ return text.replace(URLRegex, linkReplaceWithoutImage);
+}
+
+function linkReplaceWithoutImage(url){
+ var PicRegex = /\.(jpg|jpeg|png|gif|bmp)$/i;
+ var urlWithoutParams = url.replace(/\?.*$/i, "");
+ linkUrl = url.indexOf('http://') == 0 ? url : 'http://' + url;
+
+ return "<a target='_blank' href='" + linkUrl + "'>" + url + "</a>"
+}
+
// Message Handling
var ImageMsgCount = 0
@@ -315,17 +329,19 @@ function activateProfileEditable() {
}
function enableProfileEdit() {
+ $('img#contact').replaceWith('<div id="contact" class="linkify"></div>');
+ $('img#bio').replaceWith('<div id="bio" class="linkify"></div>');
$('#contact, #bio, #avatar').addClass('editable');
$('#avatar-editing').show();
var resetPage = function() { location.reload() };
- $('#edit-toggle a').text('--> Done editing <--').click(resetPage);
+ $('#edit-toggle a').text('done editing').click(resetPage);
activateProfileEditable();
}
function initProfile() {
$(".linkify").each(function() {
var text = jQuery(this).text();
- jQuery(this).html(linkify(text));
+ jQuery(this).html(linkifyWithoutImage(text));
});
$('#edit-toggle').click(enableProfileEdit);