diff --git a/inc/instance-config.php b/inc/instance-config.php index f1522988..63772843 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -349,7 +349,7 @@ $config['enable_embedding'] = true; $config['youtube_js_html'] = '
'; $config['embedding'] = array(); diff --git a/js/youtube.js b/js/youtube.js index db53f186..9fe81b60 100644 --- a/js/youtube.js +++ b/js/youtube.js @@ -25,32 +25,21 @@ onready(function(){ var do_embed_yt = function(tag) { - const ON = "[Remove]"; - const OFF = "[Embed]"; + $('div.video-container a', tag).click(function() { + var videoID = $(this.parentNode).data('video'); + + $(this.parentNode).html(''); - var videoNode = $('div.video-container', tag); - var videoId = videoNode.data('video'); - var span = $("[Embed]"); - var embedNode = $('') - span.click(function() { - if (span.text() == ON){ - embedNode.remove(); - span.text(OFF); - } else{ - videoNode.append(embedNode); - span.text(ON); - } + return false; }); - - 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); + }); });