| 268 | }; |
| 269 | |
| 270 | var itemsToMenu = function(items, tabv, cb) { |
| 271 | |
| 272 | var table = null; |
| 273 | var current_elem = null; |
| 274 | var scripts = []; |
| 275 | |
| 276 | var getTable = function(i) { |
| 277 | var t = null; |
| 278 | |
| 279 | if (i.scriptTab) { |
| 280 | t = createScriptTable(); |
| 281 | scriptTable = t; |
| 282 | } else { |
| 283 | t = crc('table', "settingstable", i.name, i.id, 'main'); |
| 284 | var tr = crc('tr', 'settingstr filler', i.name, i.id, 'filler'); |
| 285 | t.appendChild(tr); |
| 286 | } |
| 287 | |
| 288 | return t; |
| 289 | }; |
| 290 | |
| 291 | var section = null; |
| 292 | var section_root = null; |
| 293 | |
| 294 | for (var k in items) { |
| 295 | |
| 296 | var i = items[k]; |
| 297 | if (i.id === undefined) i.id = 'item' + k; |
| 298 | |
| 299 | if (V) console.log("fire: process Item " + i.name); |
| 300 | |
| 301 | var tr = crc('tr', 'settingstr', i.name, i.id, 'outer'); |
| 302 | |
| 303 | if (i.divider) { |
| 304 | /* var td = cr('td', 'divider', k); |
| 305 | td.setAttribute("colspan", "3"); |
| 306 | td.style.height = "15px"; |
| 307 | tr.appendChild(td); */ |
| 308 | tr = null; |
| 309 | } else { |
| 310 | var dummy = cr('td', i.name, i.id, '0'); |
| 311 | tr.appendChild(dummy); |
| 312 | var td1 = cr('td', i.name, i.id, '1'); |
| 313 | var ic = i.icon || i.icon64 || i.image; |
| 314 | if (ic) { |
| 315 | td1.setAttribute("class", "imagetd"); |
| 316 | if (i.id && i.userscript) { |
| 317 | var g = HtmlUtil.createImage(ic, |
| 318 | i.name, |
| 319 | i.id); |
| 320 | g.oldvalue = i.enabled; |
| 321 | td1.appendChild(g); |
| 322 | } else { |
| 323 | td1.appendChild(HtmlUtil.createImage(ic, i.name, i.id)); |
| 324 | } |
| 325 | } |
| 326 | if (i.option) { |
| 327 | gOptions[i.id] = i.checkbox ? i.enabled : i.value; |