From: Anthony Minessale Date: Thu, 24 Jul 2014 20:31:35 +0000 (+0500) Subject: render image urls X-Git-Tag: v1.4.8~10^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a47dc4b5d0c360b4f6493218d20cbae6094931cf;p=thirdparty%2Ffreeswitch.git render image urls --- diff --git a/html5/verto/demo/index.html b/html5/verto/demo/index.html index 415def7224..af26f5b2b1 100644 --- a/html5/verto/demo/index.html +++ b/html5/verto/demo/index.html @@ -50,6 +50,11 @@ color: #ff3333; } +.chatimg +{ + max-width:100px; +} + .l1 { border:1; diff --git a/html5/verto/demo/verto.js b/html5/verto/demo/verto.js index 52ffd64007..de27cabbb1 100644 --- a/html5/verto/demo/verto.js +++ b/html5/verto/demo/verto.js @@ -112,12 +112,19 @@ var callbacks = { } break; case $.verto.enum.message.info: - var body = data.body.replace(/(http[s]{0,1}:\/\/\S+)/g, "$1<\/a>"); + var body = data.body; + + if (body.match(/\.gif|\.jpg|\.jpeg|\.png/)) { + body = body.replace(/(http[s]{0,1}:\/\/\S+)/g, "$1
<\/a>"); + } else { + body = body.replace(/(http[s]{0,1}:\/\/\S+)/g, "
$1<\/a>"); + } if (body.slice(-1) !== "\n") { body += "\n"; } body = body.replace(/(?:\r\n|\r|\n)/g, '
'); + var from = data.from_msg_name || data.from; $("#chatwin").append("" + from + ":
" + body);