3 Jappix - An open social platform
4 These are the links JS script for Jappix
6 -------------------------------------------------
9 Authors: Vanaryon, Maranda
10 Last revision: 26/08/11
14 // Apply links in a string
15 function applyLinks(string, mode, style) {
23 style = ' style="' + style + '"';
26 if(mode != 'xhtml-im')
27 target = ' target="_blank"';
32 string = string.replace(/(\s|<br \/>|^)(([a-zA-Z0-9\._-]+)@([a-zA-Z0-9\.\/_-]+))(,|\s|$)/gi, '$1<a href="xmpp:$2" target="_blank"' + style + '>$2</a>$5');
35 string = string.replace(/(\s|<br \/>|^|\()((https?|ftp|file|xmpp|irc|mailto|vnc|webcal|ssh|ldap|smb|magnet|spotify)(:)([^<>'"\s\)]+))/gim, '$1<a href="$2"' + target + style + '>$2</a>');