Last active
December 22, 2021 16:10
-
-
Save oxchronxo/920b078334d6e9c8c3f4aeb5ad3e4279 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
// ==UserScript== | |
// @name Pandora tabs | |
// @namespace http://fehrenbacher.com | |
// @description adds buttons that search for the current song title and artist on YouTube or Google | |
// @downloadUrl https://gist.github.com/oxchronxo/920b078334d6e9c8c3f4aeb5ad3e4279/raw/bec32ed408c5e259ba83f1db97d8094a9e1eef50/pandora-tab.user.js | |
// @include http*://*.pandora.com/* | |
// @version 1.3 | |
// @grant none | |
// ==/UserScript== | |
var title = document.getElementsByClassName('songTitle') [0].text; //get the song title | |
var artist = document.getElementsByClassName('artistSummary')[0].text // get the artist name | |
var url_youtube = 'https://www.youtube.com/results?search_query='; //used for url generator | |
var g = 'http://google.com/#q='; //used for url generator | |
var btns = document.getElementsByClassName('buttons') [1]; //insert into the 2nd buttons section, under the album art | |
var ugtab = document.createElement('div'); //create div button using pandora css | |
ugtab.setAttribute('class', 'button btn_bg '); | |
ugtab.setAttribute('name', 'tab_get_btn'); | |
ugtab.setAttribute('onclick', 'site_youtube()'); | |
ugtab.setAttribute('target', '_blank') | |
ugtab.innerHTML = '<div class=\'text\'>YouTube</div>'; | |
btns.appendChild(ugtab); | |
window.site_youtube = function () { | |
var title = document.getElementsByClassName('songTitle') [0].text; | |
var artist = document.getElementsByClassName('artistSummary')[0].text | |
window.open(url_youtube + title + " " + artist); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment