From 149eeb6277676d80c9cb6a05fa14ae7552d97d36 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sat, 27 Jul 2013 16:42:42 -0400 Subject: [PATCH] Add error message when socket fails --- www/assets/js/callbacks.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index 78fbc9ea..98ad4464 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -11,6 +11,31 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI Callbacks = { + error: function (reason) { + var d = $("
").addClass("alert alert-error span12") + .appendTo($("#announcements")); + $("

").text("Uh-oh!").appendTo(d); + $("

").html("The socket.io connection failed."+ + "Try going to the "+ + "'Options' menu and enabling 'Alternate socket "+ + " connection'. If that doesn't help, talk to "+ + "someone on IRC").appendTo(d); + var data = { + iourl: IO_URL, + weburl: WEB_URL, + transports: io.transports, + fallback: USEROPTS.altsocket, + reason: reason + }; + + var r = JSON.stringify(data); + $("").text("When asking for help, give the following "+ + "information to an administrator:").appendTo(d); + $("").text(r).appendTo(d) + .css("white-space", "pre-wrap"); + }, + /* fired when socket connection completes */ connect: function() { socket.emit("joinChannel", { @@ -779,6 +804,12 @@ Callbacks = { $("#ytapiplayer_wrapper").remove(); } if(data.type != PLAYER.type) { + if(data.type === "vi" && typeof $f !== "function") { + setTimeout(function () { + Callbacks.changeMedia(data); + }, 100); + return; + } PLAYER = new Player(data); } if(PLAYER.update) {