32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
export function showToast(message) {
|
|
const toastEl = document.getElementById('toast');
|
|
if (!toastEl) return;
|
|
toastEl.textContent = message;
|
|
toastEl.classList.add('show');
|
|
setTimeout(() => toastEl.classList.remove('show'), 3000);
|
|
}
|
|
|
|
export function updateImageInfo(data) {
|
|
const resolutionEl = document.getElementById('image-resolution');
|
|
if (resolutionEl) {
|
|
resolutionEl.textContent = `Resolution: ${data.resolution || 'N/A'}`;
|
|
}
|
|
const filenameEl = document.getElementById('image-filename');
|
|
if (filenameEl) {
|
|
filenameEl.textContent = `Filename: ${data.filename || 'N/A'}`;
|
|
}
|
|
const creationEl = document.getElementById('image-creation-date');
|
|
if (creationEl) {
|
|
creationEl.textContent = `Created: ${data.creation_date || 'N/A'}`;
|
|
}
|
|
const promptEl = document.getElementById('image-prompt');
|
|
if (promptEl) {
|
|
// textarea uses value attribute
|
|
if (promptEl.tagName === 'TEXTAREA') {
|
|
promptEl.value = data.prompt_data || '';
|
|
} else {
|
|
promptEl.textContent = data.prompt_data || '';
|
|
}
|
|
}
|
|
}
|