mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-08 23:39:46 +01:00
youtube.js: display youtube video thumbnail in embeds
This commit is contained in:
parent
7280287695
commit
7b6e475bd0
@ -28,6 +28,7 @@ onReady(function() {
|
|||||||
|
|
||||||
function addEmbedButton(index, videoNode) {
|
function addEmbedButton(index, videoNode) {
|
||||||
videoNode = $(videoNode);
|
videoNode = $(videoNode);
|
||||||
|
let contents = videoNode.contents();
|
||||||
let videoId = videoNode.data('video');
|
let videoId = videoNode.data('video');
|
||||||
let span = $("<span>[Embed]</span>");
|
let span = $("<span>[Embed]</span>");
|
||||||
let embedNode = $('<iframe style="float:left;margin: 10px 20px" type="text/html" '+
|
let embedNode = $('<iframe style="float:left;margin: 10px 20px" type="text/html" '+
|
||||||
@ -35,9 +36,11 @@ onReady(function() {
|
|||||||
'?autoplay=1&html5=1" allowfullscreen frameborder="0"/>');
|
'?autoplay=1&html5=1" allowfullscreen frameborder="0"/>');
|
||||||
span.click(function() {
|
span.click(function() {
|
||||||
if (span.text() == ON){
|
if (span.text() == ON){
|
||||||
|
videoNode.append(contents);
|
||||||
embedNode.remove();
|
embedNode.remove();
|
||||||
span.text(OFF);
|
span.text(OFF);
|
||||||
} else {
|
} else {
|
||||||
|
contents.detach();
|
||||||
videoNode.append(embedNode);
|
videoNode.append(embedNode);
|
||||||
span.text(ON);
|
span.text(ON);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user