diff options
| author | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2010-03-01 02:27:00 -0500 |
|---|---|---|
| committer | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2010-03-01 02:27:00 -0500 |
| commit | c93c582470447fd266c66be082a59ce46a8ecf68 (patch) | |
| tree | f6326d20550107aacd824a3e2b9819c20152f183 | |
| parent | 74a478501390729a82c0d40abc38016c512965ff (diff) | |
Fixed click-to-edit
| -rwxr-xr-x | static/js/pichat.js | 18 | ||||
| -rwxr-xr-x | 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 "<a target='_blank' href='" + linkUrl + "'>" + url + "</a>" +} + // Message Handling var ImageMsgCount = 0 @@ -315,6 +329,8 @@ 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() }; @@ -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)$ <div id="avatar-editing" style="display: none"> <div id="avatar" class="editable">$avatar$</div> - <input id="upload" value="Upload" type="submit"> + <input id="upload" value="Upload Icon" type="submit"> <img id="spinner" src="/static/spinner.gif" style="display: none" /> </div> $endif$ @@ -51,8 +51,7 @@ $if(contact)$ <div id="contact" class="linkify">$contact$</div> $else$ - <br><br> - <div><img src="/static/noinfo.png"></div> + <div><img id="contact" src="/static/noinfo.png"></div> $endif$ <br> @@ -60,7 +59,7 @@ $if(bio)$ <div id="bio" class="linkify">$bio$</div> $else$ - <div><img src="/static/noinfo.png"></div> + <div><img id="bio" src="/static/noinfo.png"></div> $endif$ $if(is_home)$ |
