mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
browser: reload music player on column-sort
so tracks play in the right order
This commit is contained in:
parent
46b6abde3f
commit
0893f06919
|
@ -6,7 +6,7 @@ function dbg(msg) {
|
|||
ebi('path').innerHTML = msg;
|
||||
}
|
||||
|
||||
makeSortable(ebi('files'));
|
||||
makeSortable(ebi('files'), reload_mp);
|
||||
|
||||
|
||||
// extract songs + add play column
|
||||
|
@ -1349,9 +1349,19 @@ function ev_row_tgl(e) {
|
|||
}
|
||||
|
||||
|
||||
function reload_mp() {
|
||||
if (mp && mp.au) {
|
||||
mp.au.pause();
|
||||
mp.au = null;
|
||||
}
|
||||
widget.close();
|
||||
mp = init_mp();
|
||||
}
|
||||
|
||||
|
||||
function reload_browser(not_mp) {
|
||||
filecols.set_style();
|
||||
makeSortable(ebi('files'));
|
||||
makeSortable(ebi('files'), reload_mp);
|
||||
|
||||
var parts = get_evpath().split('/');
|
||||
var rm = document.querySelectorAll('#path>a+a+a');
|
||||
|
@ -1375,14 +1385,8 @@ function reload_browser(not_mp) {
|
|||
oo[a].textContent = hsz;
|
||||
}
|
||||
|
||||
if (!not_mp) {
|
||||
if (mp && mp.au) {
|
||||
mp.au.pause();
|
||||
mp.au = null;
|
||||
}
|
||||
widget.close();
|
||||
mp = init_mp();
|
||||
}
|
||||
if (!not_mp)
|
||||
reload_mp();
|
||||
|
||||
if (window['up2k'])
|
||||
up2k.set_fsearch();
|
||||
|
|
|
@ -128,7 +128,7 @@ function sortTable(table, col) {
|
|||
});
|
||||
for (i = 0; i < tr.length; ++i) tb.appendChild(tr[vl[i][1]]);
|
||||
}
|
||||
function makeSortable(table) {
|
||||
function makeSortable(table, cb) {
|
||||
var th = table.tHead, i;
|
||||
th && (th = th.rows[0]) && (th = th.cells);
|
||||
if (th) i = th.length;
|
||||
|
@ -137,6 +137,8 @@ function makeSortable(table) {
|
|||
th[i].onclick = function (e) {
|
||||
ev(e);
|
||||
sortTable(table, i);
|
||||
if (cb)
|
||||
cb();
|
||||
};
|
||||
}(i));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue