mirror of
https://github.com/9001/copyparty.git
synced 2026-04-12 23:32:32 -06:00
add autogrid
This commit is contained in:
parent
5aaa4ff15b
commit
22e26e4bde
|
|
@ -7656,6 +7656,9 @@ var treectl = (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sread('ag_enable') == 1)
|
||||||
|
autogrid(res.files);
|
||||||
|
|
||||||
if (url) setTimeout(asdf, 1); else asdf();
|
if (url) setTimeout(asdf, 1); else asdf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7820,6 +7823,26 @@ var treectl = (function () {
|
||||||
onresize();
|
onresize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function autogrid(files) {
|
||||||
|
var icount = 0;
|
||||||
|
var fcount = files.length;
|
||||||
|
var iext = new Set(sread('ag_ext').split(','));
|
||||||
|
|
||||||
|
for (var a = 0; a < fcount; a++) {
|
||||||
|
var fext = files[a].ext ? files[a].ext.toLowerCase() : '';
|
||||||
|
if (fext && iext.has(fext))
|
||||||
|
icount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
var iratio = fcount > 0 ? (icount / fcount) * 100 : 0;
|
||||||
|
var threshold = sread('ag_thresh');
|
||||||
|
|
||||||
|
if (iratio >= threshold)
|
||||||
|
thegrid.en = true;
|
||||||
|
else if (thegrid.en && sread('griden') == 0)
|
||||||
|
thegrid.en = false;
|
||||||
|
}
|
||||||
|
|
||||||
ebi('entree').onclick = r.entree;
|
ebi('entree').onclick = r.entree;
|
||||||
ebi('detree').onclick = r.detree;
|
ebi('detree').onclick = r.detree;
|
||||||
ebi('visdir').onclick = tree_scrollto;
|
ebi('visdir').onclick = tree_scrollto;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue