(scripts, cmp, down, cb)
| 522 | }; |
| 523 | |
| 524 | var sortScripts = function(scripts, cmp, down, cb) { |
| 525 | |
| 526 | if (V) console.log("sortScripts: start"); |
| 527 | |
| 528 | if (cmp === undefined || cmp === null) cmp = "rank"; |
| 529 | if (down === undefined || down === null) down = true; |
| 530 | |
| 531 | var id = gOptions.fire_sort_cache_enabled ? scriptOrder + '_' + scriptOrderDown.toString() : ""; |
| 532 | var sort = []; |
| 533 | var index = 0; |
| 534 | var newTable = gOptions.fire_sort_cache_enabled ? createScriptTable(id) : null; |
| 535 | var cached = gOptions.fire_sort_cache_enabled ? newTable.inserted : false; |
| 536 | var tr, i, td1, td2, ic, tabv; |
| 537 | var delay0, delay1, delay2; |
| 538 | var oldTable = scriptTable |
| 539 | |
| 540 | if (gOptions.fire_sort_cache_enabled) { |
| 541 | if (cached && V) { |
| 542 | console.log("use cached table " + id); |
| 543 | } |
| 544 | scriptTable.setAttribute('style', Helper.staticVars.invisible_move); |
| 545 | } |
| 546 | |
| 547 | /* var delayedRemove = function() { |
| 548 | if (V) console.log("old table removement started"); |
| 549 | oldTable.setAttribute('class', ''); |
| 550 | if (V) console.log("old table removement started 2"); |
| 551 | |
| 552 | oldTable.parentNode = null; |
| 553 | if (V) console.log("old table removement ended"); |
| 554 | }; */ |
| 555 | |
| 556 | if (gOptions.fire_sort_cache_enabled) { |
| 557 | scriptTable.parentNode.insertBefore(newTable, scriptTable); |
| 558 | scriptTable = newTable; |
| 559 | scriptTable.setAttribute('style', Helper.staticVars.visible_move); |
| 560 | } |
| 561 | |
| 562 | var parent = null; |
| 563 | |
| 564 | if (!cached) { |
| 565 | parent = crc('div', 'scripttbody', 'new', id, 'tbody'); |
| 566 | if (scriptTable) scriptTable.appendChild(parent); |
| 567 | } |
| 568 | |
| 569 | delay0 = function() { |
| 570 | if (V) console.log("sortScripts: delay 0"); |
| 571 | |
| 572 | for (var j=0; j<scripts.length; j++) { |
| 573 | tabv = scripts[j].tabv; |
| 574 | i = scripts[j].item; |
| 575 | // id hack to generate new elements |
| 576 | i.id = i.id + id; |
| 577 | |
| 578 | tr = crc('div', 'scripttr', i.name, i.id, 'outer'); |
| 579 | if (gOptions.fire_sort_cache_enabled || !tr.inserted) { |
| 580 | td1 = crc('div', 'scripttd', i.name, i.id, '1'); |
| 581 | td2 = crc('div', 'scripttd', i.name, i.id, '2'); |
no test coverage detected
searching dependent graphs…