mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2025-08-23 21:15:00 +02:00
added functionality to favorite a song. fixes #323
This commit is contained in:
@@ -54,6 +54,7 @@ const elements = {
|
||||
album_name_cell: '[class^="album"]',
|
||||
tracklist_row: '[data-test="tracklist-row"]',
|
||||
volume: '*[data-test="volume"]',
|
||||
favorite: '*[data-test="footer-favorite-button"]',
|
||||
/**
|
||||
* Get an element from the dom
|
||||
* @param {*} key key in elements object to fetch
|
||||
@@ -131,6 +132,10 @@ const elements = {
|
||||
return this.get("volume").getAttribute("aria-checked") === "false"; // it's muted if aria-checked is false
|
||||
},
|
||||
|
||||
isFavorite: function () {
|
||||
return this.get("favorite").getAttribute("aria-checked") === "true";
|
||||
},
|
||||
|
||||
/**
|
||||
* Shorthand function to get the text of a dom element
|
||||
* @param {*} key key in elements object to fetch
|
||||
@@ -208,6 +213,10 @@ function addHotKeys() {
|
||||
handleLogout();
|
||||
});
|
||||
|
||||
addHotkey("Control+a", function () {
|
||||
elements.click("favorite");
|
||||
});
|
||||
|
||||
addHotkey("Control+h", function () {
|
||||
elements.click("home");
|
||||
});
|
||||
@@ -306,6 +315,9 @@ function addIPCEventListeners() {
|
||||
case globalEvents.pause:
|
||||
elements.click("pause");
|
||||
break;
|
||||
case globalEvents.toggleFavorite:
|
||||
elements.click("favorite");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -516,6 +528,7 @@ setInterval(function () {
|
||||
"app-name": appName,
|
||||
image: "",
|
||||
icon: "",
|
||||
favorite: elements.isFavorite(),
|
||||
};
|
||||
|
||||
const titleOrArtistsChanged = currentSong !== songDashArtistTitle;
|
||||
|
Reference in New Issue
Block a user