Adds links to the sire and dam of the horse you are looking at that go to the page you can see, if you own that horse. Howrse will redirect it to the public page if you don't.
目前為
// ==UserScript==
// @name HowrseSireDamLinks
// @namespace myHowrse
// @description Adds links to the sire and dam of the horse you are looking at that go to the page you can see, if you own that horse. Howrse will redirect it to the public page if you don't.
// @include http://www.howrse.com/elevage/fiche/?id=*
// @include http://www.howrse.com/elevage/chevaux/cheval?id=*
// @author daexion
// @version 3
// ==/UserScript==
parents = document.getElementsByClassName('horsename');
container = document.getElementById("affix-body-content");
familyDiv = document.createElement("div");
sire = document.createElement("a");
dam = document.createElement("a");
staticLinkHalf ="http://www.howrse.com/elevage/chevaux/cheval?id=";
GM_log(staticLinkHalf+parents[0].href.substring(40,parents[0].href.length));
GM_log(staticLinkHalf+parents[1].href.substring(40,parents[1].href.length));
sire.setAttribute("href",staticLinkHalf+parents[0].href.substring(40,parents[0].href.length));
dam.setAttribute("href",staticLinkHalf+parents[1].href.substring(40,parents[1].href.length));
sire.appendChild(document.createTextNode("Sire"));
dam.appendChild(document.createTextNode("Dam"));
familyDiv.appendChild(sire);
familyDiv.appendChild(document.createTextNode(" || "));
familyDiv.appendChild(dam);
if(document.URL.indexOf("=") > 40)
{
horsePublic = document.createElement("a");
horsePublic.setAttribute("href","http://www.howrse.com/elevage/fiche/?id="+document.URL.substring(48,document.URL.length));
horsePublic.appendChild(document.createTextNode("Public URL"));
familyDiv.appendChild(document.createTextNode(" || "));
familyDiv.appendChild(horsePublic);
}
container.appendChild(familyDiv);