Ultimate Guitar Download Button To Link

By JoeSimmons Last update Mar 18, 2011 — Installed 412 times.

There are 7 previous versions of this script.

// ==UserScript==
// @name           Ultimate Guitar Download Button To Link
// @namespace      http://userscripts.org/users/23652
// @description    Turns download buttons into links
// @include        http://*.ultimate-guitar.com/tabs/*/*_guitar_pro.htm*
// @include        http://*.ultimate-guitar.com/tabs/*/*_power_tab.htm*
// @include        http://tabs.ultimate-guitar.com/*/*/*_guitar_pro*
// @include        http://tabs.ultimate-guitar.com/*/*/*_power_tab*
// @copyright      JoeSimmons
// @version        1.0.103
// @license        Creative Commons Attribution-Noncommercial 3.0 United States License
// ==/UserScript==

var sub = document.evaluate(".//button[contains(., 'Download') and contains(.,'Tab')]", document.body, null, 9, null).singleNodeValue,
	f = document.evaluate(".//form[contains(@action, '/tab_download')]", document.body, null, 9, null).singleNodeValue,
	id = document.evaluate(".//input[@name='tab_id' and @value]", f, null, 9, null).singleNodeValue,
	a = document.createElement("a");

if(!sub || !f || !id) return;

a.setAttribute('href', f.action + "?tab_id=" + id.value);
a.textContent = sub.textContent;
a.setAttribute('class', 'gray verd bunl');
sub.parentNode.replaceChild(a, sub);