This commit is contained in:
calzoneman 2013-05-02 22:02:25 -05:00
parent cecb5db6c7
commit e62a02673c
1 changed files with 17 additions and 8 deletions

View File

@ -42,15 +42,24 @@ function parseBool(x) {
return false; return false;
else return Boolean(x); else return Boolean(x);
} }
function getOrDefault(cookie, def) {
var cook = readCookie(cookie);
if(cook === null) {
return def;
}
return cook;
}
var USEROPTS = { var USEROPTS = {
theme : readCookie("cytube_theme") || "default", theme : getOrDefault("cytube_theme", "default"),
css : readCookie("cytube_css") || "", css : getOrDefault("cytube_css", ""),
layout : readCookie("cytube_layout") || "default", layout : getOrDefault("cytube_layout", "default"),
synch : parseBool(readCookie("cytube_synch")) || true, synch : parseBool(getOrDefault("cytube_synch", true)),
hidevid : parseBool(readCookie("cytube_hidevid")) || false, hidevid : parseBool(getOrDefault("cytube_hidevid", false)),
show_timestamps : parseBool(readCookie("cytube_show_timestamps")) || false, show_timestamps : parseBool(getOrDefault("cytube_show_timestamps", false)),
modhat : parseBool(readCookie("cytube_modhat")) || false, modhat : parseBool(getOrDefault("cytube_modhat", false)),
blink_chat : parseBool(readCookie("cytube_blink_chat")) || false blink_title : parseBool(getOrDefault("cytube_blink_title", false))
}; };
applyOpts(); applyOpts();
$("#optlink").click(showUserOpts); $("#optlink").click(showUserOpts);