1
0
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:
towards-a-new-leftypol 2021-04-02 20:15:26 -04:00 committed by Zankaria
parent 7280287695
commit 7b6e475bd0

View File

@ -28,6 +28,7 @@ onReady(function() {
function addEmbedButton(index, videoNode) {
videoNode = $(videoNode);
let contents = videoNode.contents();
let videoId = videoNode.data('video');
let span = $("<span>[Embed]</span>");
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"/>');
span.click(function() {
if (span.text() == ON){
videoNode.append(contents);
embedNode.remove();
span.text(OFF);
} else {
contents.detach();
videoNode.append(embedNode);
span.text(ON);
}