lotrMaiarNames.js (2560B)
1 var nm1 = ["f", "l", "m", "n", "ph", "s", "sh", "w", "y", "z", "", ""]; 2 var nm2 = ["a", "e", "o", "i", "u", "ó", "é", "ie", "ui", "ia", "ea", "ae", "ua"]; 3 var nm3 = ["l", "lm", "ln", "ls", "n", "nn", "ph", "r", "s", "sh", "ss", "th"]; 4 var nm4 = ["r", "n", "s", "th", "l", "m"]; 5 var nm5 = ["a", "e", "ë", "é", "ó", "", "", "", "", ""]; 6 var nm6 = ["c", "k", "l", "m", "n", "p", "r", "s", "t", "th", "", ""]; 7 var nm7 = ["a", "e", "o", "i", "u", "ó", "é", "ai", "eo", "io", "eö", "uo", "ua"]; 8 var nm8 = ["l", "ll", "lm", "ln", "ls", "m", "md", "n", "nd", "nm", "nw", "r", "s", "ss", "t", "w"]; 9 var nm9 = ["l", "m", "n", "nd", "r", "s", "t", "th"]; 10 var nm10 = ["o", "e", "ë", "ó", "", "", "", ""]; 11 var br = ""; 12 13 function nameGen(type) { 14 $('#placeholder').css('textTransform', 'capitalize'); 15 var tp = type; 16 var element = document.createElement("div"); 17 element.setAttribute("id", "result"); 18 for (i = 0; i < 10; i++) { 19 if (tp === 1) { 20 rnd = Math.floor(Math.random() * nm1.length); 21 rnd2 = Math.floor(Math.random() * nm2.length); 22 rnd3 = Math.floor(Math.random() * nm3.length); 23 rnd4 = Math.floor(Math.random() * nm2.length); 24 if (rnd2 > 6) { 25 while (rnd4 > 6) { 26 rnd4 = Math.floor(Math.random() * nm2.length); 27 } 28 } 29 rnd5 = Math.floor(Math.random() * nm4.length); 30 rnd6 = Math.floor(Math.random() * nm5.length); 31 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm4[rnd5] + nm5[rnd6]; 32 } else { 33 rnd = Math.floor(Math.random() * nm6.length); 34 rnd2 = Math.floor(Math.random() * nm7.length); 35 rnd3 = Math.floor(Math.random() * nm8.length); 36 rnd4 = Math.floor(Math.random() * nm7.length); 37 if (rnd2 > 6) { 38 while (rnd4 > 6) { 39 rnd4 = Math.floor(Math.random() * nm7.length); 40 } 41 } 42 rnd5 = Math.floor(Math.random() * nm9.length); 43 rnd6 = Math.floor(Math.random() * nm10.length); 44 names = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm7[rnd4] + nm9[rnd5] + nm10[rnd6]; 45 } 46 br = document.createElement('br'); 47 element.appendChild(document.createTextNode(names)); 48 element.appendChild(br); 49 } 50 if (document.getElementById("result")) { 51 document.getElementById("placeholder").removeChild(document.getElementById("result")); 52 } 53 document.getElementById("placeholder").appendChild(element); 54 }