diff --git a/AUTHORS.md b/AUTHORS.md index b1a4f753..adace4f2 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -12,3 +12,4 @@ Contributors - [Lukas Kolletzki](https://github.com/kolletzki) - [Mahmoud Hossam](https://github.com/mahmoudhossam) - [Terin Stock](https://github.com/terinjokes) +- [Rasmus Thomsen](https://github.com/Cogitri) diff --git a/plugins/soundcloud/integration.js b/plugins/soundcloud/integration.js index 45b2d6fe..b6be3b6a 100644 --- a/plugins/soundcloud/integration.js +++ b/plugins/soundcloud/integration.js @@ -42,7 +42,7 @@ function update() { "canSeek": false, "canGoNext": true, "canGoPrevious": true, - "canAddToFavorites": false, + "canAddToFavorites": true, "volume": 1, "duration": readTime('playbackTimeline__duration'), "position": readTime('playbackTimeline__timePassed'), @@ -51,7 +51,7 @@ function update() { "artistName": '', "albumTitle": '', "artUrl": artUrl, - "isFavorite": false + "isFavorite": isFavorite() } } @@ -78,6 +78,13 @@ function readTime(elementClassName) { return hours * 3600 + minutes * 60 + seconds; } +function isFavorite() { + if (document.getElementsByClassName('playbackSoundBadge__like')[0].title === "Unlike") + return true; + else + return false; +} + function clickButton(buttonName) { document.getElementsByClassName(buttonName)[0].click() } @@ -98,18 +105,18 @@ function goPrevious() { clickButton('skipControl__previous'); } -function setVolume(volume) { - // not supported -} - function addToFavorites() { - // not supported + clickButton('playbackSoundBadge__like'); } function removeFromFavorites() { + addToFavorites(); +} + +function setVolume(volume) { // not supported } function seekToPosition(position) { // not supported -} \ No newline at end of file +}