mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
bikeshedding
This commit is contained in:
parent
19bc962ad5
commit
179d7a9ad8
|
@ -453,10 +453,10 @@ html.light #ggrid a.sel {
|
||||||
html.light #wfm a:not(.en) {
|
html.light #wfm a:not(.en) {
|
||||||
color: #c4a;
|
color: #c4a;
|
||||||
}
|
}
|
||||||
#files tbody td.c1 {
|
#files tbody tr.c1 td {
|
||||||
animation: fcut1 .5s ease-out;
|
animation: fcut1 .5s ease-out;
|
||||||
}
|
}
|
||||||
#files tbody td.c2 {
|
#files tbody tr.c2 td {
|
||||||
animation: fcut2 .5s ease-out;
|
animation: fcut2 .5s ease-out;
|
||||||
}
|
}
|
||||||
@keyframes fcut1 {
|
@keyframes fcut1 {
|
||||||
|
|
|
@ -1504,37 +1504,42 @@ var fileman = (function () {
|
||||||
r.delete = function (e) {
|
r.delete = function (e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
var sel = msel.getsel(),
|
var sel = msel.getsel(),
|
||||||
req = msel.selu;
|
vps = [];
|
||||||
|
|
||||||
|
for (var a = 0; a < sel.length; a++)
|
||||||
|
vps.push(sel.vp);
|
||||||
|
|
||||||
if (!sel.length)
|
if (!sel.length)
|
||||||
return alert('select at least 1 item to delete');
|
return alert('select at least 1 item to delete');
|
||||||
|
|
||||||
if (!confirm('===== DANGER =====\nDELETE these ' + req.length + ' items?\n\n' + req.join('\n')))
|
if (!confirm('===== DANGER =====\nDELETE these ' + vps.length + ' items?\n\n' + vps.join('\n')))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!confirm('Last chance! Delete?'))
|
if (!confirm('Last chance! Delete?'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
toast.show(req.length + ' deletes left', 2000);
|
toast.show(vps.length + ' deletes left', 2000);
|
||||||
};
|
};
|
||||||
|
|
||||||
r.cut = function (e) {
|
r.cut = function (e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
var sel = msel.getsel(),
|
var sel = msel.getsel(),
|
||||||
vsel = msel.selu;
|
vps = [];
|
||||||
|
|
||||||
if (!sel.length)
|
if (!sel.length)
|
||||||
return alert('select at least 1 item to cut');
|
return alert('select at least 1 item to cut');
|
||||||
|
|
||||||
var tds = QSA('#files tbody tr.sel td');
|
for (var a = 0; a < sel.length; a++) {
|
||||||
for (var a = 0; a < tds.length; a++) {
|
vps.push(sel[a].vp);
|
||||||
var cl = tds[a].classList, inv = cl.contains('c1');
|
var cl = ebi(sel[a].id).closest('tr').classList,
|
||||||
|
inv = cl.contains('c1');
|
||||||
|
|
||||||
cl.remove(inv ? 'c1' : 'c2');
|
cl.remove(inv ? 'c1' : 'c2');
|
||||||
cl.add(inv ? 'c2' : 'c1');
|
cl.add(inv ? 'c2' : 'c1');
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.show('cut ' + sel.length + ' items', 1000);
|
toast.show('cut ' + sel.length + ' items', 1000);
|
||||||
jwrite('fman_clip', vsel);
|
jwrite('fman_clip', vps);
|
||||||
r.tx();
|
r.tx();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1631,9 +1636,6 @@ var thegrid = (function () {
|
||||||
|
|
||||||
ebi('griden').onclick = ebi('wtgrid').onclick = function (e) {
|
ebi('griden').onclick = ebi('wtgrid').onclick = function (e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
if (!this.closest)
|
|
||||||
return;
|
|
||||||
|
|
||||||
r.en = !r.en;
|
r.en = !r.en;
|
||||||
bcfg_set('griden', r.en);
|
bcfg_set('griden', r.en);
|
||||||
if (r.en) {
|
if (r.en) {
|
||||||
|
@ -2256,6 +2258,7 @@ document.onkeydown = function (e) {
|
||||||
ofiles.setAttribute("q_raw", this.q_raw);
|
ofiles.setAttribute("q_raw", this.q_raw);
|
||||||
set_vq();
|
set_vq();
|
||||||
mukey.render();
|
mukey.render();
|
||||||
|
msel.render();
|
||||||
reload_browser();
|
reload_browser();
|
||||||
filecols.set_style(['File Name']);
|
filecols.set_style(['File Name']);
|
||||||
|
|
||||||
|
@ -3171,31 +3174,45 @@ var arcfmt = (function () {
|
||||||
|
|
||||||
var msel = (function () {
|
var msel = (function () {
|
||||||
var r = {};
|
var r = {};
|
||||||
r.selu = null;
|
r.sel = null;
|
||||||
r.seln = null;
|
r.all = null;
|
||||||
|
|
||||||
r.getsel = function () {
|
r.load = function () {
|
||||||
if (r.seln !== null)
|
if (r.sel)
|
||||||
return r.seln;
|
return;
|
||||||
|
|
||||||
r.selu = [];
|
r.sel = [];
|
||||||
r.seln = [];
|
r.all = [];
|
||||||
var links = QSA('#files tbody tr.sel td:nth-child(2) a'),
|
var links = QSA('#files tbody td:nth-child(2) a:last-child'),
|
||||||
vbase = get_evpath();
|
vbase = get_evpath();
|
||||||
|
|
||||||
for (var a = 0, aa = links.length; a < aa; a++) {
|
for (var a = 0, aa = links.length; a < aa; a++) {
|
||||||
var url = links[a].getAttribute('href').replace(/\/$/, ""),
|
var href = links[a].getAttribute('href').replace(/\/$/, ""),
|
||||||
name = url.split('/').slice(-1);
|
item = {};
|
||||||
|
|
||||||
r.selu.push(url.indexOf('/') !== -1 ? url : vbase + url);
|
item.id = links[a].getAttribute('id');
|
||||||
r.seln.push(name);
|
item.sel = links[a].closest('tr').classList.contains('sel');
|
||||||
links[a].setAttribute('name', name);
|
item.vp = href.indexOf('/') !== -1 ? href : vbase + href;
|
||||||
|
item.name = href.split('/').slice(-1);
|
||||||
|
|
||||||
|
r.all.push(item);
|
||||||
|
if (item.sel)
|
||||||
|
r.sel.push(item);
|
||||||
|
|
||||||
|
links[a].setAttribute('name', item.name);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return r.seln;
|
r.getsel = function () {
|
||||||
}
|
r.load();
|
||||||
|
return r.sel;
|
||||||
|
};
|
||||||
|
r.getall = function () {
|
||||||
|
r.load();
|
||||||
|
return r.all;
|
||||||
|
};
|
||||||
function selui() {
|
function selui() {
|
||||||
r.selu = r.seln = null;
|
r.sel = r.all = null;
|
||||||
clmod(ebi('wtoggle'), 'sel', r.getsel().length);
|
clmod(ebi('wtoggle'), 'sel', r.getsel().length);
|
||||||
thegrid.loadsel();
|
thegrid.loadsel();
|
||||||
fileman.render();
|
fileman.render();
|
||||||
|
@ -3249,9 +3266,10 @@ var msel = (function () {
|
||||||
for (var a = 0, aa = tds.length; a < aa; a++) {
|
for (var a = 0, aa = tds.length; a < aa; a++) {
|
||||||
tds[a].onclick = seltgl;
|
tds[a].onclick = seltgl;
|
||||||
}
|
}
|
||||||
r.selu = r.seln = null;
|
r.sel = r.all = null;
|
||||||
arcfmt.render();
|
arcfmt.render();
|
||||||
fileman.render();
|
fileman.render();
|
||||||
|
ebi('selzip').style.display = ebi('unsearch') ? 'none' : '';
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -123,6 +123,15 @@ if (!String.startsWith) {
|
||||||
return this.substring(i, i + s.length) === s;
|
return this.substring(i, i + s.length) === s;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (!Element.prototype.closest) {
|
||||||
|
Element.prototype.closest = function (s) {
|
||||||
|
var el = this;
|
||||||
|
do {
|
||||||
|
if (el.msMatchesSelector(s)) return el;
|
||||||
|
el = el.parentElement || el.parentNode;
|
||||||
|
} while (el !== null && el.nodeType === 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// https://stackoverflow.com/a/950146
|
// https://stackoverflow.com/a/950146
|
||||||
|
|
Loading…
Reference in a new issue