From 9692570ec2a3242b737c92b9eac48f7015d63287 Mon Sep 17 00:00:00 2001 From: Terry Geng Date: Wed, 20 May 2020 09:21:06 +0800 Subject: [PATCH] fix: player display bug, continue, sigh --- static/js/custom.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/static/js/custom.js b/static/js/custom.js index 69d6c82..6ca98df 100644 --- a/static/js/custom.js +++ b/static/js/custom.js @@ -125,7 +125,10 @@ function displayPlaylist(data) { playlist_loading.hide(); $(".playlist-item").remove(); let items = data.items; - playlist_items = items; + playlist_items = {}; + for (let i in items){ + playlist_items[items[i].index] = items[i] + } let length = data.length; let start_from = data.start_from; playlist_range_from = start_from; @@ -156,7 +159,7 @@ function displayPlaylist(data) { } displayActiveItem(data.current_index); - updatePlayerInfo(items[data.current_index - data.start_from]); + updatePlayerInfo(playlist_items[data.current_index]); bindPlaylistEvent(); playlist_table.animate({ opacity: 1 }, 200); }); @@ -236,7 +239,7 @@ function checkForPlaylistUpdate() { updatePlaylist(); } else { playlist_current_index = data.current_index; - updatePlayerInfo(playlist_items[data.current_index - data.start_from]); + updatePlayerInfo(playlist_items[data.current_index]); displayActiveItem(data.current_index); } }