diff --git a/www/assets/js/account.js b/www/assets/js/account.js
index 04d04de8..85ad8e9c 100644
--- a/www/assets/js/account.js
+++ b/www/assets/js/account.js
@@ -9,8 +9,8 @@ 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.
*/
-var uname = readCookie("sync_uname") || "";
-var session = readCookie("sync_session") || "";
+var uname = readCookie("cytube_uname") || "";
+var session = readCookie("cytube_session") || "";
var api = WEB_URL + "/api/json/";
var loggedin = false;
diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js
index 14764a80..0600ad19 100644
--- a/www/assets/js/callbacks.js
+++ b/www/assets/js/callbacks.js
@@ -356,9 +356,10 @@ Callbacks = {
banlist: function(entries) {
var tbl = $("#banlist table");
- // dumb hack because of jquery UI
- // sortable turns tables and lists into a mess of race conditions
+ // I originally added this check because of a race condition
+ // Now it seems to work without but I don't trust it
if(!tbl.hasClass("table")) {
+ console.log("thing");
setTimeout(function() {
Callbacks.banlist(entries);
}, 100);
@@ -391,8 +392,8 @@ Callbacks = {
recentLogins: function(entries) {
var tbl = $("#loginhistory table");
- // dumb hack because of jquery UI
- // sortable turns tables and lists into a mess of race conditions
+ // I originally added this check because of a race condition
+ // Now it seems to work without but I don't trust it
if(!tbl.hasClass("table")) {
setTimeout(function() {
Callbacks.recentLogins(entries);
@@ -415,8 +416,10 @@ Callbacks = {
channelRanks: function(entries) {
var tbl = $("#channelranks table");
- // Dammit jQuery UI
+ // I originally added this check because of a race condition
+ // Now it seems to work without but I don't trust it
if(!tbl.hasClass("table")) {
+ console.log("thing");
setTimeout(function() {
Callbacks.channelRanks(entries);
}, 100);
@@ -935,35 +938,8 @@ Callbacks = {
}
}
}
-
-/*
-pl = [];
-for(var i = 0; i < 10; i++) {
- var m = {
- title: "Test " + i,
- type: "yt",
- id: "test" + i,
- seconds: 0,
- duration: "00:00"
- };
- pl.push(m);
-}
-setTimeout(function() {
- Callbacks.playlist(pl);
-}, 1000);
-*/
-
-$.getScript(IO_URL+"/socket.io/socket.io.js", function() {
- try {
- socket = io.connect(IO_URL);
- setupCallbacks();
- }
- catch(e) {
- Callbacks.disconnect();
- }
-});
-
setupCallbacks = function() {
+ console.log(socket);
for(var key in Callbacks) {
(function(key) {
socket.on(key, function(data) {
@@ -973,3 +949,23 @@ setupCallbacks = function() {
}
}
+if(USEROPTS.altsocket) {
+ socket = new NotWebsocket();
+ setupCallbacks();
+}
+else {
+ $.getScript(IO_URL+"/socket.io/socket.io.js", function() {
+ try {
+ if(NO_WEBSOCKETS) {
+ var i = io.transports.indexOf("websocket");
+ if(i >= 0)
+ io.transports.splice(i, 1);
+ }
+ socket = io.connect(IO_URL);
+ setupCallbacks();
+ }
+ catch(e) {
+ Callbacks.disconnect();
+ }
+ });
+}
diff --git a/www/assets/js/data.js b/www/assets/js/data.js
index fe50c3b3..451062aa 100644
--- a/www/assets/js/data.js
+++ b/www/assets/js/data.js
@@ -1,3 +1,5 @@
+var CL_VERSION = "2.0.0";
+
var CLIENT = {
rank: -1,
leader: false,
diff --git a/www/assets/js/iourl.js b/www/assets/js/iourl.js
index 19f76b90..9aa8b2ef 100644
--- a/www/assets/js/iourl.js
+++ b/www/assets/js/iourl.js
@@ -11,3 +11,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var IO_URL = "http://localhost:1337";
var WEB_URL = "http://localhost:8080";
+var NO_WEBSOCKETS = false;
diff --git a/www/assets/js/notwebsocket.js b/www/assets/js/notwebsocket.js
index 7aba9f4c..8aaf6cdb 100644
--- a/www/assets/js/notwebsocket.js
+++ b/www/assets/js/notwebsocket.js
@@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var NotWebsocket = function() {
this.connected = false;
this.polltmr = false;
- $.getJSON(WEB_URL + "/nws/connect", function(data) {
+ $.getJSON(WEB_URL + "/nws/connect?callback=?", function(data) {
this.hash = data;
this.connected = true;
this.recv(["connect", undefined]);
@@ -76,7 +76,7 @@ NotWebsocket.prototype.emit = function(msg, data) {
}
var pkt = [msg, data];
var str = escape(JSON.stringify(pkt)).replace(/\//g, "%2F");
- $.getJSON(WEB_URL+"/nws/"+this.hash+"/"+str, function() {
+ $.getJSON(WEB_URL+"/nws/"+this.hash+"/"+str+"?callback=?", function() {
// Poll more quickly because sending a packet usually means
// expecting some data to come back
this.pollint = 100;
diff --git a/www/assets/js/ui.js b/www/assets/js/ui.js
index b6e896b7..61b34f1b 100644
--- a/www/assets/js/ui.js
+++ b/www/assets/js/ui.js
@@ -57,7 +57,7 @@ $("#chatline").keydown(function(ev) {
msg: msg
});
CHATHIST.push($("#chatline").val());
- CHATLISTIDX = CHATHIST.length;
+ CHATHISTIDX = CHATHIST.length;
$("#chatline").val("");
}
return;
@@ -326,3 +326,8 @@ else {
}
});
}
+
+/* oh internet explorer, how I hate thee */
+$(":input:not(textarea)").keypress(function(ev) {
+ return ev.keyCode != 13;
+});
diff --git a/www/assets/js/util.js b/www/assets/js/util.js
index b790f504..492f34b0 100644
--- a/www/assets/js/util.js
+++ b/www/assets/js/util.js
@@ -111,8 +111,6 @@ function addUserDropdown(entry, name) {
$("").text(name).appendTo(menu);
$(" ").appendTo(menu);
- if(CLIENT.rank >= 2)
- $("").addClass("user-aliases").appendTo(menu);
if(hasPermission("kick")) {
$("").addClass("btn btn-mini btn-block")
.text("Kick")
@@ -164,8 +162,6 @@ function addUserDropdown(entry, name) {
entry.contextmenu(function(ev) {
ev.preventDefault();
if(menu.css("display") == "none") {
- menu.find(".user-aliases")
- .text("Aliases: " + entry.data("aliases"));
menu.show();
}
else {
@@ -476,7 +472,7 @@ function applyOpts() {
}
if(USEROPTS.altsocket) {
- if(socket)
+ if(socket && socket.disconnect)
socket.disconnect();
socket = new NotWebsocket();
setupCallbacks();
@@ -649,6 +645,8 @@ function hasPermission(key) {
function handlePermissionChange() {
function setVisible(selector, bool) {
+ // I originally added this check because of a race condition
+ // Now it seems to work without but I don't trust it
if($(selector) && $(selector).attr("id") != selector.substring(1)) {
setTimeout(function() {
setVisible(selector, bool);
diff --git a/www/channel.html b/www/channel.html
index 722f813e..bfd82492 100644
--- a/www/channel.html
+++ b/www/channel.html
@@ -26,8 +26,8 @@
CyTube