diff --git a/README.md b/README.md index 133d962f..cecad1a8 100644 --- a/README.md +++ b/README.md @@ -687,6 +687,8 @@ the browser has the following hotkeys (always qwerty) * `ctrl-C` copy selected files/folders to clipboard * `ctrl-V` paste (move/copy) * `Y` download selected files +* `N` upload file(s) +* `shift-N` upload folder * `F2` [rename](#batch-rename) selected file/folder * when a file/folder is selected (in not-grid-view): * `Up/Down` move cursor diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index ee71d781..96918d49 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -45,6 +45,8 @@ if (1) ["ctrl-C", "copy selection to clipboard"], ["ctrl-V", "paste (move/copy) here"], ["Y", "download selected"], + ["N", "upload file(s)"], + ["ctrl-N", "upload folder"], ["F2", "rename selected"], "file-list-sel", @@ -6365,6 +6367,12 @@ var ahotkeys = function (e) { return showfile.ppj(e) || true; } + if (kl == 'n' && sh) + return up2k.up('dir') + + if (kl == 'n') + return up2k.up('file') + if (sh && kl != 'a' && kl != 'd') return; diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 4750765b..21220883 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -796,7 +796,8 @@ function up2k_init(subtle) { "tact": Date.now(), "init_deps": init_deps, "set_fsearch": set_fsearch, - "gotallfiles": [gotallfiles] // hooks + "gotallfiles": [gotallfiles], // hooks + "up": up, }; setTimeout(function () { @@ -998,7 +999,7 @@ function up2k_init(subtle) { apply_flag_cfg(); set_fsearch(); - function nav() { + function up(t) { start_actx(); var uf = function () { ebi('file' + fdom_ctr).click(); }, @@ -1013,9 +1014,11 @@ function up2k_init(subtle) { if (MOBILE) return uf(); - modal.confirm(L.u_nav_m, uf, ud, null, L.u_nav_b); + if (t == 'file') return uf(); + else if (t == 'dir') return ud(); + else modal.confirm(L.u_nav_m, uf, ud, null, L.u_nav_b); } - ebi('u2btn').onclick = nav; + ebi('u2btn').onclick = up; var nenters = 0; function ondrag(e) {