From f39e05169931ce9a92c908bb6bde44d47fbeacd7 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sun, 16 Feb 2014 17:54:33 -0600 Subject: [PATCH] Add chatOnly and removeVideo --- templates/channel.jade | 6 ++++++ www/assets/js/ui.js | 14 -------------- www/assets/js/util.js | 34 ++++++++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/templates/channel.jade b/templates/channel.jade index bf579b4a..217160ba 100644 --- a/templates/channel.jade +++ b/templates/channel.jade @@ -15,6 +15,12 @@ html(lang="en") mixin navdefaultlinks(cname) li: a(href="#", onclick="javascript:showUserOptions()") Options li: a#showchansettings(href="#", onclick="javascript:$('#channeloptions').modal()") Channel Settings + li.dropdown + a.dropdown-toggle(href="#", data-toggle="dropdown") Layout + b.caret + ul.dropdown-menu + li: a(href="javascript:chatOnly()") Chat Only + li: a(href="javascript:removeVideo()") Remove Video mixin navloginlogout(cname) section#mainpage .container diff --git a/www/assets/js/ui.js b/www/assets/js/ui.js index 55efc8a8..948fca4c 100644 --- a/www/assets/js/ui.js +++ b/www/assets/js/ui.js @@ -450,20 +450,6 @@ $("#shuffleplaylist").click(function() { } }); -/* layout stuff */ -/* -$(window).resize(function() { - VWIDTH = $("#videowidth").css("width").replace("px", ""); - VHEIGHT = ""+parseInt(parseInt(VWIDTH) * 9 / 16); - $("#messagebuffer").css("height", (VHEIGHT - 31) + "px"); - $("#userlist").css("height", (VHEIGHT - 31) + "px"); - if($("#ytapiplayer").length > 0) { - $("#ytapiplayer").attr("width", VWIDTH); - $("#ytapiplayer").attr("height", VHEIGHT); - } -}); -*/ - /* load channel */ var loc = document.location+""; diff --git a/www/assets/js/util.js b/www/assets/js/util.js index 94d1ac68..a52f6f55 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -1465,14 +1465,39 @@ function hdLayout() { } function chatOnly() { - $("#toprow").remove() - $("#playlistrow").remove(); + var chat = $("#chatwrap").detach(); removeVideo(); - $("#controlsrow").remove(); - $("#chatwrap").removeClass("col-lg-5 col-md-5").addClass("col-lg-12 col-md-12"); + $("#wrap").remove(); + $("footer").remove(); + chat.prependTo($("body")); + chat.css({ + "min-height": "100%", + "min-width": "100%", + margin: "0", + padding: "0" + }); + $("").addClass("label label-default pull-right pointer") + .text("User Options") + .appendTo($("#chatheader")) + .click(showUserOptions); + $("").addClass("label label-default pull-right pointer") + .text("Channel Settings") + .appendTo($("#chatheader")) + .click(function () { + $("#channeloptions").modal(); + }); + $("body").addClass("chatOnly"); + resizeStuff(); } function resizeStuff() { + if ($("body").hasClass("chatOnly")) { + var h = $("body").outerHeight() - $("#chatline").outerHeight() - + $("#chatheader").outerHeight(); + $("#messagebuffer").outerHeight(h); + $("#userlist").outerHeight(h); + return; + } VWIDTH = $("#videowrap").width() + ""; VHEIGHT = Math.floor(parseInt(VWIDTH) * 9 / 16) + ""; $("#ytapiplayer").width(VWIDTH).height(VHEIGHT); @@ -1499,6 +1524,7 @@ function removeVideo() { } $("#videowrap").remove(); + $("#chatwrap").removeClass("col-lg-5 col-md-5").addClass("col-md-12"); } /* channel administration stuff */