(CKey, collection, notes, online)
| 489 | |
| 490 | // MARK: addCollection |
| 491 | async #addCollection(CKey, collection, notes, online) { |
| 492 | const colRec = { |
| 493 | data : collection, |
| 494 | mapList : [], |
| 495 | modNode : document.createElement('tr'), |
| 496 | modNodePoint : null, |
| 497 | node : document.createElement('tr'), |
| 498 | nodeBot : null, |
| 499 | nodeIcon : null, |
| 500 | notes : notes, |
| 501 | online : online, |
| 502 | scroll : document.createElement('scroller-item'), |
| 503 | sorter : [], |
| 504 | |
| 505 | sort_author : [], |
| 506 | sort_date : [], |
| 507 | sort_name : [], |
| 508 | sort_title : [], |
| 509 | sort_version : [], |
| 510 | } |
| 511 | |
| 512 | colRec.scroll.id = `${CKey}--scroller` |
| 513 | colRec.node.id = CKey |
| 514 | colRec.node.classList.add('mod-table-folder', 'border-bottom') |
| 515 | colRec.node.addEventListener('contextmenu', () => { this.colContext(CKey)} ) |
| 516 | |
| 517 | |
| 518 | if ( ! this.flag.folderEdit ) { |
| 519 | colRec.node.appendChild(DATA.templateEngine('item_collect', { |
| 520 | folderSize : colRec.online ? await DATA.bytesToHR(collection.folderSize) : I18N.defer('removable_offline', false), |
| 521 | name : collection.name, |
| 522 | tagLine : notes.notes_tagline, |
| 523 | totalCount : collection.alphaSort.length > 999 ? '999+' : collection.alphaSort.length, |
| 524 | })) |
| 525 | |
| 526 | colRec.node.children[0].addEventListener('click', () => { this.colToggle(CKey)} ) |
| 527 | colRec.node.children[1].addEventListener('click', () => { this.colToggle(CKey)} ) |
| 528 | |
| 529 | colRec.nodeBot = colRec.node.querySelector('.botInfo') |
| 530 | colRec.nodeIcon = colRec.node.querySelector('.folder-icon-svg') |
| 531 | |
| 532 | colRec.modNode.id = `${CKey}--mods` |
| 533 | colRec.modNode.classList.add('mod-table-folder-detail', 'd-none') |
| 534 | colRec.modNode.innerHTML = [ |
| 535 | '<td class="mod-table-folder-details px-0 ps-4" colspan="3">', |
| 536 | '<i18n-text class="no-mods-found d-block fst-italic small text-center d-none" data-key="empty_or_filtered"></i18n-text>', |
| 537 | '<table class="w-100 py-0 my-0 table table-sm table-hover table-striped"></table>', |
| 538 | '</td>' |
| 539 | ].join('') |
| 540 | |
| 541 | colRec.modNodePoint = colRec.modNode.querySelector('table') |
| 542 | } else { |
| 543 | colRec.node.appendChild(DATA.templateEngine('item_collect_edit', { |
| 544 | dateAdd : DATA.dateToString(notes.notes_add_date), |
| 545 | dateUsed : DATA.dateToString(notes.notes_last), |
| 546 | folderSize : colRec.online ? await DATA.bytesToHR(collection.folderSize) : I18N.defer('removable_offline', false), |
| 547 | name : collection.name, |
| 548 | tagLine : notes.notes_tagline, |
no test coverage detected