HowrseSireDamLinks

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.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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://*.howrse.com/elevage/fiche/?id=*
// @include     http://*.howrse.com/elevage/chevaux/cheval?id=*
// @author      daexion
// @version     11
// ==/UserScript==

if(document.body.textContent.indexOf("is now in Heaven") < 0 && document.body.textContent.indexOf("moved to the Safe Haven") < 0)
{
	origins = document.getElementById("origins-body-content");
	
	parents = origins.getElementsByClassName('horsename');
	container = document.getElementById("affix-body-content");
	familyDiv = document.createElement("div");
	indCC = document.URL.indexOf(".");

	if(parents.length == 2)
	{
		sireDiv = document.createElement("div");
		sire = document.createElement("a");
		damDiv = document.createElement("div");
		dam = document.createElement("a");
		staticLinkHalf =document.URL.substring(0,indCC)+".howrse.com/elevage/chevaux/cheval?id";
		
		sire.setAttribute("href",staticLinkHalf+parents[0].href.substring(parents[0].href.indexOf("="),parents[0].href.length));
		dam.setAttribute("href",staticLinkHalf+parents[1].href.substring(parents[1].href.indexOf("="),parents[1].href.length));
		
		sire.appendChild(document.createTextNode("(S) " + parents[0].text));
		sireDiv.appendChild(sire);
		dam.appendChild(document.createTextNode("(M) " + parents[1].text));
		damDiv.appendChild(dam);
		
		familyDiv.appendChild(sireDiv);
		familyDiv.appendChild(damDiv);
	}
	else if(parents.length == 1)
	{
		unknDiv = document.createElement("div");
		unkn = document.createElement("a");
		staticLinkHalf =document.URL.substring(0,indCC)+".howrse.com/elevage/chevaux/cheval?id";

		unkn.setAttribute("href",staticLinkHalf+parents[0].href.substring(parents[0].href.indexOf("="),parents[0].href.length));
		if(document.body.textContent.indexOf("Sire: Disappeared horse") > 0)
		{
			unkn.appendChild(document.createTextNode("(M) " +parents[0].text));
		}
		else unkn.appendChild(document.createTextNode("(S) " +parents[0].text));
		unknDiv.appendChild(unkn);
		familyDiv.appendChild(unknDiv);
	}
	else if(document.body.textContent.indexOf("Ouranos") > 0 && document.body.textContent.indexOf("Breed: Divine") < 0)
	{
		familyDiv.appendChild(document.createTextNode("Foundie"));
	}

	if(document.URL.indexOf("chevaux/cheval") > 0)
	{
		scipts = document.getElementsByTagName("script");
		i=0;
		while(scipts[i].text.indexOf("chevalId") < 0 && i < scipts.length) ++i;
		horseVars = scipts[i].text;
		firstEqual = horseVars.indexOf("=");
		firstSemi = horseVars.indexOf(";");
		chevalId = horseVars.substring(firstEqual+2,firstSemi);
		linkDiv = document.createElement("div");
		horseLink = document.createElement("a");
		horseLink.setAttribute("href",document.URL.substring(0,indCC)+".howrse.com/elevage/fiche/?id="+chevalId);
		horseLink.appendChild(document.createTextNode("Public URL"));
		linkDiv.appendChild(horseLink);
		familyDiv.appendChild(linkDiv);
		horseName = document.getElementsByClassName("horse-name");
		newInputbox = document.createElement("input");
		newInputbox.setAttribute("value","[url=" + horseLink + "]" + horseName[0].textContent + "[/url]");
		newInputbox.setAttribute("onclick","this.select()");
		newInputbox.setAttribute("readonly","readonly");
		familyDiv.appendChild(newInputbox);
	}
	else
	{
		//determines if you own the horse
		lastMenu = document.getElementsByClassName("menu-sub-item last last-profil");
		menuList = lastMenu[0].getElementsByTagName("a");
		myPageLink = menuList[3].getAttribute("href");
		usergroup2 = document.getElementsByClassName("usergroup_2");
		horseOwner = usergroup2[0].getAttribute("href").substring(usergroup2[0].getAttribute("href").length-myPageLink.length,usergroup2[0].getAttribute("href").length);
		if(horseOwner == myPageLink)
		{
			chevalId = document.URL.substring(document.URL.indexOf("=")+1,document.URL.length);
			linkDiv = document.createElement("div");
			horseLink = document.createElement("a");
			horseLink.setAttribute("href",document.URL.substring(0,indCC)+".howrse.com/elevage/chevaux/cheval?id="+chevalId);
			horseLink.appendChild(document.createTextNode("Private URL"));
			linkDiv.appendChild(horseLink);
			familyDiv.appendChild(linkDiv);
		}
		horseName = document.getElementsByClassName("horse-name");
		newInputbox = document.createElement("input");
		newInputbox.setAttribute("value","[url=" + document.URL + "]" + horseName[0].textContent + "[/url]");
		newInputbox.setAttribute("onclick","this.select()");
		newInputbox.setAttribute("readonly","readonly");
		familyDiv.appendChild(newInputbox);
	}
	container.appendChild(familyDiv);
}