Less hackish fix for boolean cookies

This commit is contained in:
calzoneman 2013-04-28 17:36:06 -05:00
parent 1cc005b55b
commit bdfd7ad3dc
1 changed files with 12 additions and 2 deletions

View File

@ -31,12 +31,22 @@ var IGNORED = [];
var KICKED = false;
var uname = readCookie("sync_uname");
var session = readCookie("sync_session");
function parseBool(x) {
if(typeof x == "boolean")
return x;
else if(x == "true")
return true;
else if(x == "false")
return false;
else return Boolean(x);
}
var USEROPTS = {
theme: readCookie("cytube_theme") || "default",
css: readCookie("cytube_css") || "",
layout: readCookie("cytube_layout") || "default",
synch: (readCookie("cytube_synch") || true) != "false",
modhat: (readCookie("cytube_modhat") || false) != "false"
synch: parseBool(readCookie("cytube_synch")) || true,
modhat: parseBool(readCookie("cytube_modhat")) || false
};
applyOpts();
$("#optlink").click(showUserOpts);