mirror of
https://github.com/YunoHost-Apps/minchat_ynh.git
synced 2024-09-03 19:36:29 +02:00
Displays IMG for ! + URL
This commit is contained in:
parent
dae7090e36
commit
26678967a6
1 changed files with 5 additions and 5 deletions
|
@ -86,17 +86,17 @@ if ($name.$room=="") {
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="lib/jquery-2.1.3.min.js"></script>
|
<script type="text/javascript" src="lib/jquery-2.1.3.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// regexp used by fonction lienurl
|
// add link or img
|
||||||
function replacer(match, p1,p2,p3, offset, string){
|
function replacer(match, p1,p2,p3, offset, string){
|
||||||
if (p1.match(/\.(png|jpg|jpeg|gif)$/)) {
|
if (p1.charAt(0)=='!') {
|
||||||
return(' <img src="' + p1 + '" />');
|
return(' <img src="' + p1.substr(1) + '" />');
|
||||||
} else {
|
} else {
|
||||||
return ' <a href="' + p1 + '">' + p1 + '</a>';
|
return ' <a href="' + p1 + '">' + p1 + '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remplace les url précédées d'un espace par un lien
|
// scans URLS
|
||||||
function lienurl(s){
|
function lienurl(s){
|
||||||
return s.replace(/\s(https?:\/\/([-\w\.]+[-\w]+(:\d+)?(\/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?))/g,replacer);
|
return s.replace(/\s(!?https?:\/\/([-\w\.]+[-\w]+(:\d+)?(\/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?))/g,replacer);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
Loading…
Reference in a new issue