mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
sortable file list
This commit is contained in:
parent
5b55d05a20
commit
ee96005026
|
@ -104,10 +104,8 @@ in the `scripts` folder:
|
||||||
|
|
||||||
roughly sorted by priority
|
roughly sorted by priority
|
||||||
|
|
||||||
* sortable browser columns
|
|
||||||
* up2k handle filename too long
|
* up2k handle filename too long
|
||||||
* up2k fails on empty files? alert then stuck
|
* up2k fails on empty files? alert then stuck
|
||||||
* unexpected filepath on dupe up2k
|
|
||||||
* drop onto folders
|
* drop onto folders
|
||||||
* look into android thumbnail cache file format
|
* look into android thumbnail cache file format
|
||||||
* support pillow-simd
|
* support pillow-simd
|
||||||
|
|
|
@ -68,7 +68,7 @@ a {
|
||||||
}
|
}
|
||||||
#files thead th:last-child {
|
#files thead th:last-child {
|
||||||
background: #444;
|
background: #444;
|
||||||
border-radius: .7em 0 0 0;
|
border-radius: .7em .7em 0 0;
|
||||||
}
|
}
|
||||||
#files thead th:first-child {
|
#files thead th:first-child {
|
||||||
background: #222;
|
background: #222;
|
||||||
|
|
|
@ -34,6 +34,7 @@ window.onerror = function (msg, url, lineNo, columnNo, error) {
|
||||||
esc(String(error[find[a]])).replace(/\n/g, '<br />\n'));
|
esc(String(error[find[a]])).replace(/\n/g, '<br />\n'));
|
||||||
}
|
}
|
||||||
document.body.style.fontSize = '0.8em';
|
document.body.style.fontSize = '0.8em';
|
||||||
|
document.body.style.padding = '0 1em 1em 1em';
|
||||||
hcroak(html.join('\n'));
|
hcroak(html.join('\n'));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,6 +79,39 @@ function ev(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function sortTable(table, col) {
|
||||||
|
var tb = table.tBodies[0], // use `<tbody>` to ignore `<thead>` and `<tfoot>` rows
|
||||||
|
th = table.tHead.rows[0].cells,
|
||||||
|
tr = Array.prototype.slice.call(tb.rows, 0),
|
||||||
|
i, reverse = th[col].className == 'sort1' ? -1 : 1;
|
||||||
|
for (var a = 0, thl = th.length; a < thl; a++)
|
||||||
|
th[a].className = '';
|
||||||
|
th[col].className = 'sort' + reverse;
|
||||||
|
var stype = th[col].getAttribute('sort');
|
||||||
|
tr = tr.sort(function (a, b) {
|
||||||
|
var v1 = a.cells[col].textContent.trim();
|
||||||
|
var v2 = b.cells[col].textContent.trim();
|
||||||
|
if (stype == 'int') {
|
||||||
|
v1 = parseInt(v1.replace(/,/g, ''));
|
||||||
|
v2 = parseInt(v2.replace(/,/g, ''));
|
||||||
|
return reverse * (v1 - v2);
|
||||||
|
}
|
||||||
|
return reverse * (v1.localeCompare(v2));
|
||||||
|
});
|
||||||
|
for (i = 0; i < tr.length; ++i) tb.appendChild(tr[i]);
|
||||||
|
}
|
||||||
|
function makeSortable(table) {
|
||||||
|
var th = table.tHead, i;
|
||||||
|
th && (th = th.rows[0]) && (th = th.cells);
|
||||||
|
if (th) i = th.length;
|
||||||
|
else return; // if no `<thead>` then do nothing
|
||||||
|
while (--i >= 0) (function (i) {
|
||||||
|
th[i].addEventListener('click', function () { sortTable(table, i) });
|
||||||
|
}(i));
|
||||||
|
}
|
||||||
|
makeSortable(o('files'));
|
||||||
|
|
||||||
|
|
||||||
// extract songs + add play column
|
// extract songs + add play column
|
||||||
var mp = (function () {
|
var mp = (function () {
|
||||||
var tracks = [];
|
var tracks = [];
|
||||||
|
|
|
@ -34,6 +34,7 @@ window.onerror = function (msg, url, lineNo, columnNo, error) {
|
||||||
esc(String(error[find[a]])).replace(/\n/g, '<br />\n'));
|
esc(String(error[find[a]])).replace(/\n/g, '<br />\n'));
|
||||||
}
|
}
|
||||||
document.body.style.fontSize = '0.8em';
|
document.body.style.fontSize = '0.8em';
|
||||||
|
document.body.style.padding = '0 1em 1em 1em';
|
||||||
hcroak(html.join('\n'));
|
hcroak(html.join('\n'));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ grep -lE '\.full\.(js|css)' copyparty/web/* |
|
||||||
while IFS= read -r x; do sed -ri 's/\.full\.(js|css)/.\1/g' "$x"; done
|
while IFS= read -r x; do sed -ri 's/\.full\.(js|css)/.\1/g' "$x"; done
|
||||||
|
|
||||||
[ $no_ogv ] &&
|
[ $no_ogv ] &&
|
||||||
rm -rf copyparty/web/deps/{dynamicaudio,ogv}* copyparty/web/browser.js
|
rm -rf copyparty/web/deps/{dynamicaudio,ogv}*
|
||||||
|
|
||||||
echo creating tar
|
echo creating tar
|
||||||
args=(--owner=1000 --group=1000)
|
args=(--owner=1000 --group=1000)
|
||||||
|
|
Loading…
Reference in a new issue