Last active
April 19, 2021 06:52
-
-
Save mateuszdw/0302b0b78045441267ea3847b0a6df57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getArtistName(currentTabId, callback) { | |
chrome.tabs.executeScript( | |
currentTabId, | |
{ code: `document.querySelector('.now-playing span a[href^="/artist/"]').innerText` }, | |
callback | |
); | |
} | |
getSongName(currentTabId, callback) { | |
chrome.tabs.executeScript( | |
currentTabId, | |
{ code: `document.querySelector('.now-playing span a[href^="/album/"]').innerText` }, | |
callback | |
); | |
} | |
clickNext(currentTabId, callback) { | |
let query = '#main .Root__now-playing-bar .now-playing-bar__center .player-controls__buttons button.spoticon-skip-forward-16'; | |
chrome.tabs.executeScript( | |
currentTabId, | |
{ code: `document.querySelector('${query}').click()` }, | |
callback | |
); | |
} | |
clickPrev(currentTabId, callback) { | |
let query = '#main .Root__now-playing-bar .now-playing-bar__center .player-controls__buttons button.spoticon-skip-back-16'; | |
chrome.tabs.executeScript( | |
currentTabId, | |
{ code: `document.querySelector('${query}').click()` }, | |
callback | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment