mirror of
https://github.com/9001/copyparty.git
synced 2026-06-20 13:12:26 -06:00
less cursed method for checking for dirs
This commit is contained in:
parent
10ad044e64
commit
077cd4e40a
|
|
@ -7208,7 +7208,7 @@ class HttpCli(object):
|
||||||
and vpath
|
and vpath
|
||||||
)
|
)
|
||||||
for fn in ls_names:
|
for fn in ls_names:
|
||||||
base = ""
|
cls = base = ""
|
||||||
href = fn
|
href = fn
|
||||||
if use_abs_url:
|
if use_abs_url:
|
||||||
base = "/" + vpath + "/"
|
base = "/" + vpath + "/"
|
||||||
|
|
@ -7228,6 +7228,7 @@ class HttpCli(object):
|
||||||
|
|
||||||
is_dir = stat.S_ISDIR(inf.st_mode)
|
is_dir = stat.S_ISDIR(inf.st_mode)
|
||||||
if is_dir:
|
if is_dir:
|
||||||
|
cls = "dir"
|
||||||
href += "/"
|
href += "/"
|
||||||
if no_zip:
|
if no_zip:
|
||||||
margin = "DIR"
|
margin = "DIR"
|
||||||
|
|
@ -7297,6 +7298,7 @@ class HttpCli(object):
|
||||||
"ext": ext,
|
"ext": ext,
|
||||||
"dt": dt,
|
"dt": dt,
|
||||||
"ts": int(linf.st_mtime),
|
"ts": int(linf.st_mtime),
|
||||||
|
"cls": cls,
|
||||||
}
|
}
|
||||||
if is_dir:
|
if is_dir:
|
||||||
dirs.append(item)
|
dirs.append(item)
|
||||||
|
|
|
||||||
|
|
@ -636,7 +636,7 @@ a:hover {
|
||||||
a.dir {
|
a.dir {
|
||||||
color: var(--a);
|
color: var(--a);
|
||||||
}
|
}
|
||||||
tr:has(a.dir) td:nth-child(2) a::before {
|
tr.dir td:nth-child(2) a::before {
|
||||||
content: "📁";
|
content: "📁";
|
||||||
margin: 0 .1em 0 -.2em;
|
margin: 0 .1em 0 -.2em;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6232,10 +6232,6 @@ var thegrid = (function () {
|
||||||
if (!ref)
|
if (!ref)
|
||||||
continue;
|
continue;
|
||||||
var cl = ebi(ref).closest('tr').className || '';
|
var cl = ebi(ref).closest('tr').className || '';
|
||||||
|
|
||||||
if (noq_href(ths[a]).endsWith('/'))
|
|
||||||
cl += ' dir';
|
|
||||||
|
|
||||||
ths[a].className = cl;
|
ths[a].className = cl;
|
||||||
|
|
||||||
var chk = ths[a].getElementsByTagName('input')[0];
|
var chk = ths[a].getElementsByTagName('input')[0];
|
||||||
|
|
@ -6315,8 +6311,8 @@ var thegrid = (function () {
|
||||||
ext0 = '',
|
ext0 = '',
|
||||||
name = uricom_dec(vsplit(href)[1]),
|
name = uricom_dec(vsplit(href)[1]),
|
||||||
ref = ao.getAttribute('id'),
|
ref = ao.getAttribute('id'),
|
||||||
isdir = href.endsWith('/'),
|
isdir = clgot(ao.parentElement.parentElement, 'dir'),
|
||||||
ac = isdir ? ' class="dir"' : '',
|
ac = ao.parentElement.parentElement.classList,
|
||||||
ihref = ohref;
|
ihref = ohref;
|
||||||
|
|
||||||
if (need_ext && href != "#") {
|
if (need_ext && href != "#") {
|
||||||
|
|
@ -6369,12 +6365,12 @@ var thegrid = (function () {
|
||||||
ihref += "&raster";
|
ihref += "&raster";
|
||||||
|
|
||||||
html.push('<a href="' + ohref + '" ref="' + ref +
|
html.push('<a href="' + ohref + '" ref="' + ref +
|
||||||
'"' + ac + ' ttt="' + esc(name) + '">' +
|
'" class="' + ac + '" ttt="' + esc(name) + '">' +
|
||||||
'<div class="imgcontainer">' +
|
'<div class="imgcontainer">' +
|
||||||
'<input type="checkbox" class="gselchk"></input>' +
|
'<input type="checkbox" class="gselchk"></input>' +
|
||||||
'<img style="height:' +
|
'<img style="height:' +
|
||||||
(r.sz / 1.25) + 'em" loading="lazy" onload="th_onload(this)" src="' +
|
(r.sz / 1.25) + 'em" loading="lazy" onload="th_onload(this)" src="' +
|
||||||
ihref + '" /></div><span' + ac + '>' + ao.innerHTML + '</span></a>');
|
ihref + '" /></div><span class="' + ac + '">' + ao.innerHTML + '</span></a>');
|
||||||
}
|
}
|
||||||
ggrid.innerHTML = html.join('\n');
|
ggrid.innerHTML = html.join('\n');
|
||||||
clmod(ggrid, 'crop', r.crop);
|
clmod(ggrid, 'crop', r.crop);
|
||||||
|
|
@ -8306,8 +8302,8 @@ var treectl = (function () {
|
||||||
'" rel="nofollow" class="doc' + (lang ? ' bri' : '') +
|
'" rel="nofollow" class="doc' + (lang ? ' bri' : '') +
|
||||||
'" hl="' + id + '" name="' + hname + '">-txt-</a>';
|
'" hl="' + id + '" name="' + hname + '">-txt-</a>';
|
||||||
|
|
||||||
var cl = /\.PARTIAL$/.exec(fname) ? ' class="fade"' : '',
|
var cl = (/\.PARTIAL$/.exec(fname) ? 'fade' : '') + tn.cls,
|
||||||
ln = ['<tr' + cl + '><td>' + tn.lead + '</td><td><a href="' +
|
ln = ['<tr class="' + cl + '"><td>' + tn.lead + '</td><td><a href="' +
|
||||||
top + tn.href + '" id="' + id + '">' + hname +
|
top + tn.href + '" id="' + id + '">' + hname +
|
||||||
'</a></td><td sortv="' + tn.sz + '">' + filesizefun(tn.sz)];
|
'</a></td><td sortv="' + tn.sz + '">' + filesizefun(tn.sz)];
|
||||||
|
|
||||||
|
|
@ -8808,7 +8804,7 @@ function find_file_col(txt) {
|
||||||
function mk_files_header(taglist) {
|
function mk_files_header(taglist) {
|
||||||
var html = [
|
var html = [
|
||||||
'<thead><tr>',
|
'<thead><tr>',
|
||||||
'<th name="lead"><span>c</span></th>',
|
'<th name="lead"><span>!</span></th>',
|
||||||
'<th name="href"><span>File Name</span></th>',
|
'<th name="href"><span>File Name</span></th>',
|
||||||
'<th name="sz" sort="int"><span>Size</span></th>'
|
'<th name="sz" sort="int"><span>Size</span></th>'
|
||||||
];
|
];
|
||||||
|
|
@ -9999,7 +9995,7 @@ if (sb_lg && logues.length) {
|
||||||
var td = tr[a].cells[1],
|
var td = tr[a].cells[1],
|
||||||
ao = td.firstChild,
|
ao = td.firstChild,
|
||||||
href = noq_href(ao),
|
href = noq_href(ao),
|
||||||
isdir = href.endsWith('/'),
|
isdir = clgot(tr[a], 'dir'),
|
||||||
txt = ao.textContent;
|
txt = ao.textContent;
|
||||||
|
|
||||||
td.setAttribute('sortv', (isdir ? '\t' : '') + txt);
|
td.setAttribute('sortv', (isdir ? '\t' : '') + txt);
|
||||||
|
|
@ -10607,7 +10603,7 @@ var drag = (function() {
|
||||||
for (var j = 0; j < links.length; j++)
|
for (var j = 0; j < links.length; j++)
|
||||||
links[j].draggable = false;
|
links[j].draggable = false;
|
||||||
|
|
||||||
if (/(zip|DIR)/.test(f.firstChild.innerHTML)) // very cursed but it works
|
if (clgot(f, 'dir'))
|
||||||
r.mktarget(f);
|
r.mktarget(f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -10635,7 +10631,7 @@ var drag = (function() {
|
||||||
r.no_warn = false;
|
r.no_warn = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (clgot(f, "dir"))
|
if (clgot(f, 'dir'))
|
||||||
r.mktarget(f);
|
r.mktarget(f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue