mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-04 22:27:10 -04:00
Merge 07fa2ae598
into 3bce184189
This commit is contained in:
commit
5363e2531a
2 changed files with 49 additions and 3 deletions
|
@ -1164,3 +1164,10 @@ label[for=readonlyinput] {
|
|||
#qrcode{
|
||||
margin-left:10px;
|
||||
}
|
||||
|
||||
#innerdocbody img, #innerdocbody video, #innerdocbody audio {
|
||||
padding: 2px;
|
||||
margin-bottom: 4px;
|
||||
box-shadow: 0 0 4px #aaa;
|
||||
background: #fff;
|
||||
}
|
||||
|
|
|
@ -152,12 +152,51 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
|||
{
|
||||
if (href)
|
||||
{
|
||||
if(!~href.indexOf("http")) // if the url doesn't include http or https etc prefix it.
|
||||
|
||||
// if the url doesn't include http or https prefix it
|
||||
if(!~href.indexOf("http"))
|
||||
{
|
||||
href = "http://"+href;
|
||||
}
|
||||
extraOpenTags = extraOpenTags + '<a href="' + href.replace(/\"/g, '"') + '">';
|
||||
extraCloseTags = '</a>' + extraCloseTags;
|
||||
|
||||
// check extension and decide, whether it's media (image,audio,video) or a simple link
|
||||
var href_ext = href.slice(-4);
|
||||
|
||||
// images
|
||||
if (href_ext==".jpg" || href_ext==".png" || href_ext==".gif" || href_ext==".svg") {
|
||||
extraOpenTags = extraOpenTags + '<img src="' + href.replace(/\"/g, '"') + '"><br>';
|
||||
}
|
||||
|
||||
// music
|
||||
if (href_ext==".mp3" || href_ext==".wav" || href_ext==".oga") {
|
||||
extraOpenTags = extraOpenTags + '<audio controls preload="metadata" src="' + href.replace(/\"/g, '"') + '"></audio><br>';
|
||||
}
|
||||
|
||||
// video
|
||||
if (href_ext==".mp4" || href_ext==".ogv" || href_ext==".ogg" || href.slice(-5)==".webm" || href_ext==".mov") {
|
||||
extraOpenTags = extraOpenTags + '<video controls preload="metadata" src="' + href.replace(/\"/g, '"') + '"></video><br>';
|
||||
}
|
||||
|
||||
// YouTube
|
||||
if (href.match(/[http|https]\:\/\/www\.youtube\.com\/watch\?v=([A-z0-9-_]{11})/) != null) {
|
||||
var youtube_id = href.match(/[http|https]\:\/\/www\.youtube\.com\/watch\?v=([A-z0-9-_]{11})/)[1];
|
||||
txt = 'https://www.youtube.com/watch?v=' + youtube_id;
|
||||
extraOpenTags = extraOpenTags + '<div style="height:385px"><iframe width=640 height=385 src="https://www.youtube.com/embed/' + youtube_id + '"></iframe></div><br>';
|
||||
}
|
||||
// Vimeo
|
||||
if (href.match(/[http|https]\:\/\/vimeo\.com\/(\d{8})/) != null) {
|
||||
var vimeo_id = href.match(/[http|https]\:\/\/vimeo\.com\/(\d{8})/)[1];
|
||||
txt = 'https://vimeo.com/' + vimeo_id;
|
||||
extraOpenTags = extraOpenTags + '<div style="height:338px"><iframe width=640 height=338 src="https://player.vimeo.com/video/' + vimeo_id + '?title=0&byline=0&portrait=0"></iframe></div><br>';
|
||||
}
|
||||
|
||||
// If nothing applies, consider it as a normal url
|
||||
if (extraOpenTags.length == 0) {
|
||||
extraOpenTags = extraOpenTags + '<a href="' + href.replace(/\"/g, '"') + '">';
|
||||
extraCloseTags = '</a>' + extraCloseTags;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (simpleTags)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue