-function draw_files_table() {
- filtered_files.sort((a, b) => {
- let inverter = 1;
- let _sort_key = sort_key;
- if (sort_key[0] == '-') {
- inverter = -1;
- _sort_key = sort_key.substring(1);
- }
- const cmp = "tags_count" == _sort_key
- ? (a.tags_showable.length > b.tags_showable.length)
- : (a[_sort_key] > b[_sort_key]);
- return inverter * (cmp ? 1 : -1);
- });
- const table = document.getElementById("files_table");
- Array.from(document.getElementsByClassName("file_row")).forEach((row) => row.remove());
- filtered_files.forEach((file) => {
- const tr = new_child_to('tr', table);
- tr.classList.add("file_row");
- new_child_to('td', tr, file.size);
- new_child_to('td', tr, file.duration);
- const td_inject = new_child_to('td', tr);
- const btn_inject = new_child_to('button', td_inject);
- btn_inject.onclick = function() { player_command(`inject_${file.digest}`) };
- btn_inject.disabled = !file.present;
- btn_inject.textContent = 'inject';
- father_tag_links(new_child_to('td', tr), file.tags_showable);
- const td_link = new_child_to('td', tr);
- const a = new_child_to('a', td_link, file.rel_path);
- a.href = `${PATH_PREFIX_FILE}${file.digest}`;
- });
-}
-