Domanda

I currently have an app built that runs a server to control Google play music (github project). And I have managed to use a 'content script' that runs inside a chrome extension on play.google.com/music/ to fetch all the data. It can play / pause, go next and previous, all by simulating jquery events.

My problem now is that I can't get it to trigger a click on the <tr> element that each song resides in. Here is an example of the html of a song:|

<tr class="song-row selected-song-row currently-playing" data-id="Tfkolhfrnmy62cofhayfsnaairy">
Music Info Here in td's
</tr>

However if I run a jquery event to click, or double click, or hover and click, none of them start playing the song, here are some examples:

// click an element
$("[data-id='Tfkolhfrnmy62cofhayfsnaairy']").click();
// double click an element
$("[data-id='Tfkolhfrnmy62cofhayfsnaairy']").dblclick();
// dblclick all child elements
$("[data-id='Tfkolhfrnmy62cofhayfsnaairy']").find("*").dblclick();

To inject jquery into Google Play Music I am using an extension called jquerify (my actual content script has jQuery but that is in an 'isolated world' as Google calls them. So to use jquery in the console you need to inject it.

Anyone know the answer of how to start playing a song by triggering jquery events?

È stato utile?

Soluzione

You gotta add a <div class="hover-button" data-id="play"></div> inside the first span in the row, and then click that div with .click(). Remember to remove the div after "use" :)

edit: confirmed, it works :)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top