mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 09:22:31 -06:00
archive format selection in browser
This commit is contained in:
parent
c8f59fb978
commit
426687b75e
|
@ -1473,6 +1473,7 @@ class HttpCli(object):
|
||||||
),
|
),
|
||||||
have_up2k_idx=("e2d" in vn.flags),
|
have_up2k_idx=("e2d" in vn.flags),
|
||||||
have_tags_idx=("e2t" in vn.flags),
|
have_tags_idx=("e2t" in vn.flags),
|
||||||
|
have_zip=(not self.args.no_zip),
|
||||||
logues=logues,
|
logues=logues,
|
||||||
title=html_escape(self.vpath),
|
title=html_escape(self.vpath),
|
||||||
srv_info=srv_info,
|
srv_info=srv_info,
|
||||||
|
|
|
@ -41,10 +41,12 @@
|
||||||
<div id="op_cfg" class="opview opbox">
|
<div id="op_cfg" class="opview opbox">
|
||||||
<h3>key notation</h3>
|
<h3>key notation</h3>
|
||||||
<div id="key_notation"></div>
|
<div id="key_notation"></div>
|
||||||
|
{%- if have_zip %}
|
||||||
|
<h3>folder download</h3>
|
||||||
|
<div id="arc_fmt"></div>
|
||||||
|
{%- endif %}
|
||||||
<h3>tooltips</h3>
|
<h3>tooltips</h3>
|
||||||
<div>
|
<div><a id="tooltips" class="tglbtn" href="#">enable</a></div>
|
||||||
<a id="tooltips" class="tglbtn" href="#">enable</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1 id="path">
|
<h1 id="path">
|
||||||
|
|
|
@ -1149,6 +1149,7 @@ var treectl = (function () {
|
||||||
|
|
||||||
filecols.set_style();
|
filecols.set_style();
|
||||||
mukey.render();
|
mukey.render();
|
||||||
|
arcfmt.render();
|
||||||
reload_tree();
|
reload_tree();
|
||||||
reload_browser();
|
reload_browser();
|
||||||
}
|
}
|
||||||
|
@ -1559,6 +1560,70 @@ function addcrc() {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
var arcfmt = (function () {
|
||||||
|
if (!ebi('arc_fmt'))
|
||||||
|
return { "render": function () { } };
|
||||||
|
|
||||||
|
var html = [],
|
||||||
|
arcfmts = ["tar", "zip", "zip_dos", "zip_crc"],
|
||||||
|
arcv = ["tar", "zip=utf8", "zip", "zip=crc"];
|
||||||
|
|
||||||
|
for (var a = 0; a < arcfmts.length; a++) {
|
||||||
|
var k = arcfmts[a];
|
||||||
|
html.push(
|
||||||
|
'<span><input type="radio" name="arcfmt" value="' + k + '" id="arcfmt_' + k + '">' +
|
||||||
|
'<label for="arcfmt_' + k + '">' + k + '</label></span>');
|
||||||
|
}
|
||||||
|
ebi('arc_fmt').innerHTML = html.join('\n');
|
||||||
|
|
||||||
|
var fmt = sread("arc_fmt") || "zip";
|
||||||
|
ebi('arcfmt_' + fmt).checked = true;
|
||||||
|
|
||||||
|
function render() {
|
||||||
|
var arg = arcv[arcfmts.indexOf(fmt)],
|
||||||
|
tds = document.querySelectorAll('#files tbody td:first-child a');
|
||||||
|
|
||||||
|
for (var a = 0, aa = tds.length; a < aa; a++) {
|
||||||
|
var o = tds[a], txt = o.textContent, href = o.getAttribute('href');
|
||||||
|
if (txt != 'tar' && txt != 'zip')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var ofs = href.lastIndexOf('?');
|
||||||
|
if (ofs < 0)
|
||||||
|
throw 'missing arg in url';
|
||||||
|
|
||||||
|
o.setAttribute("href", href.slice(0, ofs + 1) + arg);
|
||||||
|
o.textContent = fmt.split('_')[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function try_render() {
|
||||||
|
try {
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
console.log("arcfmt failed: " + ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function change_fmt(e) {
|
||||||
|
ev(e);
|
||||||
|
fmt = this.getAttribute('value');
|
||||||
|
swrite("arc_fmt", fmt);
|
||||||
|
try_render();
|
||||||
|
}
|
||||||
|
|
||||||
|
var o = document.querySelectorAll('#arc_fmt input');
|
||||||
|
for (var a = 0; a < o.length; a++) {
|
||||||
|
o[a].onchange = change_fmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"render": try_render
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
function ev_row_tgl(e) {
|
function ev_row_tgl(e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
filecols.toggle(this.parentElement.parentElement.getElementsByTagName('span')[0].textContent);
|
filecols.toggle(this.parentElement.parentElement.getElementsByTagName('span')[0].textContent);
|
||||||
|
@ -1611,3 +1676,4 @@ function reload_browser(not_mp) {
|
||||||
}
|
}
|
||||||
reload_browser(true);
|
reload_browser(true);
|
||||||
mukey.render();
|
mukey.render();
|
||||||
|
arcfmt.render();
|
||||||
|
|
Loading…
Reference in a new issue