diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 571f5632..d0eb3270 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -28,6 +28,8 @@ --row-alt: #282828; --scroll: #eb0; + --sel-fg: var(--bg-d1); + --sel-bg: var(--fg); --a: #fc5; --a-b: #c90; @@ -330,6 +332,8 @@ html.c { } html.cz { --bgg: var(--bg-u2); + --sel-bg: var(--bg-u5); + --sel-fg: var(--fg); --srv-3: #fff; --u2-tab-b1: var(--bg-d3); } @@ -343,6 +347,8 @@ html.cy { --bg-d3: #f77; --bg-d2: #ff0; + --sel-bg: #f77; + --a: #fff; --a-hil: #fff; --a-h-bg: #000; @@ -588,8 +594,8 @@ html.dy { line-height: 1.2em; } ::selection { - color: var(--bg-d1); - background: var(--fg); + color: var(--sel-fg); + background: var(--sel-bg); text-shadow: none; } html,body,tr,th,td,#files,a { diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 55ccc0de..303ea18e 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -337,8 +337,9 @@ var Ls = { "fp_err": "move failed:\n", "fp_confirm": "move these {0} items here?", "fp_etab": 'failed to read clipboard from other browser tab', - "fp_both": 'what do you want to paste?\n\nOK/Enter: Upload {0} files from system clipboard\nEsc/Abort: Move {1} files on server', - "fp_name": "Uploading a PNG image from clipboard.\n\nconfirm by giving it a filename:", + "fp_name": "uploading a file from your device. Give it a name:", + "fp_both_m": '
Enter
= Move {0} files from «{1}»\nESC
= Upload {2} files from your device',
+ "fp_both_b": 'MoveUpload',
"mk_noname": "type a name into the text field on the left before you do that :p",
@@ -844,8 +845,9 @@ var Ls = {
"fp_err": "flytting feilet:\n",
"fp_confirm": "flytt disse {0} filene hit?",
"fp_etab": 'kunne ikke lese listen med filer ifra den andre nettleserfanen',
- "fp_both": "hva vil du lime inn?\n\nOK/Enter: Last opp {0} filer ifra enheten din\nEsc/Avbryt: Flytt {1} filer på serveren",
- "fp_name": "Laster opp PNG-bilde ifra utklippstavle.\n\nbekreft ved å velge et filnavn:",
+ "fp_name": "Laster opp én fil fra enheten din. Velg filnavn:",
+ "fp_both_m": 'Enter
= Flytt {0} filer fra «{1}»\nESC
= Last opp {2} filer fra enheten din',
+ "fp_both_b": 'FlyttLast opp',
"mk_noname": "skriv inn et navn i tekstboksen til venstre først :p",
@@ -4092,9 +4094,10 @@ var fileman = (function () {
if (!r.clip.length)
return r.clip_up(files);
- modal.confirm(
- L.fp_both.format(files.length, r.clip.length),
- function () { r.clip_up(files); }, r.paste);
+ var src = r.clip.length == 1 ? r.clip[0] : vsplit(r.clip[0])[0],
+ msg = L.fp_both_m.format(r.clip.length, src, files.length);
+
+ modal.confirm(msg, r.paste, function () { r.clip_up(files); }, null, L.fp_both_b);
};
r.clip_up = function (files) {
@@ -4122,13 +4125,19 @@ var fileman = (function () {
up2k.gotallfiles[0](good, nil, bad, up2k.gotallfiles.slice(1));
up2k.uc.ask_up = x;
};
- if (good.length != 1 || !/\.png$/.test(good[0][1]))
+ if (good.length != 1)
return doit();
- modal.prompt(L.fp_name, good[0][1].slice(0, -4), function (v) {
- good[0][1] = v + '.png';
- doit(true);
- }, null);
+ var fn = good[0][1],
+ ofs = fn.lastIndexOf('.');
+
+ // stop linux-chrome from adding the fs-path into the
+ setTimeout(function () {
+ modal.prompt(L.fp_name, fn, function (v) {
+ good[0][1] = v;
+ doit(true);
+ }, null, null, 0, ofs > 0 ? ofs : undefined);
+ }, 1);
};
r.d_paste = function () {
diff --git a/copyparty/web/util.js b/copyparty/web/util.js
index da888385..0af50fbf 100644
--- a/copyparty/web/util.js
+++ b/copyparty/web/util.js
@@ -1539,6 +1539,8 @@ var modal = (function () {
cb_up = null,
cb_ok = null,
cb_ng = null,
+ sel_0 = 0,
+ sel_1 = 0,
tok, tng, prim, sec, ok_cancel;
r.load = function () {
@@ -1572,7 +1574,7 @@ var modal = (function () {
(inp || a).focus();
if (inp)
setTimeout(function () {
- inp.setSelectionRange(0, inp.value.length, "forward");
+ inp.setSelectionRange(sel_0, sel_1, "forward");
}, 0);
document.addEventListener('focus', onfocus);
@@ -1695,16 +1697,18 @@ var modal = (function () {
r.show(html);
}
- r.prompt = function (html, v, cok, cng, fun) {
+ r.prompt = function (html, v, cok, cng, fun, so0, so1) {
q.push(function () {
- _prompt(lf2br(html), v, cok, cng, fun);
+ _prompt(lf2br(html), v, cok, cng, fun, so0, so1);
});
next();
}
- var _prompt = function (html, v, cok, cng, fun) {
+ var _prompt = function (html, v, cok, cng, fun, so0, so1) {
cb_ok = cok;
cb_ng = cng === undefined ? cok : null;
cb_up = fun;
+ sel_0 = so0 || 0;
+ sel_1 = so1 === undefined ? v.length : so1;
html += '