display youtube video thumbnail (with local url) in embeds
This commit is contained in:
parent
7d7f2cab2b
commit
548be250b4
|
@ -366,15 +366,18 @@ $config['additional_javascript'][] = 'js/download-original.js';
|
|||
|
||||
$config['enable_embedding'] = true;
|
||||
|
||||
$config['youtube_js_html'] = '<div class="video-container" data-video="$2">'.
|
||||
'<a href="https://youtu.be/$2" target="_blank" class="file">'.
|
||||
'https://youtu.be/$2'.
|
||||
'</a></div>';
|
||||
$config['youtube_js_html']
|
||||
= '<div class="video-container" data-video="$2">'
|
||||
. '<a href="https://youtu.be/$2" target="_blank" class="file">'
|
||||
. '<img style="width:255px;height:190px;" src="/vi/$2/0.jpg" class="post-image"/>'
|
||||
. '</a></div>';
|
||||
|
||||
$config['embedding'] = array();
|
||||
$config['embedding'][0] = array(
|
||||
$config['embedding'][0] =
|
||||
array(
|
||||
'/^https?:\/\/(\w+\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9\-_]{10,11})(&.+)?$/i',
|
||||
$config['youtube_js_html']);
|
||||
$config['youtube_js_html']
|
||||
);
|
||||
$config['additional_javascript'][] = 'js/youtube.js';
|
||||
|
||||
/*
|
||||
|
|
|
@ -29,6 +29,7 @@ onready(function(){
|
|||
|
||||
function addEmbedButton(index, videoNode) {
|
||||
videoNode = $(videoNode);
|
||||
var contents = videoNode.contents();
|
||||
var videoId = videoNode.data('video');
|
||||
var span = $("<span>[Embed]</span>");
|
||||
var embedNode = $('<iframe style="float:left;margin: 10px 20px" type="text/html" '+
|
||||
|
@ -36,9 +37,11 @@ onready(function(){
|
|||
'?autoplay=1&html5=1" allowfullscreen frameborder="0"/>');
|
||||
span.click(function() {
|
||||
if (span.text() == ON){
|
||||
videoNode.append(contents);
|
||||
embedNode.remove();
|
||||
span.text(OFF);
|
||||
} else{
|
||||
contents.detach();
|
||||
videoNode.append(embedNode);
|
||||
span.text(ON);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue