There are 3 previous versions of this script.
// ==UserScript==
// @name Wowhead Tooltip Links
// @namespace Wowhead
// @include http://*.wowhead.com/item=*
// @include http://*.wowhead.com/npc=*
// @include http://*.wowhead.com/object=*
// @include http://*.wowhead.com/quest=*
// @include http://*.wowhead.com/spell=*
// @include http://*.wowhead.com/zone=*
// ==/UserScript==
function gup(name) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "\/"+name+"=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if(results == null) {
return "";
} else {
return results[1];
}
}
h1 = document.getElementsByTagName("h1")[1];
title = h1.innerHTML;
tagPattern = /<\/?[^>]+>/g;
title = title.replace(tagPattern, '');
title = title.replace(/"/g, '"')
suchtext = "";
icon = "";
if(gup("item")) {
for(i=0; i<document.getElementsByTagName("script").length; i++) {
suchtext = suchtext + document.getElementsByTagName("script")[i].innerHTML;
}
var Suche = /\('[a-z0-9]*'\).appendChild\(Icon.create\('(.*)',/;
var Ergebnis = Suche.exec(suchtext);
if(Ergebnis) icon = Ergebnis[1].toLowerCase();
id = gup("item");
box = document.getElementById("tt" + id);
b = box.getElementsByTagName("b");
quality = b[0].getAttribute("class");
link = '<a rel="external" href="' + window.location.href.replace(/"/g, '"') + '" class="' + quality + ' icontiny" style="padding-left: 18px; background: left center no-repeat; background-image: url(http://static.wowhead.com/images/wow/icons/tiny/' + icon + '.gif);">' + title + '</a>';
} else {
if(gup("npc") || gup("zone") || gup("object")) {
if(gup("npc")) {
id = gup("npc");
} else if(gup("zone")) {
id = gup("zone");
} else if(gup("object")) {
id = gup("object");
}
link = '<a rel="external" href="' + window.location.href.replace(/"/g, '"') + '">' + title + '</a>';
} else {
if(gup("quest")) {
questicon = "";
for(i=0; i<document.getElementsByTagName("script").length; i++) {
suchtext = suchtext + document.getElementsByTagName("script")[i].innerHTML;
}
var Suche = /tooltip_dailyquest/;
if(Suche.test(suchtext)) {
questicon = "_daily";
}
id = gup("quest");
link = '<a rel="external" href="' + window.location.href.replace(/"/g, '"') + '" class="quest icontiny" style="padding-left: 18px; background: left center no-repeat; background-image: url(http://static.wowhead.com/images/icons/tiny/quest_start' + questicon + '.gif);">' + title + '</a>';
} else if(gup("spell")) {
id = gup("spell");
link = '<a rel="external" href="' + window.location.href.replace(/"/g, '"') + '" class="quest">' + title + '</a>';
} else if(gup("achievement")) {
for(i=0; i<document.getElementsByTagName("script").length; i++) {
suchtext = suchtext + document.getElementsByTagName("script")[i].innerHTML;
}
var Suche = /\('[a-z0-9]*'\).appendChild\(Icon.create\('(.*)',/;
var Ergebnis = Suche.exec(suchtext);
if(Ergebnis) icon = Ergebnis[1].toLowerCase();
id = gup("achievement");
link = '<a rel="external" href="' + window.location.href.replace(/"/g, '"') + '" class="quest icontiny" style="padding-left: 18px; background: left center no-repeat; background-image: url(http://static.wowhead.com/images/icons/tiny/' + icon + '.gif);">' + title + '</a>';
}
}
}
h1.innerHTML = h1.innerHTML + ' <input type="text" value="' + link + '" onclick="this.select()" style="width: 400px;" />';