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

impNames.js (2755B)


      1 var nm1 = ["", "", "", "", "", "", "", "b", "ch", "cr", "cy", "d", "dr", "g", "gn", "gr", "j", "k", "kr", "ky", "l", "n", "p", "q", "qr", "r", "sh", "t", "tr", "ty", "v", "x", "y", "z", "zr"];
      2 var nm2 = ["a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "ee", "ia", "iu", "ai", "aa"];
      3 var nm3 = ["bb", "bh", "bj", "bk", "bl", "bq", "br", "gb", "gf", "gh", "gl", "gm", "gn", "gr", "kb", "kh", "kj", "kk", "kl", "km", "kn", "kr", "lb", "lj", "ll", "ln", "lp", "lr", "lt", "ph", "pk", "pn", "pp", "pq", "pr", "rb", "rj", "rk", "rl", "rm", "rn", "rp", "rq", "rr", "rt", "zb", "zl", "zm", "zn", "zp", "zr", "zt", "cb", "cl", "cn", "cq", "cr", "ct", "cx", "cz", "dj", "dr", "dv", "dz", "fn", "fr", "nc", "nd", "ng", "nj", "nl", "nt", "qb", "ql", "qn", "qq", "qr", "sc", "sh", "sk", "sl", "sm", "sn", "sq", "sr", "ss", "st", "str", "sz", "tc", "th", "tj", "tn", "xh", "xn"];
      4 var nm4 = ["", "", "", "", "", "b", "c", "k", "l", "m", "n", "p", "q", "r", "s", "t", "x", "z"];
      5 var nm5 = ["ch", "cr", "cy", "d", "dr", "gn", "gr", "kr", "ky", "qr", "r", "sz", "t", "tr", "ty", "v", "x", "y", "z", "zr"];
      6 var nm6 = ["c", "l", "m", "n", "p", "q", "r", "t", "x", "z"];
      7 var br = "";
      8 
      9 function nameGen(type) {
     10     $('#placeholder').css('textTransform', 'capitalize');
     11     var tp = type;
     12     var element = document.createElement("div");
     13     element.setAttribute("id", "result");
     14     for (i = 0; i < 10; i++) {
     15         rnd2 = Math.floor(Math.random() * nm2.length);
     16         if (i % 3 === 0) {
     17             rnd = Math.floor(Math.random() * nm5.length);
     18             rnd3 = Math.floor(Math.random() * nm6.length);
     19             names = nm5[rnd] + nm2[rnd2] + nm6[rnd3];
     20         } else {
     21             rnd = Math.floor(Math.random() * nm1.length);
     22             rnd3 = Math.floor(Math.random() * nm3.length);
     23             rnd4 = Math.floor(Math.random() * nm2.length);
     24             rnd5 = Math.floor(Math.random() * nm4.length);
     25             if (rnd < 7) {
     26                 while (rnd5 < 5) {
     27                     rnd5 = Math.floor(Math.random() * nm4.length);
     28                 }
     29             }
     30             names = nm1[rnd] + nm2[rnd2] + nm3[rnd2] + nm2[rnd4] + nm4[rnd5];
     31         }
     32         tyr = Math.random() * 300 | 0;
     33         if (tyr === 10) {
     34             names = "Tyrion Lannister (just kidding)";
     35         }
     36         br = document.createElement('br');
     37         element.appendChild(document.createTextNode(names));
     38         element.appendChild(br);
     39     }
     40     if (document.getElementById("result")) {
     41         document.getElementById("placeholder").removeChild(document.getElementById("result"));
     42     }
     43     document.getElementById("placeholder").appendChild(element);
     44 }