mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-09 01:48:48 +00:00
jappixmini: include jappix source
This commit is contained in:
parent
61eb1f0d18
commit
302b2820d1
231 changed files with 96082 additions and 2 deletions
38
jappixmini/jappix/js/links.js
Normal file
38
jappixmini/jappix/js/links.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
|
||||
Jappix - An open social platform
|
||||
These are the links JS script for Jappix
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
License: AGPL
|
||||
Authors: Vanaryon, Maranda
|
||||
Last revision: 26/08/11
|
||||
|
||||
*/
|
||||
|
||||
// Apply links in a string
|
||||
function applyLinks(string, mode, style) {
|
||||
// Special stuffs
|
||||
var style, target;
|
||||
|
||||
// Links style
|
||||
if(!style)
|
||||
style = '';
|
||||
else
|
||||
style = ' style="' + style + '"';
|
||||
|
||||
// Open in new tabs
|
||||
if(mode != 'xhtml-im')
|
||||
target = ' target="_blank"';
|
||||
else
|
||||
target = '';
|
||||
|
||||
// XMPP address
|
||||
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');
|
||||
|
||||
// Simple link
|
||||
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>');
|
||||
|
||||
return string;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue