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

dndChangelings.js (1294B)


      1 var nm1 = ["", "", "", "b", "d", "f", "h", "j", "l", "m", "n", "p", "r", "s", "t", "v", "w", "y"];
      2 var nm2 = ["a", "i", "o", "u", "a", "i", "o", "u", "a", "i", "o", "u", "a", "i", "o", "u", "ee", "ie", "ea", "ae", "ai", "oo", "ou"];
      3 var nm3 = ["c", "g", "gs", "k", "ks", "kt", "m", "n", "rx", "rt", "rs", "s", "sk", "t", "ts", "x", "z"];
      4 var br = "";
      5 
      6 function nameGen() {
      7     $('#placeholder').css('textTransform', 'capitalize');
      8     var element = document.createElement("div");
      9     element.setAttribute("id", "result");
     10     for (i = 0; i < 10; i++) {
     11         nameMas();
     12         while (nMs === "") {
     13             nameMas();
     14         }
     15         br = document.createElement('br');
     16         element.appendChild(document.createTextNode(nMs));
     17         element.appendChild(br);
     18     }
     19     if (document.getElementById("result")) {
     20         document.getElementById("placeholder").removeChild(document.getElementById("result"));
     21     }
     22     document.getElementById("placeholder").appendChild(element);
     23 }
     24 
     25 function nameMas() {
     26     rnd = Math.random() * nm1.length | 0;
     27     rnd2 = Math.random() * nm2.length | 0;
     28     rnd3 = Math.random() * nm3.length | 0;
     29     while (nm1[rnd] === nm3[rnd3]) {
     30         rnd3 = Math.random() * nm3.length | 0;
     31     }
     32     nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3];
     33     testSwear(nMs);
     34 }