diff --git a/inc/instance-config.php b/inc/instance-config.php
index 4b66f15f..b668571e 100644
--- a/inc/instance-config.php
+++ b/inc/instance-config.php
@@ -346,7 +346,6 @@ $config['enable_embedding'] = true;
$config['youtube_js_html'] = '
';
$config['embedding'] = array();
diff --git a/js/youtube.js b/js/youtube.js
index 9fe81b60..4c4cb74a 100644
--- a/js/youtube.js
+++ b/js/youtube.js
@@ -25,21 +25,32 @@
onready(function(){
var do_embed_yt = function(tag) {
- $('div.video-container a', tag).click(function() {
- var videoID = $(this.parentNode).data('video');
-
- $(this.parentNode).html('');
+ const ON = "[Remove]";
+ const OFF = "[Embed]";
- return false;
+ var videoNode = $('div.video-container', tag);
+ var videoId = videoNode.data('video');
+ var span = $("[Embed]");
+ var embedNode = $('')
+ span.click(function() {
+ if (span.text() == ON){
+ videoNode.remove("iframe");
+ span.text(OFF);
+ } else{
+ videoNode.append(embedNode);
+ span.innerHTML = ON;
+ }
});
+
+ videoNode.append(span);
};
do_embed_yt(document);
- // allow to work with auto-reload.js, etc.
- $(document).on('new_post', function(e, post) {
- do_embed_yt(post);
- });
+ // allow to work with auto-reload.js, etc.
+ $(document).on('new_post', function(e, post) {
+ do_embed_yt(post);
+ });
});