applied new context menu to more items
This commit is contained in:
parent
5e19de0d83
commit
c20d839a2e
3 changed files with 61 additions and 47 deletions
|
@ -301,6 +301,48 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
normal: {
|
normal: {
|
||||||
|
headerItems: [
|
||||||
|
{
|
||||||
|
"icon": "./assets/feather/heart.svg",
|
||||||
|
"id": "love",
|
||||||
|
"name": "Love",
|
||||||
|
"hidden": false,
|
||||||
|
"disabled": true,
|
||||||
|
"action": function () {
|
||||||
|
app.love(self.item)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon": "./assets/feather/heart.svg",
|
||||||
|
"id": "unlove",
|
||||||
|
"active": true,
|
||||||
|
"name": "Unlove",
|
||||||
|
"hidden": true,
|
||||||
|
"action": function () {
|
||||||
|
app.unlove(self.item)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon": "./assets/feather/thumbs-down.svg",
|
||||||
|
"id": "dislike",
|
||||||
|
"name": "Dislike",
|
||||||
|
"hidden": false,
|
||||||
|
"disabled": true,
|
||||||
|
"action": function () {
|
||||||
|
app.dislike(self.item)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon": "./assets/feather/thumbs-down.svg",
|
||||||
|
"id": "undo_dislike",
|
||||||
|
"name": "Undo dislike",
|
||||||
|
"active": true,
|
||||||
|
"hidden": true,
|
||||||
|
"action": function () {
|
||||||
|
app.unlove(self.item)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
"icon": "./assets/feather/list.svg",
|
"icon": "./assets/feather/list.svg",
|
||||||
|
@ -344,42 +386,6 @@
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"icon": "./assets/feather/heart.svg",
|
|
||||||
"id": "love",
|
|
||||||
"name": "Love",
|
|
||||||
"disabled": true,
|
|
||||||
"action": function () {
|
|
||||||
app.love(self.item)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon": "./assets/feather/unheart.svg",
|
|
||||||
"id": "unlove",
|
|
||||||
"name": "Unlove",
|
|
||||||
"disabled": true,
|
|
||||||
"action": function () {
|
|
||||||
app.unlove(self.item)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon": "./assets/feather/thumbs-down.svg",
|
|
||||||
"id": "dislike",
|
|
||||||
"name": "Dislike",
|
|
||||||
"disabled": true,
|
|
||||||
"action": function () {
|
|
||||||
app.dislike(self.item)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon": "./assets/feather/x-circle.svg",
|
|
||||||
"id": "undo_dislike",
|
|
||||||
"name": "Undo dislike",
|
|
||||||
"disabled": true,
|
|
||||||
"action": function () {
|
|
||||||
app.unlove(self.item)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"icon": "./assets/feather/share.svg",
|
"icon": "./assets/feather/share.svg",
|
||||||
"name": "Share",
|
"name": "Share",
|
||||||
|
@ -396,14 +402,22 @@
|
||||||
return item.id != "addToPlaylist"
|
return item.id != "addToPlaylist"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
app.showMenuPanel(menus[useMenu], event)
|
||||||
|
|
||||||
|
try{
|
||||||
let rating = await app.getRating(self.item)
|
let rating = await app.getRating(self.item)
|
||||||
if (rating == 0) {
|
if (rating == 0) {
|
||||||
menus.normal.items.find(x => x.id == 'love').disabled = false
|
menus.normal.headerItems.find(x => x.id == 'love').disabled = false
|
||||||
menus.normal.items.find(x => x.id == 'dislike').disabled = false
|
menus.normal.headerItems.find(x => x.id == 'dislike').disabled = false
|
||||||
} else if (rating == 1) {
|
} else if (rating == 1) {
|
||||||
menus.normal.items.find(x => x.id == 'unlove').disabled = false
|
menus.normal.headerItems.find(x => x.id == 'unlove').hidden = false
|
||||||
|
menus.normal.headerItems.find(x => x.id == 'love').hidden = true
|
||||||
} else if (rating == -1) {
|
} else if (rating == -1) {
|
||||||
menus.normal.items.find(x => x.id == 'undo_dislike').disabled = false
|
menus.normal.headerItems.find(x => x.id == 'undo_dislike').hidden = false
|
||||||
|
menus.normal.headerItems.find(x => x.id == 'dislike').hidden = true
|
||||||
|
}
|
||||||
|
} catch(err) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.contextExt) {
|
if (this.contextExt) {
|
||||||
|
@ -414,7 +428,6 @@
|
||||||
menus.multiple.items = menus.multiple.items.concat(this.contextExt.multiple)
|
menus.multiple.items = menus.multiple.items.concat(this.contextExt.multiple)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CiderContextMenu.Create(event, menus[useMenu])
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
beforeDestroy: function () {
|
beforeDestroy: function () {
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CiderContextMenu.Create(event, menus[useMenu]);
|
app.showMenuPanel(menus[useMenu], event);
|
||||||
},
|
},
|
||||||
playQueueItem(index) {
|
playQueueItem(index) {
|
||||||
app.mk.changeToMediaAtIndex(index)
|
app.mk.changeToMediaAtIndex(index)
|
||||||
|
|
|
@ -134,6 +134,7 @@
|
||||||
"addToFavorites": {
|
"addToFavorites": {
|
||||||
name: "Add to favorites",
|
name: "Add to favorites",
|
||||||
disabled: true,
|
disabled: true,
|
||||||
|
hidden: true,
|
||||||
action: () => {
|
action: () => {
|
||||||
this.addFavorite(playlist_id, "library-playlists")
|
this.addFavorite(playlist_id, "library-playlists")
|
||||||
}
|
}
|
||||||
|
@ -143,7 +144,7 @@
|
||||||
if(this.item.type === "library-playlist-folders") {
|
if(this.item.type === "library-playlist-folders") {
|
||||||
menu.items.addToFavorites.disabled = true
|
menu.items.addToFavorites.disabled = true
|
||||||
}
|
}
|
||||||
CiderContextMenu.Create(event, menu)
|
app.showMenuPanel(menu, event)
|
||||||
},
|
},
|
||||||
dragOver(evt) {
|
dragOver(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue