From 0d9c66a773813fb4ba523324a3699b8be9e6625d Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Tue, 14 May 2013 23:48:01 +1200 Subject: Remove debug spam, show visible warning on disconnect --- public/css/style.css | 10 ++++++++++ public/index.html | 1 + public/js/mv/connect.js | 16 +++++++++------- public/js/mv/main.js | 2 -- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 4ebf8d3..ea91109 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -147,6 +147,16 @@ h3 { /* User list */ +#connection-warning { + display: none; + position: absolute; + border: 2px black solid; + background: #fccccc; + top: 0; + right: 0; + padding: 1em; +} + #connect-status { border-left: 1px black solid; border-bottom: 1px black solid; diff --git a/public/index.html b/public/index.html index c5201f2..96c3f17 100644 --- a/public/index.html +++ b/public/index.html @@ -6,6 +6,7 @@
+
Connection error! Refresh the page to reload.

Manavis users

diff --git a/public/js/mv/connect.js b/public/js/mv/connect.js index 564690d..6e521a3 100644 --- a/public/js/mv/connect.js +++ b/public/js/mv/connect.js @@ -17,8 +17,15 @@ var mv = function(mv) { var socket; function connect() { socket = io.connect('http://localhost:3000'); - socket.on("connect", function() { console.log("CONNECT", arguments); }); - socket.on("disconnect", function() { console.log("DISCONNECT", arguments); }); + /* These are still useful to troubleshoot */ + socket.on("connect", function() { + console.log("CONNECT", arguments); + }); + socket.on("disconnect", function() { + console.log("DISCONNECT", arguments); + d3.select("#connection-warning").style("display", "block"); + }); + /* We're evidently operating online, so show the status */ d3.select("#connect-status").style("display", "block"); socket.emit('login'); /* Tell the server our starting filters */ @@ -169,7 +176,6 @@ var mv = function(mv) { unchannelled.push(users[uid]); } } - console.log("Channels:", groups, "Users without channels:", unchannelled); groups.push(unchannelled); var createpart = usersStatus.select(".createpart"); /* Link to part a channel we're in, or create a channel if we're not in one */ @@ -209,7 +215,6 @@ var mv = function(mv) { * Feel free to FIXME! */ if (i != groups.length - 1) { - console.log("Group is a channel", i, groups.length); group .attr("class", "group channel") ; @@ -228,7 +233,6 @@ var mv = function(mv) { join.style("display", "inline"); } } else { - console.log("Group is not a channel", i, groups.length); var join = group.select(".join"); group .attr("class", "group") @@ -247,13 +251,11 @@ var mv = function(mv) { userlist .each(function(d,i) { var elm = d3.select(this); - console.log("Userlist para appending", d,i); var name = elm.select(".name"); var nick = d.nick == null ? "Anonymous User " + d.id : d.nick; if (d.id == id) { /* This is us! We can edit our name. */ if (name.empty()) { - console.log("Found our entry. id:", id, "datum", d); name = elm.append("input").attr("class", "name") .attr("type", "text") .attr("placeholder", "Enter name here") diff --git a/public/js/mv/main.js b/public/js/mv/main.js index d7ebdf9..34a6c00 100644 --- a/public/js/mv/main.js +++ b/public/js/mv/main.js @@ -1,7 +1,6 @@ "use strict"; var mv = function(mv) { mv.init = function() { - console.log("Initialising"); var loadbar = progress('loadbar'); var filesbar = progress('filesbar'); var lbase = loadbar.label; @@ -56,7 +55,6 @@ var mv = function(mv) { .style("opacity", 1) ; mv.charter.init(); - console.log(document.getElementById("connect-option").checked); if (document.getElementById("connect-option").checked) { mv.connect.connect(); } -- cgit v1.2.3-60-g2f50