Pandora tab search

adds 2 buttons that search for the current song title and artist on UT or Google

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Pandora tab search
// @namespace   http://ramrawrdinosaur.zapto.org/pandoratab
// @description adds 2 buttons that search for the current song title and artist on UT or Google
// @include     http://www.pandora.com/*
// @version     1.1
// @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 ug = 'http://www.ultimate-guitar.com/search.php?search_type=title&value='; //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', 'tab_refresh()');
ugtab.setAttribute('target', '_blank')
ugtab.innerHTML = '<div class=\'text\'>UG TAB</div>';
btns.appendChild(ugtab);
var googletab = document.createElement('div'); //create div button using pandora css
googletab.setAttribute('class', 'button btn_bg ');
googletab.setAttribute('name', 'tab_get_btn');
googletab.setAttribute('onclick', 'gtab_refresh()');
googletab.setAttribute('target', '_blank')
googletab.innerHTML = '<div class=\'text\'>G TAB</div>';
btns.appendChild(googletab);
window.tab_refresh = function () {
  var title = document.getElementsByClassName('songTitle') [0].text;
  var artist = document.getElementsByClassName('artistSummary')[0].text
  window.open(ug + title + " " + artist);
}
window.gtab_refresh = function () {
  var title = document.getElementsByClassName('songTitle') [0].text;
  var artist = document.getElementsByClassName('artistSummary')[0].text
  window.open(g + title + " " + artist + " tab");
}
//function refreshes title and navs to UG search