diff --git a/src/app/dialogs/modify-playlist/modify-playlist.component.html b/src/app/dialogs/modify-playlist/modify-playlist.component.html
index d35db91..69f4cad 100644
--- a/src/app/dialogs/modify-playlist/modify-playlist.component.html
+++ b/src/app/dialogs/modify-playlist/modify-playlist.component.html
@@ -8,14 +8,24 @@
+
+
+ Normal order
+ Reverse order
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
+
diff --git a/src/app/dialogs/modify-playlist/modify-playlist.component.scss b/src/app/dialogs/modify-playlist/modify-playlist.component.scss
index 84d3c54..0be9a78 100644
--- a/src/app/dialogs/modify-playlist/modify-playlist.component.scss
+++ b/src/app/dialogs/modify-playlist/modify-playlist.component.scss
@@ -30,11 +30,6 @@ border: none;
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
}
-.add-content-button {
-margin-top: 15px;
-margin-bottom: 10px;
-}
-
.remove-item-button {
right: 10px;
position: absolute;
diff --git a/src/app/dialogs/modify-playlist/modify-playlist.component.ts b/src/app/dialogs/modify-playlist/modify-playlist.component.ts
index 18db662..414fc92 100644
--- a/src/app/dialogs/modify-playlist/modify-playlist.component.ts
+++ b/src/app/dialogs/modify-playlist/modify-playlist.component.ts
@@ -15,6 +15,7 @@ export class ModifyPlaylistComponent implements OnInit {
available_files = [];
all_files = [];
playlist_updated = false;
+ reverse_order = false;
constructor(@Inject(MAT_DIALOG_DATA) public data: any,
private postsService: PostsService,
@@ -26,6 +27,8 @@ export class ModifyPlaylistComponent implements OnInit {
this.original_playlist = JSON.parse(JSON.stringify(this.data.playlist));
this.getFiles();
}
+
+ this.reverse_order = localStorage.getItem('default_playlist_order_reversed') === 'true';
}
getFiles() {
@@ -72,11 +75,23 @@ export class ModifyPlaylistComponent implements OnInit {
}
removeContent(index) {
+ if (this.reverse_order) {
+ index = this.playlist.fileNames.length - 1 - index;
+ }
this.playlist.fileNames.splice(index, 1);
this.processFiles();
}
+ togglePlaylistOrder() {
+ this.reverse_order = !this.reverse_order;
+ localStorage.setItem('default_playlist_order_reversed', '' + this.reverse_order);
+ }
+
drop(event: CdkDragDrop) {
+ if (this.reverse_order) {
+ event.previousIndex = this.playlist.fileNames.length - 1 - event.previousIndex;
+ event.currentIndex = this.playlist.fileNames.length - 1 - event.currentIndex;
+ }
moveItemInArray(this.playlist.fileNames, event.previousIndex, event.currentIndex);
}