fixing misc javascript syntax errors

* these are nitpicky things that some browsers just step right over silently, and others halt script execution for

* the jquery trim function only works on variables that have been returned as jquery objects, so doing "'foo'.trim()" doesn't work, should be "$.trim('foo')"

* some javascript interpreters (annoyingly) can't handle trailing commas in lists
This commit is contained in:
Danny Warren 2012-09-04 17:21:29 -07:00
parent 96881b6d03
commit 4035d5cf10

View File

@ -34,7 +34,7 @@ var set_conf_cookie = function() {
setCookie('aria2_server_conf', JSON.stringify(server_conf), 30 * 12); setCookie('aria2_server_conf', JSON.stringify(server_conf), 30 * 12);
} }
var get_conf_cookie = function() { var get_conf_cookie = function() {
if (getCookie('aria2_server_conf'.trim())) { if (getCookie( $.trim('aria2_server_conf'))) {
server_conf = JSON.parse(getCookie('aria2_server_conf')); server_conf = JSON.parse(getCookie('aria2_server_conf'));
} }
} }
@ -507,7 +507,7 @@ function getTemplateCtx(data) {
connections: data.connections, connections: data.connections,
upload_speed: changeLength(data.uploadSpeed, "B/s"), upload_speed: changeLength(data.uploadSpeed, "B/s"),
booleans: { booleans: {
is_error: data.status === "error", is_error: data.status === "error"
}, },
chunks: chunks, chunks: chunks,
bittorrent: !!data.bittorrent bittorrent: !!data.bittorrent