also scroll to playing track when resizing window

This commit is contained in:
ed 2022-11-29 22:16:14 +00:00
parent 3a800585bc
commit 5c30148be4
2 changed files with 17 additions and 4 deletions

View file

@ -1257,7 +1257,7 @@ html.y #widget.open {
#widget.cmp #pvol {
top: 0;
right: 0;
max-width: 6em;
max-width: 5.8em;
border-radius: 0;
}
.opview {

View file

@ -1280,7 +1280,7 @@ var mpl = (function () {
bcfg_bind(r, 'clip', 'au_npclip', false, function (v) {
clmod(ebi('wtoggle'), 'np', v && mp.au);
});
bcfg_bind(r, 'follow', 'au_follow', false);
bcfg_bind(r, 'follow', 'au_follow', false, setaufollow);
bcfg_bind(r, 'ac_flac', 'ac_flac', true);
bcfg_bind(r, 'ac_aac', 'ac_aac', false);
bcfg_bind(r, 'ac_oth', 'ac_oth', true, reload_mp);
@ -1355,6 +1355,11 @@ var mpl = (function () {
navigator.mediaSession.playbackState = mp.au && !mp.au.paused ? "playing" : "paused";
};
function setaufollow() {
window[(r.follow ? "add" : "remove") + "EventListener"]("resize", scroll2playing);
}
setaufollow();
function announce() {
if (!r.os_ctl || !mp.au)
return;
@ -2626,8 +2631,7 @@ function play(tid, is_ev, seek) {
thegrid.loadsel();
if (mpl.follow)
QS((!thegrid || !thegrid.en) ?
'tr.play' : '#ggrid a.play').scrollIntoView();
scroll2playing();
try {
mp.au.play();
@ -2662,6 +2666,15 @@ function play(tid, is_ev, seek) {
}
function scroll2playing() {
try {
QS((!thegrid || !thegrid.en) ?
'tr.play' : '#ggrid a.play').scrollIntoView();
}
catch (ex) { }
}
// event from the audio object if something breaks
function evau_error(e) {
var err = '',