+async function update_files_list() {
+ const filter_path = encodeURIComponent(document.getElementById("input_filter_path").value);
+ let target = `${PATH_FILES_JSON}?filter_path=${filter_path}`;
+ if (document.getElementById("input_show_absent").checked) { target = `${target}&show_absent=1`; }
+ needed_tags.forEach((tag) => target = `${target}&needed_tag=${encodeURIComponent(tag)}`);
+ const files_data = await wrapped_fetch(target).then((response) => response.json());
+ document.getElementById("files_count").textContent = `${files_data.length}`;
+ const table = document.getElementById("files_table");
+ Array.from(document.getElementsByClassName("file_row")).forEach((row) => row.remove());
+ files_data.forEach((file) => {
+ const tr = new_child_to('tr', table);
+ tr.classList.add("file_row");
+ new_child_to('td', tr, file.size);
+ const td_play = new_child_to('td', tr);
+ const btn_play = new_child_to('input', td_play);
+ btn_play.type = 'submit';
+ btn_play.name = `play_${file.digest}`;
+ btn_play.value = 'play';
+ btn_play.disabled = !file.present;
+ new_child_to('td', tr, file.tags_showable.join(", "));
+ 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}`;
+ });
+}
+
+window.addEventListener('load', update_filter_inputs);