Compare commits
No commits in common. "c1585ed09a05dce0c3f26b3d173d7062db514906" and "72d3fe1e4eb7484e61c5a8b54e3f0b017ed6b6be" have entirely different histories.
c1585ed09a
...
72d3fe1e4e
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "3.3.36",
|
"version": "3.3.35",
|
||||||
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
|
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -4120,79 +4120,31 @@ function loadAutoCheckPreference() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --- Queue table column resizing (JDownloader-style) ---
|
// --- 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() {
|
function restoreQueueColumnWidths() {
|
||||||
try {
|
try {
|
||||||
const raw = localStorage.getItem(QUEUE_COL_WIDTHS_KEY);
|
const raw = localStorage.getItem(QUEUE_COL_WIDTHS_KEY);
|
||||||
if (raw) {
|
if (!raw) return;
|
||||||
const widths = JSON.parse(raw);
|
const widths = JSON.parse(raw);
|
||||||
if (widths && typeof widths === 'object') {
|
if (!widths || typeof widths !== 'object') return;
|
||||||
for (const [col, px] of Object.entries(widths)) {
|
for (const [col, px] of Object.entries(widths)) {
|
||||||
if (typeof px === 'number' && px > 20) _idealColumnWidths[col] = px;
|
const th = document.querySelector(`#queueTable th[data-col="${col}"]`);
|
||||||
|
if (th && typeof px === 'number' && px > 20) {
|
||||||
|
th.style.width = px + 'px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_applyFittedColumnWidths();
|
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveDraggedColumnWidth(col, width) {
|
function saveQueueColumnWidths() {
|
||||||
// Called from the resizer onUp: the dragged column's new width becomes its
|
try {
|
||||||
// new ideal. Other columns keep their saved ideals untouched (so a drag
|
const widths = {};
|
||||||
// while the window is small doesn't bake the scaled values in).
|
document.querySelectorAll('#queueTable th[data-col]').forEach(th => {
|
||||||
if (!col || typeof width !== 'number' || width < 40) return;
|
widths[th.dataset.col] = th.getBoundingClientRect().width;
|
||||||
_idealColumnWidths[col] = width;
|
|
||||||
try { localStorage.setItem(QUEUE_COL_WIDTHS_KEY, JSON.stringify(_idealColumnWidths)); } catch {}
|
|
||||||
_applyFittedColumnWidths();
|
|
||||||
}
|
|
||||||
|
|
||||||
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';
|
|
||||||
});
|
});
|
||||||
|
localStorage.setItem(QUEUE_COL_WIDTHS_KEY, JSON.stringify(widths));
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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() {
|
function setupColumnResizing() {
|
||||||
const headers = document.querySelectorAll('#queueTable th[data-col]');
|
const headers = document.querySelectorAll('#queueTable th[data-col]');
|
||||||
headers.forEach(th => {
|
headers.forEach(th => {
|
||||||
@ -4219,10 +4171,7 @@ function setupColumnResizing() {
|
|||||||
document.removeEventListener('mouseup', onUp);
|
document.removeEventListener('mouseup', onUp);
|
||||||
resizer.classList.remove('dragging');
|
resizer.classList.remove('dragging');
|
||||||
document.body.classList.remove('col-resizing');
|
document.body.classList.remove('col-resizing');
|
||||||
// Only the dragged column's new width becomes its new ideal; other
|
saveQueueColumnWidths();
|
||||||
// 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);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener('mousemove', onMove);
|
document.addEventListener('mousemove', onMove);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user