diff --git a/www/assets/js/player.js b/www/assets/js/player.js index dabf50b9..182d75ab 100644 --- a/www/assets/js/player.js +++ b/www/assets/js/player.js @@ -43,6 +43,7 @@ var YouTubePlayer = function (data) { }, events: { onReady: function () { + resizeStuff(); }, onStateChange: function (ev) { if(PLAYER.paused && ev.data != YT.PlayerState.PAUSED || diff --git a/www/assets/js/util.js b/www/assets/js/util.js index e84416b6..f7cec12d 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -1355,7 +1355,7 @@ function addChatMessage(data) { function fluidLayout() { $(".container").removeClass("container").addClass("container-fluid"); - // TODO resize + resizeStuff(); } function synchtubeLayout() { @@ -1375,6 +1375,22 @@ function chatOnly() { $("#chatwrap").removeClass("col-lg-5 col-md-5").addClass("col-lg-12 col-md-12"); } +function resizeStuff() { + // Only execute if we are on a fluid layout + if ($(".container-fluid").length === 0) { + return; + } + VWIDTH = $("#videowrap").width() + ""; + VHEIGHT = Math.floor(parseInt(VWIDTH) * 9 / 16) + ""; + $("#ytapiplayer").width(VWIDTH).height(VHEIGHT); + + var h = parseInt(VHEIGHT) - 33; + $("#messagebuffer").height(h); + $("#userlist").height(h); +} + +$(window).resize(resizeStuff); + /* channel administration stuff */ function genPermissionsEditor() {