offline-fantasy-name-generators

Offline version of www.fantasynamegenerators.com
git clone https://git.neptards.moe/neptards/offline-fantasy-name-generators.git
Log | Files | Refs | README

zeldaHumanNames.js (2400B)


      1 var nm1 = ["", "", "", "", "", "", "a", "e", "i", "o", "u", "i", "a", "e"];
      2 var nm2 = ["b", "c", "d", "j", "k", "l", "m", "n", "r", "t", "z"];
      3 var nm3 = ["a", "i", "o", "u", "a", "o"];
      4 var nm4 = ["b", "g", "k", "l", "m", "ng", "r", "rr", "ss", "t", "z"];
      5 var nm5 = ["", "", "", "", "", "", "h", "k", "l", "ll", "lph", "m", "n", "nk", "s"];
      6 var nm6 = ["a", "e", "i", "o"];
      7 var nm7 = ["c", "f", "h", "m", "n", "ph", "r", "s", "sh", "th", "t"];
      8 var nm8 = ["f", "l", "m", "mb", "n", "p", "ph", "tr", "ld", "r", "s", "sh", "v"];
      9 var nm9 = ["a", "e", "i", "o", "ia", "ei", "ie", "ea", "a", "e", "i"];
     10 var nm10 = ["", "", "", "", "", "", "l", "m", "n", "s", "sh", "th"];
     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() * nm6.length);
     21             rnd2 = Math.floor(Math.random() * nm7.length);
     22             rnd5 = Math.floor(Math.random() * nm9.length);
     23             rnd6 = Math.floor(Math.random() * nm10.length);
     24             if (i < 5) {
     25                 rnd4 = Math.floor(Math.random() * nm8.length);
     26                 names = nm7[rnd2] + nm6[rnd] + nm8[rnd4] + nm9[rnd5] + nm10[rnd6];
     27             } else {
     28                 names = nm6[rnd] + nm7[rnd2] + nm9[rnd5] + nm10[rnd6];
     29             }
     30         } else {
     31             rnd2 = Math.floor(Math.random() * nm2.length);
     32             rnd3 = Math.floor(Math.random() * nm3.length);
     33             rnd5 = Math.floor(Math.random() * nm5.length);
     34             if (i < 5) {
     35                 rnd4 = Math.floor(Math.random() * nm4.length);
     36                 rnd6 = Math.floor(Math.random() * nm3.length);
     37                 names = nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm3[rnd6] + nm5[rnd5];
     38             } else {
     39                 rnd = Math.floor(Math.random() * nm1.length);
     40                 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm5[rnd5];
     41             }
     42         }
     43         br = document.createElement('br');
     44         element.appendChild(document.createTextNode(names));
     45         element.appendChild(br);
     46     }
     47     if (document.getElementById("result")) {
     48         document.getElementById("placeholder").removeChild(document.getElementById("result"));
     49     }
     50     document.getElementById("placeholder").appendChild(element);
     51 }