Skip to content
Snippets Groups Projects
Commit 31d38dba authored by runemaster's avatar runemaster
Browse files

Make fully formed URI's clickable.

i.e.;
http://www.somedomeil.com/
https://www.somedomeil.com/
telnet://www.somedomeil.com/
gopher://www.somedomeil.com/
irc://www.somedomeil.com/

Does not currently sopport URI's that do not beging with protocol reference.
Also supports ports and sub-directories i.e.; http://www.somedomain.com:6080/docs/index.html
parent 3c701808
Branches
Tags
No related merge requests found
......@@ -181,3 +181,8 @@ function idx_to_user(fromidx)
}
return(istouser);
}
function make_links(str) {
var str_link=str.replace(/((http|https|ftp|telnet|gopher|irc)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?\/?([a-zA-Z0-9\-\._\?\,\/\\\+&%\$#\=~]*))/gi,'<a href="$1" target="_blank">$1</a>');
return(str_link)
}
......@@ -109,11 +109,13 @@ if(msg.type=="plain") {
/* ANSI */
if(template.body.indexOf('\x1b[')>=0 || template.body.indexOf('\x01')>=0) {
template.body=html_encode(template.body,true,false,true,true);
template.body=make_links(template.body);
}
/* Plain text */
else {
template.body=word_wrap(template.body);
template.body=word_wrap(template.body,80);
template.body=html_encode(template.body,true,false,false,false);
template.body=make_links(template.body);
}
}
if(msg.attachments!=undefined) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment