From 3600a3114ab5f848ef8d3c260c2aec31bea7fbdf Mon Sep 17 00:00:00 2001 From: calzoneman Date: Wed, 1 May 2013 13:39:01 -0500 Subject: [PATCH] Transition channel page away from index.html --- package.json | 2 +- server.js | 4 +- www/assets/js/client.js | 79 ++++------ www/assets/js/functions.js | 14 +- www/channel.html | 300 +++++++++++++++++++++++++++++++++++++ www/index.html | 51 +++++-- 6 files changed, 382 insertions(+), 68 deletions(-) create mode 100644 www/channel.html diff --git a/package.json b/package.json index 5a3f9bcf..cc5b9c7a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "1.5.2", + "version": "1.5.3", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/server.js b/server.js index 23ffa9c7..7fd1d33f 100644 --- a/server.js +++ b/server.js @@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -const VERSION = "1.5.2"; +const VERSION = "1.5.3"; var fs = require("fs"); var Logger = require("./logger.js"); @@ -26,7 +26,7 @@ app.get("/r/:channel(*)", function(req, res, next) { res.redirect("/" + param); } else { - res.sendfile(__dirname + "/www/index.html"); + res.sendfile(__dirname + "/www/channel.html"); } }); diff --git a/www/assets/js/client.js b/www/assets/js/client.js index 5eb74724..9f5b0559 100644 --- a/www/assets/js/client.js +++ b/www/assets/js/client.js @@ -29,6 +29,7 @@ var VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", "");//670 var VHEIGHT = "377"; var IGNORED = []; var KICKED = false; +var CHANNEL = ""; var uname = readCookie("sync_uname"); var session = readCookie("sync_session"); @@ -46,6 +47,7 @@ var USEROPTS = { css: readCookie("cytube_css") || "", layout: readCookie("cytube_layout") || "default", synch: parseBool(readCookie("cytube_synch")) || true, + hidevid: parseBool(readCookie("cytube_hidevid")) || false, modhat: parseBool(readCookie("cytube_modhat")) || false }; applyOpts(); @@ -81,60 +83,38 @@ $(window).resize(function() { $("#ytapiplayer").attr("width", VWIDTH); }); -var params = {}; -if(window.location.search) { - var parameters = window.location.search.substring(1).split("&"); - for(var i = 0; i < parameters.length; i++) { - var s = parameters[i].split("="); - if(s.length != 2) - continue; - params[s[0]] = s[1]; - } +// Match URLs of the form http://site.tld/r/channel +var loc = document.location+""; +var m = loc.match(/\/r\/([a-zA-Z0-9]+)$/); +if(m) { + CHANNEL = m[1]; } - -if(params["novideo"] != undefined) { - $("#videodiv").remove(); -} - -if(params["channel"] == undefined) { - // Match URLs of the form http://site.tld/r/channel - var loc = document.location+""; - var m = loc.match(/\/r\/([a-zA-Z0-9]+)$/); - if(m) { - socket.emit("joinChannel", { - name: m[1] - }); - } - else { - - var main = $($(".container")[1]); - var container = $("
").addClass("container").insertBefore(main); - var row = $("
").addClass("row").appendTo(container); - var div = $("
").addClass("span6").appendTo(row); - main.css("display", "none"); - var label = $("