From 7bc247ede2a58e2dced6000c5c0bb26b1c3a152f Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 14 May 2015 13:14:45 -0500 Subject: [PATCH] Fix 'remove video' option --- www/js/ui.js | 9 +++++++-- www/js/util.js | 4 +--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/www/js/ui.js b/www/js/ui.js index f830fd46..9a76fd7d 100644 --- a/www/js/ui.js +++ b/www/js/ui.js @@ -740,6 +740,11 @@ $("#channeloptions li > a[data-toggle='tab']").on("shown.bs.tab", function () { applyOpts(); (function () { + var embed = document.querySelector("#videowrap .embed-responsive"); + if (!embed) { + return; + } + if (typeof window.MutationObserver === "function") { var mr = new MutationObserver(function (records) { records.forEach(function (record) { @@ -751,13 +756,13 @@ applyOpts(); }); }); - mr.observe($("#videowrap").find(".embed-responsive")[0], { childList: true }); + mr.observe(embed, { childList: true }); } else { /* * DOMNodeInserted is deprecated. This code is here only as a fallback * for browsers that do not support MutationObserver */ - $("#videowrap").find(".embed-responsive")[0].addEventListener("DOMNodeInserted", function (ev) { + embed.addEventListener("DOMNodeInserted", function (ev) { if (ev.target.id === "ytapiplayer") handleVideoResize(); }); } diff --git a/www/js/util.js b/www/js/util.js index 070039bc..033d7af0 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -733,9 +733,7 @@ function applyOpts() { } if(USEROPTS.hidevid) { - $("#qualitywrap").html(""); removeVideo(); - $("#chatwrap").removeClass("col-lg-5 col-md-5").addClass("col-lg-12 col-md-12"); } $("#chatbtn").remove(); @@ -1718,7 +1716,7 @@ function handleVideoResize() { var intv, ticks = 0; var resize = function () { if (++ticks > 10) clearInterval(intv); - if ($("#ytapiplayer").parent().height() === 0) return; + if ($("#ytapiplayer").parent().outerHeight() <= 0) return; clearInterval(intv); var responsiveFrame = $("#ytapiplayer").parent();