MediaWiki:BreedingResultsLinker.js

$(document).ready(function {       if (skin == "oasis")   {                  eval(document.getElementById("breedingresultslinkerdata").innerHTML);  	setMenuOptions;   }        });

function setMenuOptions {	var menu1 = document.getElementById("breeddragons_dragon1choices"); var menu2 = document.getElementById("breeddragons_dragon2choices"); for (var i = 0; i < dragon_ids.length; i++) {		var dragonName = dragon_data[dragon_ids[i].toLowerCase].name; var newOption1 = document.createElement("option"); newOption1.text = dragonName; menu1.add(newOption1); var newOption2 = document.createElement("option"); newOption2.text = dragonName; menu2.add(newOption2); }	$('form#breeddragons').toggle; }

function linkButtonClicked {	linkToColorPool; }

function linkToColorPool {	var menu1 = document.getElementById("breeddragons_dragon1choices"); var menu2 = document.getElementById("breeddragons_dragon2choices"); var dragon1_colors = dragon_data[dragon_ids[menu1.selectedIndex]].colors; var dragon2_colors = dragon_data[dragon_ids[menu2.selectedIndex]].colors; var combined_colors = getSortedColors(getMergedList(dragon1_colors, dragon2_colors)); var key = ""; for (var i = 0; i < combined_colors.length; i++) {		key += (i == 0 ? "" : "+") + combined_colors[i].substring(0, 1).toUpperCase + combined_colors[i].substring(1, combined_colors[i].length).toLowerCase; }		   var bottomCoordinate = document.getElementById("jumplink_" + key).offsetTop; window.scroll(0, bottomCoordinate); }

function getMergedList(list1, list2) {		var data = ""; for (var i = 0; i < list1.length; i++) {		data += data == "" ? list1[i] : "_" + list1[i]; }

for (var i = 0; i < list2.length; i++) {		if (!(data.indexOf("_" + list2[i] + "_") > -1 || data.indexOf(list2[i]) > -1 && data.indexOf(list2[i]) == 0 || data.indexOf("_" + list2[i]) > -1 && data.indexOf("_" + list2[i]) + list2[i].length + 1 == data.length)) {			data += "_" + list2[i]; }			}	return data.split("_"); }

function getSortedColors(colors) {		var sorted_colors = new Array; for (var i = 0; i < color_list.length; i++) {		for (var j = 0; j < colors.length; j++) {									if (colors[j] == color_list[i]) {								sorted_colors.push(colors[j]); break; }		}	}			return sorted_colors; }