From 2163055daece0b5de1ba10949b2dca9880bdea19 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 9 Jan 2021 14:40:56 +0100 Subject: [PATCH] media-player: play links don't scroll on click --- copyparty/web/browser.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index cb01e184..e6373704 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -8,7 +8,14 @@ function dbg(msg) { function ev(e) { e = e || window.event; - e.preventDefault ? e.preventDefault() : (e.returnValue = false); + + if (e.preventDefault) + e.preventDefault() + + if (e.stopPropagation) + e.stopPropagation(); + + e.returnValue = false; return e; } @@ -447,7 +454,8 @@ function play(tid, call_depth) { mp.au.tid = tid; mp.au.src = url; mp.au.volume = mp.expvol(); - setclass('trk' + tid, 'play act'); + var oid = 'trk' + tid; + setclass(oid, 'play act'); try { if (hack_attempt_play) @@ -456,7 +464,11 @@ function play(tid, call_depth) { if (mp.au.paused) autoplay_blocked(); - location.hash = 'trk' + tid; + var o = ebi(oid); + o.setAttribute('id', 'thx_js'); + location.hash = oid; + o.setAttribute('id', oid); + pbar.drawbuf(); return true; }