From c93c582470447fd266c66be082a59ce46a8ecf68 Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Mon, 1 Mar 2010 02:27:00 -0500 Subject: Fixed click-to-edit --- static/js/pichat.js | 18 +++++++++++++++++- template/profile.st | 7 +++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/static/js/pichat.js b/static/js/pichat.js index dbc110b..3c69994 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 "" + url + "" +} + // Message Handling var ImageMsgCount = 0 @@ -315,6 +329,8 @@ function activateProfileEditable() { } function enableProfileEdit() { + $('img#contact').replaceWith('
'); + $('img#bio').replaceWith('
'); $('#contact, #bio, #avatar').addClass('editable'); $('#avatar-editing').show(); var resetPage = function() { location.reload() }; @@ -325,7 +341,7 @@ function enableProfileEdit() { function initProfile() { $(".linkify").each(function() { var text = jQuery(this).text(); - jQuery(this).html(linkify(text)); + jQuery(this).html(linkifyWithoutImage(text)); }); $('#edit-toggle').click(enableProfileEdit); diff --git a/template/profile.st b/template/profile.st index 46e8cb4..9c77069 100755 --- a/template/profile.st +++ b/template/profile.st @@ -42,7 +42,7 @@ $if(is_home)$ $endif$ @@ -51,8 +51,7 @@ $if(contact)$
$contact$
$else$ -

-
+
$endif$
@@ -60,7 +59,7 @@ $if(bio)$
$bio$
$else$ -
+
$endif$ $if(is_home)$ -- cgit v1.2.3-70-g09d2