Compare commits

..

No commits in common. "c1585ed09a05dce0c3f26b3d173d7062db514906" and "72d3fe1e4eb7484e61c5a8b54e3f0b017ed6b6be" have entirely different histories.

2 changed files with 17 additions and 68 deletions

View File

@ -1,6 +1,6 @@
{
"name": "multi-hoster-uploader",
"version": "3.3.36",
"version": "3.3.35",
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
"main": "main.js",
"scripts": {

View File

@ -4120,79 +4120,31 @@ function loadAutoCheckPreference() {
}
// --- Queue table column resizing (JDownloader-style) ---
// Two-tier widths: _idealColumnWidths is what the user set (persisted); the
// displayed widths are scaled proportionally if the window is too narrow to fit
// all ideals (fullscreen → windowed). We never overwrite ideals just because
// the window shrunk — only an explicit drag updates the ideal for that column.
const _idealColumnWidths = {};
function restoreQueueColumnWidths() {
try {
const raw = localStorage.getItem(QUEUE_COL_WIDTHS_KEY);
if (raw) {
const widths = JSON.parse(raw);
if (widths && typeof widths === 'object') {
for (const [col, px] of Object.entries(widths)) {
if (typeof px === 'number' && px > 20) _idealColumnWidths[col] = px;
}
if (!raw) return;
const widths = JSON.parse(raw);
if (!widths || typeof widths !== 'object') return;
for (const [col, px] of Object.entries(widths)) {
const th = document.querySelector(`#queueTable th[data-col="${col}"]`);
if (th && typeof px === 'number' && px > 20) {
th.style.width = px + 'px';
}
}
_applyFittedColumnWidths();
} catch {}
}
function saveDraggedColumnWidth(col, width) {
// Called from the resizer onUp: the dragged column's new width becomes its
// new ideal. Other columns keep their saved ideals untouched (so a drag
// while the window is small doesn't bake the scaled values in).
if (!col || typeof width !== 'number' || width < 40) return;
_idealColumnWidths[col] = width;
try { localStorage.setItem(QUEUE_COL_WIDTHS_KEY, JSON.stringify(_idealColumnWidths)); } catch {}
_applyFittedColumnWidths();
function saveQueueColumnWidths() {
try {
const widths = {};
document.querySelectorAll('#queueTable th[data-col]').forEach(th => {
widths[th.dataset.col] = th.getBoundingClientRect().width;
});
localStorage.setItem(QUEUE_COL_WIDTHS_KEY, JSON.stringify(widths));
} catch {}
}
function _applyFittedColumnWidths() {
const container = document.getElementById('queueContainer');
if (!container) return;
const ths = document.querySelectorAll('#queueTable th[data-col]');
if (!ths.length) return;
const entries = [];
let total = 0;
ths.forEach(th => {
// Fall back to the column's currently-measured width if no ideal exists
// yet (first render before the user ever dragged).
const ideal = _idealColumnWidths[th.dataset.col] || th.getBoundingClientRect().width || 0;
entries.push({ th, ideal });
total += ideal;
});
if (total <= 0) return;
const available = container.clientWidth;
if (available <= 0) return;
const MIN = 40;
if (total <= available) {
entries.forEach(({ th, ideal }) => { th.style.width = ideal + 'px'; });
return;
}
// Scale all columns proportionally so they exactly fit the available width.
const scale = available / total;
entries.forEach(({ th, ideal }) => {
th.style.width = Math.max(MIN, Math.round(ideal * scale)) + 'px';
});
}
// Debounced window-resize refit. Fires on every window size change — fullscreen
// → windowed, dragging the window edge, monitor unplug — and reshapes columns
// to the new viewport so the user never has to drag the window wider just to
// see a hidden column.
let _columnRefitTimer = null;
window.addEventListener('resize', () => {
clearTimeout(_columnRefitTimer);
_columnRefitTimer = setTimeout(_applyFittedColumnWidths, 60);
});
function setupColumnResizing() {
const headers = document.querySelectorAll('#queueTable th[data-col]');
headers.forEach(th => {
@ -4219,10 +4171,7 @@ function setupColumnResizing() {
document.removeEventListener('mouseup', onUp);
resizer.classList.remove('dragging');
document.body.classList.remove('col-resizing');
// Only the dragged column's new width becomes its new ideal; other
// columns keep their saved ideals (so dragging while the window is
// narrow doesn't permanently shrink everything else).
saveDraggedColumnWidth(th.dataset.col, th.getBoundingClientRect().width);
saveQueueColumnWidths();
};
document.addEventListener('mousemove', onMove);