mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 02:05:22 -04:00
This commit is contained in:
@@ -17,6 +17,10 @@ let API_BASE = '';
|
|||||||
let _uploadSpinners = [];
|
let _uploadSpinners = [];
|
||||||
const _previewUrls = new WeakMap();
|
const _previewUrls = new WeakMap();
|
||||||
|
|
||||||
|
const MAX_FILES = 10;
|
||||||
|
const MAX_VISIBLE = 3;
|
||||||
|
let _expanded = false;
|
||||||
|
|
||||||
function _getPreviewUrl(f) {
|
function _getPreviewUrl(f) {
|
||||||
if (!f) return '';
|
if (!f) return '';
|
||||||
let url = _previewUrls.get(f);
|
let url = _previewUrls.get(f);
|
||||||
@@ -49,10 +53,6 @@ export function openPicker() {
|
|||||||
document.getElementById('file-input').click();
|
document.getElementById('file-input').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAX_VISIBLE = 3;
|
|
||||||
const MAX_EXPAND = 6; // beyond this, the badge stays collapsed (too many chips to preview)
|
|
||||||
let _expanded = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the attachment strip with pending files.
|
* Render the attachment strip with pending files.
|
||||||
* 1-3 files: show individual chips.
|
* 1-3 files: show individual chips.
|
||||||
@@ -80,11 +80,9 @@ export function renderAttachStrip() {
|
|||||||
label.className = 'thumb-collapsed-label';
|
label.className = 'thumb-collapsed-label';
|
||||||
badge.appendChild(label);
|
badge.appendChild(label);
|
||||||
badge.title = pendingFiles.map(f => f.name || 'pasted-image').join('\n');
|
badge.title = pendingFiles.map(f => f.name || 'pasted-image').join('\n');
|
||||||
const canExpand = total <= MAX_EXPAND;
|
badge.style.cursor = 'pointer';
|
||||||
badge.style.cursor = canExpand ? 'pointer' : 'default';
|
|
||||||
badge.addEventListener('click', (e) => {
|
badge.addEventListener('click', (e) => {
|
||||||
if (e.target.closest('.thumb-collapsed-x')) return;
|
if (e.target.closest('.thumb-collapsed-x')) return;
|
||||||
if (!canExpand) return; // too many files — don't expand into chips
|
|
||||||
_expanded = true;
|
_expanded = true;
|
||||||
renderAttachStrip();
|
renderAttachStrip();
|
||||||
});
|
});
|
||||||
@@ -201,8 +199,6 @@ export async function uploadPending() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAX_FILES = 10;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add files to pending list (capped at MAX_FILES)
|
* Add files to pending list (capped at MAX_FILES)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user