mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
disable mkdir and new-doc buttons if no name is provided
also fixes toast.hide() unintentionally stopping events from bubbling
This commit is contained in:
parent
eefa0518db
commit
d3db6d296f
|
@ -332,6 +332,8 @@ var Ls = {
|
||||||
"fp_confirm": "move these {0} items here?",
|
"fp_confirm": "move these {0} items here?",
|
||||||
"fp_etab": 'failed to read clipboard from other browser tab',
|
"fp_etab": 'failed to read clipboard from other browser tab',
|
||||||
|
|
||||||
|
"mk_noname": "type a name into the text field on the left before you do that :p",
|
||||||
|
|
||||||
"tv_load": "Loading text document:\n\n{0}\n\n{1}% ({2} of {3} MiB loaded)",
|
"tv_load": "Loading text document:\n\n{0}\n\n{1}% ({2} of {3} MiB loaded)",
|
||||||
"tv_xe1": "could not load textfile:\n\nerror ",
|
"tv_xe1": "could not load textfile:\n\nerror ",
|
||||||
"tv_xe2": "404, file not found",
|
"tv_xe2": "404, file not found",
|
||||||
|
@ -821,6 +823,8 @@ var Ls = {
|
||||||
"fp_confirm": "flytt disse {0} filene hit?",
|
"fp_confirm": "flytt disse {0} filene hit?",
|
||||||
"fp_etab": 'kunne ikke lese listen med filer ifra den andre nettleserfanen',
|
"fp_etab": 'kunne ikke lese listen med filer ifra den andre nettleserfanen',
|
||||||
|
|
||||||
|
"mk_noname": "skriv inn et navn i tekstboksen til venstre først :p",
|
||||||
|
|
||||||
"tv_load": "Laster inn tekstfil:\n\n{0}\n\n{1}% ({2} av {3} MiB lastet ned)",
|
"tv_load": "Laster inn tekstfil:\n\n{0}\n\n{1}% ({2} av {3} MiB lastet ned)",
|
||||||
"tv_xe1": "kunne ikke laste tekstfil:\n\nfeil ",
|
"tv_xe1": "kunne ikke laste tekstfil:\n\nfeil ",
|
||||||
"tv_xe2": "404, Fil ikke funnet",
|
"tv_xe2": "404, Fil ikke funnet",
|
||||||
|
@ -7267,6 +7271,28 @@ var msel = (function () {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
if (!window.FormData)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var form = QS('#op_new_md>form'),
|
||||||
|
tb = QS('#op_new_md input[name="name"]');
|
||||||
|
|
||||||
|
form.onsubmit = function (e) {
|
||||||
|
if (tb.value) {
|
||||||
|
if (toast.tag == L.mk_noname)
|
||||||
|
toast.hide();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ev(e);
|
||||||
|
toast.err(10, L.mk_noname, L.mk_noname);
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
if (!window.FormData)
|
if (!window.FormData)
|
||||||
return;
|
return;
|
||||||
|
@ -7280,8 +7306,16 @@ var msel = (function () {
|
||||||
|
|
||||||
form.onsubmit = function (e) {
|
form.onsubmit = function (e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
clmod(sf, 'vis', 1);
|
|
||||||
var dn = tb.value;
|
var dn = tb.value;
|
||||||
|
if (!dn) {
|
||||||
|
toast.err(10, L.mk_noname, L.mk_noname);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toast.tag == L.mk_noname || toast.tag == L.fd_xe1)
|
||||||
|
toast.hide();
|
||||||
|
|
||||||
|
clmod(sf, 'vis', 1);
|
||||||
sf.textContent = 'creating "' + dn + '"...';
|
sf.textContent = 'creating "' + dn + '"...';
|
||||||
|
|
||||||
var fd = new FormData();
|
var fd = new FormData();
|
||||||
|
|
|
@ -1455,7 +1455,9 @@ var toast = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
r.hide = function (e) {
|
r.hide = function (e) {
|
||||||
ev(e);
|
if (this === ebi('toastc'))
|
||||||
|
ev(e);
|
||||||
|
|
||||||
unscroll();
|
unscroll();
|
||||||
clearTimeout(te);
|
clearTimeout(te);
|
||||||
clmod(obj, 'vis');
|
clmod(obj, 'vis');
|
||||||
|
@ -1985,6 +1987,9 @@ function xhrchk(xhr, prefix, e404, lvl, tag) {
|
||||||
if (xhr.status < 400 && xhr.status >= 200)
|
if (xhr.status < 400 && xhr.status >= 200)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (tag === undefined)
|
||||||
|
tag = prefix;
|
||||||
|
|
||||||
var errtxt = (xhr.response && xhr.response.err) || xhr.responseText,
|
var errtxt = (xhr.response && xhr.response.err) || xhr.responseText,
|
||||||
fun = toast[lvl || 'err'],
|
fun = toast[lvl || 'err'],
|
||||||
is_cf = /[Cc]loud[f]lare|>Just a mo[m]ent|#cf-b[u]bbles|Chec[k]ing your br[o]wser|\/chall[e]nge-platform|"chall[e]nge-error|nable Ja[v]aScript and cook/.test(errtxt);
|
is_cf = /[Cc]loud[f]lare|>Just a mo[m]ent|#cf-b[u]bbles|Chec[k]ing your br[o]wser|\/chall[e]nge-platform|"chall[e]nge-error|nable Ja[v]aScript and cook/.test(errtxt);
|
||||||
|
|
Loading…
Reference in a new issue