mirror of
https://github.com/9001/copyparty.git
synced 2026-04-02 22:08:38 +10:00
zip selection
This commit is contained in:
@@ -182,6 +182,11 @@ a, #files tbody div a:last-child {
|
||||
color: #840;
|
||||
text-shadow: 0 0 .3em #b80;
|
||||
}
|
||||
#files tbody tr.sel td {
|
||||
background: #80b;
|
||||
color: #fff;
|
||||
border-color: #a3d;
|
||||
}
|
||||
#blocked {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
@@ -268,6 +273,25 @@ a, #files tbody div a:last-child {
|
||||
padding: .2em 0 0 .07em;
|
||||
color: #fff;
|
||||
}
|
||||
#wtoggle>span {
|
||||
display: none;
|
||||
}
|
||||
#wtoggle.sel {
|
||||
width: 4.27em;
|
||||
}
|
||||
#wtoggle.sel>span {
|
||||
display: inline-block;
|
||||
line-height: 0;
|
||||
}
|
||||
#wtoggle.sel>span a {
|
||||
font-size: .4em;
|
||||
margin: -.3em 0;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
#wtoggle.sel>span #selzip {
|
||||
top: -.6em;
|
||||
}
|
||||
#barpos,
|
||||
#barbuf {
|
||||
position: absolute;
|
||||
|
||||
@@ -112,7 +112,14 @@
|
||||
{%- endif %}
|
||||
|
||||
<div id="widget">
|
||||
<div id="wtoggle">♫</div>
|
||||
<div id="wtoggle">
|
||||
<span>
|
||||
<a href="#" id="selall">sel.<br />all</a>
|
||||
<a href="#" id="selinv">sel.<br />inv.</a>
|
||||
<a href="#" id="selzip">zip</a>
|
||||
</span>
|
||||
♫
|
||||
</div>
|
||||
<div id="widgeti">
|
||||
<div id="pctl"><a href="#" id="bprev">⏮</a><a href="#" id="bplay">▶</a><a href="#" id="bnext">⏭</a></div>
|
||||
<canvas id="pvol" width="288" height="38"></canvas>
|
||||
|
||||
@@ -1595,6 +1595,8 @@ var arcfmt = (function () {
|
||||
o.setAttribute("href", href.slice(0, ofs + 1) + arg);
|
||||
o.textContent = fmt.split('_')[0];
|
||||
}
|
||||
ebi('selzip').textContent = fmt.split('_')[0];
|
||||
ebi('selzip').setAttribute('fmt', arg);
|
||||
}
|
||||
|
||||
function try_render() {
|
||||
@@ -1624,6 +1626,69 @@ var arcfmt = (function () {
|
||||
})();
|
||||
|
||||
|
||||
var msel = (function () {
|
||||
function getsel() {
|
||||
var names = [];
|
||||
var links = document.querySelectorAll('#files tbody tr.sel td:nth-child(2) a');
|
||||
for (var a = 0, aa = links.length; a < aa; a++)
|
||||
names.push(links[a].getAttribute('href'));
|
||||
|
||||
return names;
|
||||
}
|
||||
function selui() {
|
||||
var fun = getsel().length ? "add" : "remove";
|
||||
ebi('wtoggle').classList[fun]('sel');
|
||||
}
|
||||
function seltgl(e) {
|
||||
ev(e);
|
||||
var tr = this.parentNode;
|
||||
tr.classList.toggle('sel');
|
||||
selui();
|
||||
}
|
||||
var trs = document.querySelectorAll('#files tbody tr');
|
||||
ebi('selall').onclick = function (e) {
|
||||
ev(e);
|
||||
for (var a = 0, aa = trs.length; a < aa; a++)
|
||||
trs[a].classList.add('sel');
|
||||
selui();
|
||||
};
|
||||
ebi('selinv').onclick = function (e) {
|
||||
ev(e);
|
||||
for (var a = 0, aa = trs.length; a < aa; a++)
|
||||
trs[a].classList.toggle('sel');
|
||||
selui();
|
||||
};
|
||||
ebi('selzip').onclick = function (e) {
|
||||
ev(e);
|
||||
var names = getsel();
|
||||
var arg = ebi('selzip').getAttribute('fmt');
|
||||
var txt = names.join('\n');
|
||||
var frm = document.createElement('form');
|
||||
frm.setAttribute('action', '?' + arg);
|
||||
frm.setAttribute('method', 'post');
|
||||
frm.setAttribute('target', '_blank');
|
||||
frm.setAttribute('enctype', 'multipart/form-data');
|
||||
frm.innerHTML = '<input name="act" value="zip" />' +
|
||||
'<textarea name="files" id="ziptxt"></textarea>';
|
||||
frm.style.display = 'none';
|
||||
|
||||
var oldform = document.querySelector('#widgeti>form');
|
||||
if (oldform)
|
||||
oldform.parentNode.removeChild(oldform);
|
||||
|
||||
ebi('widgeti').appendChild(frm);
|
||||
var obj = ebi('ziptxt');
|
||||
obj.value = txt;
|
||||
console.log(txt);
|
||||
frm.submit();
|
||||
};
|
||||
var tds = document.querySelectorAll('#files tbody td+td+td');
|
||||
for (var a = 0, aa = tds.length; a < aa; a++) {
|
||||
tds[a].onclick = seltgl;
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
function ev_row_tgl(e) {
|
||||
ev(e);
|
||||
filecols.toggle(this.parentElement.parentElement.getElementsByTagName('span')[0].textContent);
|
||||
|
||||
Reference in New Issue
Block a user