diff --git a/README.md b/README.md
index 9b24a08a..bbf62fd7 100644
--- a/README.md
+++ b/README.md
@@ -104,10 +104,8 @@ in the `scripts` folder:
roughly sorted by priority
-* sortable browser columns
* up2k handle filename too long
* up2k fails on empty files? alert then stuck
-* unexpected filepath on dupe up2k
* drop onto folders
* look into android thumbnail cache file format
* support pillow-simd
diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css
index 67cb207b..9c69480b 100644
--- a/copyparty/web/browser.css
+++ b/copyparty/web/browser.css
@@ -68,7 +68,7 @@ a {
}
#files thead th:last-child {
background: #444;
- border-radius: .7em 0 0 0;
+ border-radius: .7em .7em 0 0;
}
#files thead th:first-child {
background: #222;
diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js
index 2375998a..54c9ad90 100644
--- a/copyparty/web/browser.js
+++ b/copyparty/web/browser.js
@@ -34,6 +34,7 @@ window.onerror = function (msg, url, lineNo, columnNo, error) {
esc(String(error[find[a]])).replace(/\n/g, '
\n'));
}
document.body.style.fontSize = '0.8em';
+ document.body.style.padding = '0 1em 1em 1em';
hcroak(html.join('\n'));
};
@@ -78,6 +79,39 @@ function ev(e) {
}
+function sortTable(table, col) {
+ var tb = table.tBodies[0], // use `
` to ignore `` and `` 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 `` 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
var mp = (function () {
var tracks = [];
diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js
index edbaa392..7340f7b2 100644
--- a/copyparty/web/up2k.js
+++ b/copyparty/web/up2k.js
@@ -34,6 +34,7 @@ window.onerror = function (msg, url, lineNo, columnNo, error) {
esc(String(error[find[a]])).replace(/\n/g, '
\n'));
}
document.body.style.fontSize = '0.8em';
+ document.body.style.padding = '0 1em 1em 1em';
hcroak(html.join('\n'));
};
diff --git a/scripts/make-sfx.sh b/scripts/make-sfx.sh
index 6ca5afb7..0f7170bd 100755
--- a/scripts/make-sfx.sh
+++ b/scripts/make-sfx.sh
@@ -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
[ $no_ogv ] &&
- rm -rf copyparty/web/deps/{dynamicaudio,ogv}* copyparty/web/browser.js
+ rm -rf copyparty/web/deps/{dynamicaudio,ogv}*
echo creating tar
args=(--owner=1000 --group=1000)