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

swGranNames.js (2774B)


      1 var nm1 = ["", "", "", "", "", "b", "br", "c", "dr", "f", "g", "gr", "h", "j", "k", "kh", "kl", "kr", "l", "m", "n", "p", "ph", "r", "rh", "s", "sh", "shm", "t", "th", "tw", "v", "y", "z", "zh"];
      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", "ee", "aa", "oe", "ie", "ia", "ea"];
      3 var nm3 = ["b", "c", "d", "f", "g", "gg", "gh", "k", "kg", "kk", "ks", "l", "ll", "lv", "m", "mm", "n", "nch", "nl", "nn", "ns", "p", "ph", "r", "rb", "rg", "rh", "rl", "rr", "rv", "s", "sk", "ss", "t", "th", "tt", "w", "wh", "y", "yc"];
      4 var nm4 = ["", "", "", "", "", "b", "c", "d", "f", "ff", "g", "gh", "j", "k", "ks", "kz", "l", "ls", "m", "n", "nd", "ps", "r", "rch", "rg", "s", "sk", "ss", "th", "wz", "x", "yk", "z"];
      5 var nm5 = ["ee", "aa", "oe", "ie", "ia", "ea", "ei"];
      6 var br = "";
      7 
      8 function nameGen() {
      9     $('#placeholder').css('textTransform', 'capitalize');
     10     var element = document.createElement("div");
     11     element.setAttribute("id", "result");
     12     for (i = 0; i < 10; i++) {
     13         rnd6 = Math.floor(Math.random() * nm1.length);
     14         rnd7 = Math.floor(Math.random() * nm5.length);
     15         rnd8 = Math.floor(Math.random() * nm4.length);
     16         if (rnd6 < 5) {
     17             while (rnd8 < 5) {
     18                 rnd8 = Math.floor(Math.random() * nm4.length);
     19             }
     20         }
     21         if (i % 2 === 0) {
     22             namelast = nm1[rnd6] + nm5[rnd7] + nm4[rnd8];
     23         } else {
     24             rnd9 = Math.floor(Math.random() * nm3.length);
     25             rnd11 = Math.floor(Math.random() * nm2.length);
     26             namelast = nm1[rnd6] + nm5[rnd7] + nm3[rnd9] + nm2[rnd11] + nm4[rnd8];
     27         }
     28         rnd = Math.floor(Math.random() * nm1.length);
     29         rnd2 = Math.floor(Math.random() * nm2.length);
     30         rnd4 = Math.floor(Math.random() * nm4.length);
     31         if (i < 5) {
     32             if (rnd < 5) {
     33                 while (rnd4 < 5) {
     34                     rnd4 = Math.floor(Math.random() * nm4.length);
     35                 }
     36             }
     37             names = nm1[rnd] + nm2[rnd2] + nm4[rnd4] + "  " + namelast;
     38         } else {
     39             rnd3 = Math.floor(Math.random() * nm3.length);
     40             rnd5 = Math.floor(Math.random() * nm2.length);
     41             names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd5] + nm4[rnd4] + "  " + namelast;
     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 }