aboutsummaryrefslogtreecommitdiff
path: root/modules/ext/webdav.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ext/webdav.js')
-rw-r--r--modules/ext/webdav.js51
1 files changed, 38 insertions, 13 deletions
diff --git a/modules/ext/webdav.js b/modules/ext/webdav.js
index ed312a5..88f1f59 100644
--- a/modules/ext/webdav.js
+++ b/modules/ext/webdav.js
@@ -1962,19 +1962,44 @@ class WebDAVModule {
document.getElementById('bulk-move')?.addEventListener('click', function() {
const names = Object.entries(self._selected).filter(function(e) { return e[1]; }).map(function(e) { return e[0]; });
if (!names.length) return;
- let target = prompt('Move ' + names.length + ' item(s) to directory:', '/');
- if (!target) return;
- target = target.replace(/\/+$/, '');
- names.forEach(function(name) {
- const oldFull = (path.replace(/\/+$/, '') || '') + '/' + name;
- const newFull = target + '/' + name;
- self._webdavRequest('MOVE', oldFull, { headers: { 'Destination': self._absoluteUrl(newFull) } })
- .then(function(r) {
- if (r.ok || r.status === 201 || r.status === 204) self.terminal.print('Moved: ' + name, 'success');
- else self.terminal.print('Move failed: ' + name + ' (HTTP ' + r.status + ')', 'error');
- });
- });
- setTimeout(function() { self.openWebdavBrowser(path); }, 500);
+ // 2026-10-26 (phone test): prompt() is suppressed in iOS standalone PWAs and most
+ // Android WebViews — it returns null, so "Move" looked like a missing feature.
+ // Ask for the destination inline in the bulk bar instead.
+ const doMove = function(rawTarget) {
+ const target = String(rawTarget || '').trim().replace(/\/+$/, '');
+ if (!target) { self.terminal.print('Move cancelled — no destination', 'error'); return; }
+ names.forEach(function(name) {
+ const oldFull = (path.replace(/\/+$/, '') || '') + '/' + name;
+ const newFull = target + '/' + name;
+ self._webdavRequest('MOVE', oldFull, { headers: { 'Destination': self._absoluteUrl(newFull) } })
+ .then(function(r) {
+ if (r.ok || r.status === 201 || r.status === 204) self.terminal.print('Moved: ' + name + ' → ' + newFull, 'success');
+ else self.terminal.print('Move failed: ' + name + ' (HTTP ' + r.status + ')', 'error');
+ })
+ .catch(function(e) { self.terminal.print('Move failed: ' + name + ' — ' + (e && e.message ? e.message : e), 'error'); });
+ });
+ setTimeout(function() { self.openWebdavBrowser(target); }, 600);
+ };
+ const bar = document.getElementById('wdav-bulk-bar');
+ let row = document.getElementById('wdav-move-row');
+ if (row) { row.remove(); row = null; }
+ if (!bar) { doMove(path || '/'); return; }
+ row = document.createElement('div');
+ row.id = 'wdav-move-row';
+ row.style.cssText = 'display:flex;gap:8px;align-items:center;width:100%;padding-top:8px;flex-wrap:wrap';
+ row.innerHTML = '<span style="font-size:0.9em;color:var(--text-color)">Move ' + names.length +
+ ' to:</span><input id="wdav-move-dest" type="text" aria-label="Destination directory" ' +
+ 'style="flex:1;min-width:120px;min-height:44px;padding:6px 10px;font-size:1em;border-radius:4px;' +
+ 'border:1px solid var(--border);background:var(--bg-primary);color:var(--text-color)">' +
+ '<button class="btn" id="wdav-move-go" style="min-height:44px;padding:0 14px">Move here</button>' +
+ '<button class="btn" id="wdav-move-cancel" style="min-height:44px;padding:0 14px">Cancel</button>';
+ bar.appendChild(row);
+ const dest = row.querySelector('#wdav-move-dest');
+ dest.value = (path || '/').replace(/\/+$/, '') || '/';
+ row.querySelector('#wdav-move-go').onclick = function() { const v = dest.value; row.remove(); doMove(v); };
+ row.querySelector('#wdav-move-cancel').onclick = function() { row.remove(); };
+ dest.focus();
+ dest.select();
});
document.getElementById('bulk-download')?.addEventListener('click', function() {
const names = Object.entries(self._selected).filter(function(e) { return e[1]; }).map(function(e) { return e[0]; });