-
Notifications
You must be signed in to change notification settings - Fork 264
Conversation
This add’s the **“I'm Feeling Lucky”** to the Mini player in Radiant Player requested enhancement from radiant-player#560 So let’s roll the **dice** :D **Images:** ![image](https://cloud.githubusercontent.com/assets/2947494/17381347/130 b1fc2-5991-11e6-8b6f-92052513a235.png) ![image](https://cloud.githubusercontent.com/assets/2947494/17381357/1f5 33828-5991-11e6-9144-e98b902cd5cc.png) ![image](https://cloud.githubusercontent.com/assets/2947494/17381382/30a b1bf4-5991-11e6-93e9-0afa868fd035.png) **Download: (For testing)** https://www.dropbox.com/s/lyfbui1cxtzanhp/Radiant%20Player%20I%27m%20Fee ling%20Lucky.zip?dl=0
Radiant.Lucky(); | ||
}, | ||
Lucky: function() { | ||
var lucky = Radiant.create('<div class="material-card material-shadow-z1" data-size="small" data-type="imfl" data-id="" data-log-position="0"><div class="image-wrapper"><div class="image-inner-wrapper"><img class="image" src="https://play-music.gstatic.com/fe/75c74ef2930c12f49710ccf42c5fb3bb/ifl_card_art.png" alt="" draggable="false"></div></div><div class="details"><div class="details-inner"><a class="title tooltip fade-out" href="">I\'m feeling lucky radio</a><div class="sub-title tooltip fade-out">Based on your music taste</div></div></div></div>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks kinda brittle, e.g. when Google updates their markup this will likely break (especially the sprite image). Is it possible to add the lucky button to the miniplayer only as a first pass without adding it to the main player? (since there's already a button for it in GPM)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well i had a look at the way the button works and the data-type="imfl" is what triggers it (with .material-card) so i removed all the unneeded code (40fad67). The reason why i did it this way is because i couldn't find any other event and this "tricks" the dom thinking that the
is global than on the Listen Now page to init a click();. I also looked at the mini player app and since it's a Polymer instance would have to figure that part out.
As to adding it without the main player, I would like to try to if am pointed in the right direction still adapting / learning.
Removed unwanted things and keeping the data-type as the trigger
I spent some time seeing if it's possible to trigger a custom event without the injected div and attempt to locate whatever internal callback gets fired, but no luck. It's likely possible with the profiler (start the JS CPU profiler, click the lucky button, stop the profiler, look in the flamegraph for the callback names). However it looks like all the callback names have been minified / uglifified so that's not any less brittle. tl;dr - what you have now is likely the best way to do it. This might be a good candidate for inclusion in @gmusic-utils/gmusic.js. |
I was summoned here @jacobwgillespie I dived into this before and there is a function somewhere on If you ever want to waste a few hours, try searching through that object, it's a recursive hell hole but there is some useful stuff in there 😆 |
@jacobwgillespie yeah that's what i was trying to do haha, but Google and their ways with the uglified stuff so yeah i suppose what i have works would be good to see it in gmusic.js, the shorter the better @MarshallOfSound well that's good to know i may take a look |
Since adding the IFL button, toggling the mini player has two views (w/ and w/o album art in the background) short view overlapped the dice.
Fixes the Lucky Button, dices’ position as from left and right of the view was clickable, this ensures only the dice is. (SORRY about that)
@BarakaAka1Only is this ready? I think it looks good to me, just wanted to make sure you were done on your end |
Yes it's ready @jacobwgillespie 👍 |
Nice, merging! 🎉 |
This will release under 1.10.0, which should go out in the next hour or so. |
Awesome :D |
This add’s the “I'm Feeling Lucky” to the Mini player in Radiant
Player
requested enhancement from
#560
So let’s roll the dice :D
Images:
Download: (For testing)
https://www.dropbox.com/s/n9hqgob4p1lq1ar/Radiant%20Player%20I%27m%20Feeling%20Lucky.zip?dl=0