JSFiddle - React, Tailwind, and code Playground

by Gwyn Milcote

HTML

Saving dragon code.

JavaScript

//var path = "http://mythstable.epizy.com/dragon/";
var path = "";

// Object that stores an individial dragon's genes.
// Only as integers, from dropdowns and into database!
var dragon = {};


/*
* This is where ALL POSSIBLE ALLELES are stored.
* Used for referencing.
*/
var genome = {
	// Gold
	g: ["G+", "g", "g^s"],
	// Red
	r: ["R", "r+"],
	// Blue
	b: ["B", "B^w", "b+"],
	// Shade
	s: ["S^d", "S^p", "s+"],
	// AccentGold
	ag: ["Ag+", "ag", "ag^s"],
	// AccentRed
	ar: ["Ar", "ar+"],
	// AccentBlue
	ab: ["Ab", "Ab^w", "ab+"],
	// AccentShade
	as: ["As^d", "As^p", "as+"],
	// EyeRed
	er: ["Er", "er+"],
	// EyeBlue
	eb: ["Eb", "eb+"],
	// Accent
	a: ["A^b", "A^e", "a+"],
	// BodyAccent
	ba: ["Ba", "ba+"],
	// EyeAccent
	ea: ["Ea", "ea+"],
	
	// Marking
	mk: ["Mk^t", "Mk^l", "Mk^b", "Mk^s", "Mk^d", "mk+"],
	// ForeHind
	fr: ["Fr^n", "Fr^f", "Fr^h", "fr+"],
	// Outline
	o: ["O+", "O^cd", "O^cl", "o^b"],
	// Marble
	mbl: ["Mbl+", "mbl", "mbl^c"],
	// MarkShade
	ms: ["Ms", "Ms^w", "ms+"],
	// MarkOpacity
	mo: ["Mo^h", "Mo^s", "mo+"],
	
	// Black
	bl = ["Bl^i", "Bl^d", "bl+"],
	// Melanism
	ml = ["Ml^f", "Ml^p", "ml+"],
	// DarkBack
	db: ["Db", "db+"],
	// Shadow
	sw: ["Sw", "sw+"]
	
	// White
	w: ["W+", "W", "w", "w^x"],
	// Merle
	mrl: ["Mrl", "Mrl^h", "mrl+"],
	// Snow
	sn: ["Sn", "Sn^g", "sn+"],
	// Lightbelly
	lb: ["Lb+", "lb"],
	// Pied
	p: ["P^spl", "P^s", "P", "p+"]
	
	// Pearl
	prl: ["Prl+", "prl", "prl^m"],
	// Lame
	la: ["La^b", "La+", "la^s", "la^o"],
	// Dust
	dst: ["Dst+", "dst", "dst^s"],
	// Pastel
	pt: ["Pt", "pt+"],
	// Leucism
	lu: ["Lu+", "lu", "lu^a"]
};

/*
* And these are just the names of the arrays above.
* Useful for looping, through those, and dragons' alleles.
*/
var loci = ["g", "r", "b", "s", "ag", "ar", "ab", "as", "er", "eb", "a", "ba", "ea", "mk", "fr", "o", "mbl", "ms", "mo", "bl", "ml", "db", "sw", "w", "mrl", "sn", "lb", "p", "prl", "la", "dst", "pt", "lu"];

/*
* Used for counting mutations carried.
*/
var wildtypes = ["G+", "r+",...