added share to some elements, does not work correctly for library songs yet

This commit is contained in:
booploops 2021-12-29 06:29:31 -08:00
parent 04956a5590
commit ee4a2e4751
4 changed files with 23 additions and 2 deletions

View file

@ -613,6 +613,9 @@ const app = new Vue({
self.refreshPlaylists()
})
},
copyToClipboard(str) {
navigator.clipboard.writeText(str)
},
newPlaylist(name = "New Playlist", tracks = []) {
let self = this
let request = {

View file

@ -276,6 +276,12 @@
app.searchAndNavigate(self.item, 'album')
}
},
{
"name": "Share",
"action": function () {
self.app.copyToClipboard(self.item.attributes.url)
}
}
]
}
}

View file

@ -215,6 +215,7 @@
}
},
{
"id": "addToPlaylist",
"name": "Add to Playlist...",
"action": function () {
app.promptAddToPlaylist()
@ -237,11 +238,20 @@
;
}
},
{
"name": "Share",
"action": function () {
self.app.copyToClipboard(self.item.attributes.url)
}
}
]
}
}
if ((self.item.attributes.playParams.kind ?? self.item.type).includes("playlist")) {
menus.normal.items.splice(2, 1);
// remove the add to playlist option by id "addToPlaylist" using the .filter() method
menus.normal.items = menus.normal.items.filter(function (item) {
return item.id != "addToPlaylist"
})
}
if (this.contextExt) {
if (this.contextExt.normal) {

View file

@ -169,7 +169,9 @@
followActions[followAction],
{
name: "Share",
action: ()=>{}
action: ()=>{
self.app.copyToClipboard(self.data.attributes.url)
}
}
]
})