You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
2.4 KiB
JavaScript

var nm2 = ["aval", "bare", "bleak", "bliz", "chill", "clear", "cloud", "cold", "cristal", "crystal", "dark", "drift", "frost", "gliss", "ice", "moon", "north", "shiver", "sleet", "snow", "storm", "that", "thaw", "therm", "whit", "white", "wild", "wind", "winter", "wit", "wolf", "yce"];
var nm3 = ["band", "barrow", "bell", "born", "borough", "bourne", "breach", "break", "chill", "cliff", "crest", "dale", "denn", "drift", "fall", "fell", "field", "ford", "fort", "frost", "gard", "garde", "glen", "grasp", "grave", "guard", "hallow", "ham", "hand", "helm", "hill", "hold", "holde", "hollow", "horn", "host", "keep", "maw", "mire", "mond", "moor", "more", "pass", "peak", "point", "port", "reach", "rest", "scar", "shield", "spell", "spire", "storm", "strand", "tide", "vale", "vault", "vein", "ville", "wall", "wallow", "ward", "watch", "wich"];
function nameGen() {
var nm1 = ["Arcta", "Arcti", "Avala", "Avalan", "Blizz", "Blyz", "Boots", "Brisque", "Chill", "Chillis", "Cristal", "Cryo", "Crystal", "Drift", "Firn", "Flaike", "Flake", "Flo", "Flurris", "Frigid", "Fross", "Frost", "Frostbite", "Fyre", "Glace", "Glacia", "Glacier", "Glacis", "Glaize", "Gliss", "Hayle", "Hearth", "Hiber", "Hiver", "Ice", "Iglis", "Lanche", "Melte", "Mitten", "Mittens", "Névé", "Neige", "Onding", "Quilt", "Rime", "Shiver", "Sleat", "Sleath", "Sled", "Sledge", "Sleet", "Slush", "Snift", "Sno", "Snow", "Solstice", "Thaw", "Thawe", "Thermia", "Thermis", "Thermos", "Wind", "Winde", "Winter", "Wool", "Wynter", "Yce"];
$('#placeholder').css('textTransform', 'capitalize');
var br = "";
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
if (i < 4) {
rnd = Math.random() * nm1.length | 0;
names = nm1[rnd];
nm1.splice(rnd, 1);
} else {
rnd = Math.random() * nm2.length | 0;
rnd2 = Math.random() * nm3.length | 0;
while (nm2[rnd] === nm3[rnd2]) {
rnd2 = Math.floor(Math.random() * nm3.length);
}
names = nm2[rnd] + nm3[rnd2];
}
br = document.createElement('br');
element.appendChild(document.createTextNode(names));
element.appendChild(br);
}
if (document.getElementById("result")) {
document.getElementById("placeholder").removeChild(document.getElementById("result"));
}
document.getElementById("placeholder").appendChild(element);
}