From 85f45841f599969de5f288b971cb0d3fee6940cb Mon Sep 17 00:00:00 2001 From: stackxp <170874486+stackxp@users.noreply.github.com> Date: Tue, 7 Apr 2026 14:23:22 +0200 Subject: [PATCH] Add moving files into other folders by dragging --- copyparty/web/browser.css | 16 ++++++ copyparty/web/browser.js | 104 +++++++++++++++++++++++++++++++++++++- copyparty/web/up2k.js | 2 +- 3 files changed, 119 insertions(+), 3 deletions(-) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index a1c2d5e9..b4b75f2b 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -634,6 +634,9 @@ html .ayjump:focus { html.y #path { text-shadow: none; } +#path a.dtarget { + text-shadow: var(--f-sel-sh) 0 0 5px; +} #path #entree { margin-left: -.7em; } @@ -787,6 +790,12 @@ html.y #files span.fsz_P { font-weight: bold } #files .srch_hdr a { display: inline; } +#files tr.dtarget { + box-shadow: 0 0 5px 0 var(--f-sel-sh) inset; +} +#files tr.dtarget td { + background: none; +} #path a { padding: 0 .35em; position: relative; @@ -1100,6 +1109,9 @@ html.dz #flogout { scroll-margin-top: 25vh; scroll-margin-bottom: 20vh; } +#ggrid a.dtarget { + box-shadow: 0 0 5px 0 var(--f-sel-sh); +} #files tr.sel a, #files tr.sel a.play { color: var(--fg2-max); @@ -1623,6 +1635,7 @@ input.ssconf_v { border-collapse: collapse; width: 100%; } + #wrap { margin: .5em .7em 0 .7em; min-height: 70vh; @@ -1753,6 +1766,9 @@ html.dz .btn { margin-left: -.25em; z-index: 3; } +#tree li a.dtarget { + box-shadow: 0 0 5px 0 var(--f-sel-sh) inset; +} #tree ul a.sel { background: #000; background: var(--bg-d3); diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 7876e178..a86a3fa6 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -234,6 +234,7 @@ if (1) "ct_thumb": 'in grid-view, toggle icons or thumbnails$NHotkey: T">🖼️ thumbs', "ct_csel": 'use CTRL and SHIFT for file selection in grid-view">sel', "ct_dsel": 'use drag-selection in grid-view">dsel', + "ct_den": 'use dragging to move files into other folders">mvd', "ct_dl": 'force download (don\'t display inline) when a file is clicked">dl', "ct_ihop": 'when the image viewer is closed, scroll down to the last viewed file">g⮯', "ct_dots": 'show hidden files (if server permits)">dotfiles', @@ -922,6 +923,7 @@ ebi('op_cfg').innerHTML = ( ' 0) ebi('path').appendChild(mknod('i')); ebi('path').appendChild(o); + drag.mktarget(o); } reload_mp(); @@ -9975,7 +10075,7 @@ function reload_browser() { function sel_start(e) { if (e.button !== 0 && e.type !== 'touchstart') return; if (!thegrid.en || !treectl.dsel) return; - if (e.target.closest('#widget,#ops,.opview,.doc')) return; + if (e.target.closest('#widget,#ops,.opview,.doc,#ggrid>a')) return; if (e.target.closest('#gfiles')) ebi('gfiles').style.userSelect = "none" diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 21a6dad0..43220641 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -1066,7 +1066,7 @@ function up2k_init(subtle) { if (toast.txt == L.u_uri) toast.hide(); } - else + else if (!window.drag || !drag.no_warn) return toast.inf(10, L.u_uri) || true; }