From 7d7f2cab2b68f9709bdf447de763276f553c38fd Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Fri, 2 Apr 2021 19:39:42 -0400 Subject: [PATCH 1/3] catalog page - rewrite youtube url to be local --- templates/themes/catalog/catalog.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 128b3187..f5a99fab 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -63,7 +63,7 @@
{% if post.youtube %} - Date: Fri, 2 Apr 2021 20:15:26 -0400 Subject: [PATCH 2/3] display youtube video thumbnail (with local url) in embeds --- inc/instance-config.php | 17 ++++++++++------- js/youtube.js | 3 +++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/inc/instance-config.php b/inc/instance-config.php index 4b976212..b0594106 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -366,15 +366,18 @@ $config['additional_javascript'][] = 'js/download-original.js'; $config['enable_embedding'] = true; -$config['youtube_js_html'] = ''; +$config['youtube_js_html'] + = ''; $config['embedding'] = 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['embedding'][0] = + array( + '/^https?:\/\/(\w+\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9\-_]{10,11})(&.+)?$/i', + $config['youtube_js_html'] + ); $config['additional_javascript'][] = 'js/youtube.js'; /* diff --git a/js/youtube.js b/js/youtube.js index 62541bf7..5a7cd5e8 100644 --- a/js/youtube.js +++ b/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 = $("[Embed]"); var embedNode = $('