mirror of
https://github.com/vibegif/vibegif.lol.git
synced 2026-04-07 02:12:12 +00:00
Refactor: allow custom download filename
This commit is contained in:
@@ -2,6 +2,7 @@ export const ELEMENT_IDS = [
|
|||||||
'setup-screen', 'main-screen', 'setup-key', 'setup-save',
|
'setup-screen', 'main-screen', 'setup-key', 'setup-save',
|
||||||
'btn-settings', 'modal-settings', 'modal-key', 'modal-save', 'btn-close-modal',
|
'btn-settings', 'modal-settings', 'modal-key', 'modal-save', 'btn-close-modal',
|
||||||
'sel-model', 'inp-prompt', 'inp-frames', 'inp-fps', 'sel-ratio', 'inp-max-size',
|
'sel-model', 'inp-prompt', 'inp-frames', 'inp-fps', 'sel-ratio', 'inp-max-size',
|
||||||
|
'chk-semi-transparent',
|
||||||
'btn-generate', 'progress-area', 'progress-bar', 'progress-text', 'frames-preview',
|
'btn-generate', 'progress-area', 'progress-bar', 'progress-text', 'frames-preview',
|
||||||
'result-area', 'result-gif', 'btn-download'
|
'result-area', 'result-gif', 'btn-download'
|
||||||
];
|
];
|
||||||
@@ -52,13 +53,16 @@ export function addFramePreview(el, src, index) {
|
|||||||
el.framesPreview.appendChild(img);
|
el.framesPreview.appendChild(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showResult(el, blobUrl) {
|
export function showResult(el, blobUrl, filename = 'vibegif.gif') {
|
||||||
if (el.resultArea) {
|
if (el.resultArea) {
|
||||||
el.resultArea.classList.remove('hidden');
|
el.resultArea.classList.remove('hidden');
|
||||||
el.resultArea.style.display = 'flex';
|
el.resultArea.style.display = 'flex';
|
||||||
}
|
}
|
||||||
if (el.resultGif) el.resultGif.src = blobUrl;
|
if (el.resultGif) el.resultGif.src = blobUrl;
|
||||||
if (el.btnDownload) el.btnDownload.href = blobUrl;
|
if (el.btnDownload) {
|
||||||
|
el.btnDownload.href = blobUrl;
|
||||||
|
el.btnDownload.download = filename;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hideResult(el) {
|
export function hideResult(el) {
|
||||||
|
|||||||
Reference in New Issue
Block a user