MCPcopy Create free account
hub / github.com/error311/FileRise / triggerNextNonZipDownload

Function triggerNextNonZipDownload

public/js/fileListView.js:4781–4822  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4779}
4780
4781function triggerNextNonZipDownload() {
4782 const q = window.__nonZipDownloadQueue || [];
4783 if (!q.length) {
4784 hideNonZipPanel();
4785 showToast(
4786 t('downloads_started') || 'All downloads started.',
4787 'success'
4788 );
4789 return;
4790 }
4791
4792 const { folder, name, sourceId } = q.shift();
4793 const url = apiFileUrl(folder || 'root', name, /* inline */ false, sourceId);
4794
4795 const a = document.createElement('a');
4796 a.href = url;
4797 a.download = name;
4798 a.style.display = 'none';
4799 document.body.appendChild(a);
4800
4801 try {
4802 a.click();
4803 } finally {
4804 setTimeout(() => {
4805 if (a && a.parentNode) {
4806 a.parentNode.removeChild(a);
4807 }
4808 }, 500);
4809 }
4810
4811 // Update queue + UI
4812 window.__nonZipDownloadQueue = q;
4813 if (q.length) {
4814 updateNonZipPanelText();
4815 } else {
4816 hideNonZipPanel();
4817 showToast(
4818 t('downloads_started') || 'All downloads started.',
4819 'success'
4820 );
4821 }
4822}
4823
4824// Optional debug helpers if you want them globally:
4825window.triggerNextNonZipDownload = triggerNextNonZipDownload;

Callers 2

Calls 5

hideNonZipPanelFunction · 0.85
tFunction · 0.85
apiFileUrlFunction · 0.85
updateNonZipPanelTextFunction · 0.85
showToastFunction · 0.70

Tested by

no test coverage detected