diff options
author | Andrew Dolgov <[email protected]> | 2010-11-05 16:16:30 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2010-11-05 16:16:30 +0300 |
commit | f1f3a642d651c2120e52c8df2edc50dc72d0c756 (patch) | |
tree | 0604454f9c1878fcf88a58518b619a420eff65c5 /functions.js | |
parent | 21884958060f9e21e45e1f8a27c05a5326545a69 (diff) |
use JSON for init-params
Diffstat (limited to 'functions.js')
-rw-r--r-- | functions.js | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/functions.js b/functions.js index c0ba5b349..01c3c0508 100644 --- a/functions.js +++ b/functions.js @@ -460,7 +460,7 @@ function parse_counters(reply, scheduled_call) { if (has_img && feed_img) { if (!feed_img.src.match(id + ".ico")) { - feed_img.src = getInitParam("icons_location") + "/" + id + ".ico"; + feed_img.src = getInitParam("icons_url") + "/" + id + ".ico"; } } @@ -2167,21 +2167,25 @@ function backend_sanity_check_callback(transport) { if (params) { console.log('reading init-params...'); - var param = params.firstChild; - - while (param) { - var k = param.getAttribute("key"); - var v = param.getAttribute("value"); - console.log(k + " => " + v); - init_params[k] = v; - - if (db) { - db.execute("DELETE FROM init_params WHERE key = ?", [k]); - db.execute("INSERT INTO init_params (key,value) VALUES (?, ?)", - [k, v]); - } + //var param = params.firstChild; + + params = JSON.parse(params.firstChild.nodeValue); - param = param.nextSibling; + if (params) { + for (var i = 0; i < params.length; i++) { + + var k = params[i].param; + var v = params[i].value; + + console.log(k + " => " + v); + init_params[k] = v; + + if (db) { + db.execute("DELETE FROM init_params WHERE key = ?", [k]); + db.execute("INSERT INTO init_params (key,value) VALUES (?, ?)", + [k, v]); + } + } } } |