|
@@ -6,6 +6,7 @@ document.addEventListener("alpine:init", () => {
|
|
|
// - "play/resume playlist" button (pick up where you left off)
|
|
// - "play/resume playlist" button (pick up where you left off)
|
|
|
// - track timestamp to truly resume where you left off
|
|
// - track timestamp to truly resume where you left off
|
|
|
// - periodically remove watched videos
|
|
// - periodically remove watched videos
|
|
|
|
|
+ // - consider separating context menu items (rather than having a sub-menu)
|
|
|
Alpine.data("playlistManager", () => ({
|
|
Alpine.data("playlistManager", () => ({
|
|
|
playlists: {},
|
|
playlists: {},
|
|
|
|
|
|
|
@@ -36,15 +37,17 @@ document.addEventListener("alpine:init", () => {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
async removeVideo(playlistName, index) {
|
|
async removeVideo(playlistName, index) {
|
|
|
|
|
+ const playlists = JSON.parse(JSON.stringify(this.playlists));
|
|
|
|
|
+
|
|
|
// Make a copy of the current playlist
|
|
// Make a copy of the current playlist
|
|
|
- const playlist = [...this.playlists[playlistName]];
|
|
|
|
|
|
|
+ const playlist = [...playlists[playlistName]];
|
|
|
|
|
|
|
|
// Remove the video at the specified index
|
|
// Remove the video at the specified index
|
|
|
playlist.splice(index, 1);
|
|
playlist.splice(index, 1);
|
|
|
|
|
|
|
|
// Create an updated playlists object with the remaining playlists unchanged
|
|
// Create an updated playlists object with the remaining playlists unchanged
|
|
|
const updatedPlaylists = {
|
|
const updatedPlaylists = {
|
|
|
- ...this.playlists,
|
|
|
|
|
|
|
+ ...playlists,
|
|
|
[playlistName]: playlist,
|
|
[playlistName]: playlist,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -59,23 +62,22 @@ document.addEventListener("alpine:init", () => {
|
|
|
|
|
|
|
|
videotitle: {
|
|
videotitle: {
|
|
|
["@click"]() {
|
|
["@click"]() {
|
|
|
- console.log('TITLE CLICK', this.$el);
|
|
|
|
|
|
|
+ console.log("TITLE CLICK", this.$el);
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
videoPlayLink: {
|
|
videoPlayLink: {
|
|
|
- ["@click.prevent"](evt) {
|
|
|
|
|
- if (evt.target && evt.target.href) {
|
|
|
|
|
- browser.tabs.update({ url: evt.target.href });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ["@click.prevent"]() {
|
|
|
|
|
+ browser.tabs.update({ url: this.$el.href });
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
removeVideoButton: {
|
|
removeVideoButton: {
|
|
|
- ["@click"](evt) {
|
|
|
|
|
- if (evt.target && evt.target.attributes.playlistName && evt.target.attributes.playlistIndex) {
|
|
|
|
|
- this.removeVideo(evt.target.attributes.playlistName.value, evt.target.attributes.playlistIndex.value);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ["@click"]() {
|
|
|
|
|
+ this.removeVideo(
|
|
|
|
|
+ this.$el.dataset.playlistName,
|
|
|
|
|
+ this.$el.dataset.playlistIndex,
|
|
|
|
|
+ );
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
}));
|
|
}));
|