summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xstatic/js/pichat.js18
-rwxr-xr-xtemplate/profile.st7
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)$