add(core): open filesystem while adding library path
This commit is contained in:
@@ -84,6 +84,24 @@ $("#lib-form").addEventListener("submit", async (e) => {
|
||||
} catch (err) { toast(err.message, true); }
|
||||
});
|
||||
|
||||
// path autocompletion for the library form
|
||||
{
|
||||
const pathInput = document.querySelector('#lib-form [name=root_path]');
|
||||
const datalist = $("#path-suggestions");
|
||||
let pathTimer;
|
||||
pathInput.addEventListener("input", () => {
|
||||
clearTimeout(pathTimer);
|
||||
const value = pathInput.value;
|
||||
if (!value.startsWith("/")) return;
|
||||
pathTimer = setTimeout(async () => {
|
||||
try {
|
||||
const res = await api("/api/fs/browse?path=" + encodeURIComponent(value));
|
||||
datalist.innerHTML = res.dirs.map((d) => `<option value="${esc(d)}">`).join("");
|
||||
} catch {}
|
||||
}, 150);
|
||||
});
|
||||
}
|
||||
|
||||
function libOptions(mediaType) {
|
||||
return libraries
|
||||
.filter((l) => l.media_type === mediaType)
|
||||
|
||||
Reference in New Issue
Block a user