Skip to content

Commit

Permalink
fix: sidebar songlist highlight status error
Browse files Browse the repository at this point in the history
  • Loading branch information
listen1 committed Mar 1, 2021
1 parent b1d35c7 commit 14e1fbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
17 changes: 7 additions & 10 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,7 @@ const main = () => {
return;
}
let poped = $scope.window_url_stack.pop();
if (
($scope.window_url_stack.slice(-1)[0] || {}).url === '/now_playing'
) {
if ($scope.getCurrentUrl() === '/now_playing') {
poped = $scope.window_url_stack.pop();
}
$scope.window_poped_url_stack.push(poped.url);
Expand All @@ -289,9 +287,7 @@ const main = () => {
};

$scope.toggleNowPlaying = () => {
if (
($scope.window_url_stack.slice(-1)[0] || {}).url === '/now_playing'
) {
if ($scope.getCurrentUrl() === '/now_playing') {
$scope.popWindow();
return;
}
Expand Down Expand Up @@ -322,19 +318,20 @@ const main = () => {
refreshWindow(url);
};

$scope.getCurrentUrl = () =>
($scope.window_url_stack.slice(-1)[0] || {}).url;

$scope.showPlaylist = (list_id, useCache) => {
const url = `/playlist?list_id=${list_id}`;
// save current scrolltop
const offset = document.getElementsByClassName('browser')[0].scrollTop;
if (($scope.window_url_stack.slice(-1)[0] || {}).url === url) {
if ($scope.getCurrentUrl() === url) {
return;
}
$scope.is_window_hidden = 0;
$scope.resetWindow();

if (
($scope.window_url_stack.slice(-1)[0] || {}).url === '/now_playing'
) {
if ($scope.getCurrentUrl() === '/now_playing') {
// if now playing is top, pop it
$scope.window_url_stack.pop();
}
Expand Down
4 changes: 2 additions & 2 deletions listen1.html
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@ <h2>{{ backup.id }} {{backup.description}}</h2>
<ul class="nav masthead-nav">
<li
ng-repeat="i in myplaylists track by $index"
ng-class="{ 'active':window_type=='list' && (('/playlist?list_id='+i.info.id)==window_url_stack.slice(-1)[0]) }"
ng-class="{ 'active':window_type=='list' && ( ('/playlist?list_id='+i.info.id) === getCurrentUrl() ) }"
ng-click="showPlaylist(i.info.id)"
>
<svg class="feather"><use href="#disc"></use></svg>
Expand All @@ -1781,7 +1781,7 @@ <h2>{{ backup.id }} {{backup.description}}</h2>
<ul class="nav masthead-nav">
<li
ng-repeat="i in favoriteplaylists track by $index"
ng-class="{ 'active':window_type=='list' && (('/playlist?list_id='+i.info.id)==window_url_stack.slice(-1)[0]) }"
ng-class="{ 'active':window_type=='list' && ( ('/playlist?list_id='+i.info.id) === getCurrentUrl() ) }"
ng-click="showPlaylist(i.info.id, {useCache: false})"
>
<svg class="feather"><use href="#disc"></use></svg>
Expand Down

0 comments on commit 14e1fbb

Please sign in to comment.