I am working on my first extension for Google Chrome. I want to click the "Thumbs Up" button on the Google Music blog page using my extension. For some reason, the thumb button seems a lot more complicated than shuffling, repeating, playing, next and previous. For all of them, the following code works:
chrome.tabs.executeScript(tab_id,
{
code: "location.assign('javascript:SJBpost(\"" + command +
"\");void 0');",
allFrames: true
});
where command = "playPause", "nextSong", "prevSong", "toggleShuffle", "togglePlay", etc.
I decided that many of them use developer tools to monitor the stack trace and see the arguments provided by SJBpost. Trying SJBpost with thumbsUp returns an error.
Obviously, this issue will be limited to a small audience, since not everyone can view the source of Google Music, but if you can help me, I would really appreciate it.
The thumbs div on the Google Music page is as follows:
<div id="thumbsUpPlayer" class="thumbsUp" title="Thumbs up"></div>
Now I tried to do this using jQuery:
$("#thumbsUpPlayer").click()
But I get a TypeError, undefined_method message in the javascript console.
Any help would be greatly appreciated. I am a huge newbie to javascript and plugins, and all this, and I am very glad that you have combined these last parts of the extension.
Thank!