diff options
-rw-r--r-- | libs/music/player.d/main_static.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/libs/music/player.d/main_static.js b/libs/music/player.d/main_static.js index 726b5cf..095f60c 100644 --- a/libs/music/player.d/main_static.js +++ b/libs/music/player.d/main_static.js @@ -767,25 +767,25 @@ function init() sh.elem('overlay').onclick=function(){ try{ NSAudio.audioInit();NSAudio.connect(); - if(window.location.hash.length) + }catch(e){return;} + if(window.location.hash.length) + { + let p=window.location.hash.substr(1).split('/'); + for(let i=0;i<p.length;++i)p[i]=decodeURIComponent(p[i]); + NSUI.switch_playlist(p[0],true); + let id=0; + for(;id<NSPlayer.tracks.length&&NSPlayer.tracks[id].title!=p[1];++id); + if(id<NSPlayer.tracks.length) { - let p=window.location.hash.substr(1).split('/'); - for(let i=0;i<p.length;++i)p[i]=decodeURIComponent(p[i]); - NSUI.switch_playlist(p[0],true); - let id=0; - for(;id<NSPlayer.tracks.length&&NSPlayer.tracks[id].title!=p[1];++id); - if(id<NSPlayer.tracks.length) - { - const p=NSUI.switch_track(id); - if(p!=undefined) - p.then(_=>{sh.elem('overlay').style.display='none';}).catch(e=>{}); - else - //this browser is from an era before this autoplay policy mess, - //assume it succeeded - sh.elem('overlay').style.display='none'; - } + const p=NSUI.switch_track(id); + if(p!=undefined) + p.then(_=>{sh.elem('overlay').style.display='none';}).catch(e=>{}); + else + //this browser is from an era before this autoplay policy mess, + //assume it succeeded + sh.elem('overlay').style.display='none'; } - }catch(e){return;} + } } sh.elem('overlay').onclick(); }, |