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

forswornNames.js (4156B)


      1 var nm1 = ["", "", "", "", "", "b", "br", "d", "dr", "g", "gr", "h", "k", "m", "n", "p", "pr", "r", "s", "t", "tr", "v", "w"];
      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", "a", "e", "i", "o", "u", "y", "ey", "ay", "ai", "ua", "uu", "uo", "au"];
      3 var nm3 = ["br", "bb", "cc", "cr", "cd", "d", "dv", "dr", "dl", "gv", "gl", "gm", "gn", "gr", "l", "lr", "lm", "ln", "lk", "lv", "ld", "lc", "mr", "ml", "mm", "mv", "md", "n", "nn", "nd", "nb", "nv", "nr", "ng", "r", "rk", "rv", "rg", "rd", "rb", "rt", "st", "sl", "sr", "v", "vv", "vr", "vl"];
      4 var nm4 = ["c", "ch", "d", "g", "l", "n", "r", "s"];
      5 var nm5 = ["b", "d", "f", "g", "h", "j", "k", "l", "m", "n", "r", "s", "t", "v", "w"];
      6 var nm6 = ["a", "e", "i", "o", "u", "a", "e", "o"];
      7 var nm7 = ["uai", "aie", "eia", "uae", "iae", "iea", "ai", "ua", "ea", "ia", "ei"];
      8 var nm8 = ["d", "f", "g", "h", "l", "m", "n", "r", "s", "t", "v", "w", "z"];
      9 var nm9 = ["", "", "", "", "a", "e", "i", "o", "u", "a", "e", "o"];
     10 var nm10 = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "b", "br", "d", "dr", "g", "gr", "h", "k", "m", "n", "p", "pr", "r", "s", "t", "tr", "v", "w"];
     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         rnd8a = Math.floor(Math.random() * nm10.length);
     20         rnd8 = Math.floor(Math.random() * nm6.length);
     21         rnd9 = Math.floor(Math.random() * nm3.length);
     22         rnd10 = Math.floor(Math.random() * nm6.length);
     23         rnd11 = Math.floor(Math.random() * nm8.length);
     24         rnd12 = Math.floor(Math.random() * nm9.length);
     25         nameLast = nm10[rnd8a] + nm6[rnd8] + nm3[rnd9] + nm6[rnd10] + nm8[rnd11] + nm9[rnd12];
     26         if (tp === 1) {
     27             rnd = Math.floor(Math.random() * nm5.length);
     28             rnd2 = Math.floor(Math.random() * nm7.length);
     29             if (i < 3) {
     30                 names = nm5[rnd] + nm7[rnd2] + "  " + nameLast;
     31             } else if (i < 7) {
     32                 rnd2 = Math.floor(Math.random() * nm6.length);
     33                 rnd3 = Math.floor(Math.random() * nm8.length);
     34                 rnd4 = Math.floor(Math.random() * nm6.length);
     35                 names = nm5[rnd] + nm6[rnd2] + nm8[rnd3] + nm6[rnd4] + " " + nameLast;
     36             } else {
     37                 rnd = Math.floor(Math.random() * nm6.length);
     38                 rnd3 = Math.floor(Math.random() * nm8.length);
     39                 names = nm7[rnd2] + nm8[rnd3] + nm6[rnd] + " " + nameLast;
     40             }
     41         } else {
     42             rnd = Math.floor(Math.random() * nm1.length);
     43             rnd2 = Math.floor(Math.random() * nm2.length);
     44             rnd5 = Math.floor(Math.random() * nm4.length);
     45             if (i < 5) {
     46                 while (rnd < 5) {
     47                     rnd = Math.floor(Math.random() * nm1.length);
     48                 }
     49                 names = nm1[rnd] + nm2[rnd2] + nm4[rnd5] + "  " + nameLast;
     50             } else if (i < 8) {
     51                 rnd3 = Math.floor(Math.random() * nm3.length);
     52                 rnd4 = Math.floor(Math.random() * nm2.length);
     53                 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm4[rnd5] + " " + nameLast;
     54             } else {
     55                 rnd3 = Math.floor(Math.random() * nm3.length);
     56                 rnd4 = Math.floor(Math.random() * nm2.length);
     57                 rnd6 = Math.floor(Math.random() * nm3.length);
     58                 rnd7 = Math.floor(Math.random() * nm2.length);
     59                 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm3[rnd6] + nm2[rnd7] + nm4[rnd5] + " " + nameLast;
     60             }
     61         }
     62         br = document.createElement('br');
     63         element.appendChild(document.createTextNode(names));
     64         element.appendChild(br);
     65     }
     66     if (document.getElementById("result")) {
     67         document.getElementById("placeholder").removeChild(document.getElementById("result"));
     68     }
     69     document.getElementById("placeholder").appendChild(element);
     70 }