Live preview images for extra networks

Same as the thumbnails in the extra networks tab, just in a small preview window during completion
This commit is contained in:
DominikDoom
2023-08-07 18:50:55 +02:00
parent 90d144a5f4
commit 995a5ecdba
3 changed files with 129 additions and 21 deletions

View File

@@ -81,6 +81,15 @@ async function fetchAPI(url, json = true, cache = false) {
return await response.text();
}
// Extra network preview thumbnails
async function getExtraNetworkPreviewURL(filename, type) {
const previewJSON = await fetchAPI(`tacapi/v1/thumb-preview/${filename}?type=${type}`, true, true);
if (previewJSON?.url)
return `file=${previewJSON.url}`;
else
return null;
}
// Debounce function to prevent spamming the autocomplete function
var dbTimeOut;
const debounce = (func, wait = 300) => {