Closed PeterMinin closed 9 years ago
You should just be able to update the 'supports' object of the controller, and it should be reflected in the popup. It probably wont live update, but if you close and open the popup it should be fine. Is this not the case?
Thank you, it works, although I couldn't find a better place to do it than an overridden isPlaying
:
controller.defaultIsPlaying = controller.isPlaying
controller.override('isPlaying', function() {
this.supports.thumbsDown = window.getComputedStyle(document.querySelector(this.thumbsDownSelector)).display != 'none'
return this.defaultIsPlaying()
});
It even live updates, but is there a more appropriate place?
You can add a dom listener for the change they makes you switch modes but what you did is probably more performing. Also when you override a function the default implementation is passed in as the first argument. See GoogleMusicController On Thu, Oct 29, 2015 at 8:30 AM PeterMinin notifications@github.com wrote:
Thank you, it works, although I couldn't find a better place to do it than an overridden isPlaying:
controller.defaultIsPlaying = controller.isPlaying controller.override('isPlaying', function() { this.supports.thumbsDown = window.getComputedStyle(document.querySelector(this.thumbsDownSelector)).display != 'none' return this.defaultIsPlaying() });
It even live updates, but is there a more appropriate place?
— Reply to this email directly or view it on GitHub https://github.com/msfeldstein/chrome-media-keys/issues/78#issuecomment-152215552 .
Oh, thanks, I don't have much JS experience. Then I guess I'll leave it here for performance sake.
This may already be implemented, but I haven't found this feature. Is there a way for a controller to determine the availability of buttons like, for example, "thumbs down" dynamically, using a custom function? One service (namely Yandex.Music) has 2 playing modes, one of which has a dislike button, while the other doesn't.