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

lalafellNames.js (4277B)


      1 var nm1 = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "w", "y", "ch", "sh"];
      2 var nm2 = ["a", "e", "i", "o", "u"];
      3 var nm3 = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "w", "y", "ch", "sh"];
      4 var nm4 = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "r", "l", "s", "n", "g"];
      5 var nm5 = ["", "a", "e", "i", "o", "u"];
      6 var br = "";
      7 
      8 function nameGen(type) {
      9     $('#placeholder').css('textTransform', 'capitalize');
     10     var tp = type;
     11     var element = document.createElement("div");
     12     element.setAttribute("id", "result");
     13     for (i = 0; i < 10; i++) {
     14         if (type === 1) {
     15             if (i < 5) {
     16                 rnd = Math.floor(Math.random() * nm1.length);
     17                 rnd2 = Math.floor(Math.random() * nm2.length);
     18                 rnd3 = Math.floor(Math.random() * nm1.length);
     19                 rnd4 = Math.floor(Math.random() * nm2.length);
     20                 names = nm1[rnd] + nm2[rnd2] + nm1[rnd] + nm2[rnd2] + nm1[rnd3] + nm2[rnd4] + " " + nm1[rnd] + nm2[rnd2] + nm1[rnd3] + nm2[rnd4];
     21             } else {
     22                 rnd = Math.floor(Math.random() * nm3.length);
     23                 rnd2 = Math.floor(Math.random() * nm2.length);
     24                 rnd3 = Math.floor(Math.random() * nm1.length);
     25                 rnd4 = Math.floor(Math.random() * nm2.length);
     26                 names = nm3[rnd] + nm2[rnd2] + nm1[rnd3] + nm2[rnd4] + nm1[rnd3] + nm2[rnd4] + " " + nm3[rnd] + nm2[rnd2] + nm1[rnd3] + nm2[rnd4];
     27             }
     28         } else {
     29             if (i < 5) {
     30                 rnd = Math.floor(Math.random() * nm1.length);
     31                 rnd2 = Math.floor(Math.random() * nm2.length);
     32                 rnd3 = Math.floor(Math.random() * nm1.length);
     33                 rnd4 = Math.floor(Math.random() * nm2.length);
     34                 rnd5 = Math.floor(Math.random() * nm1.length);
     35                 rnd6 = Math.floor(Math.random() * nm2.length);
     36                 rnd7 = Math.floor(Math.random() * nm1.length);
     37                 rnd8 = Math.floor(Math.random() * nm2.length);
     38                 names = nm1[rnd] + nm2[rnd2] + nm1[rnd] + nm2[rnd2] + nm1[rnd3] + nm2[rnd4] + nm1[rnd5] + nm2[rnd6] + " " + nm1[rnd7] + nm2[rnd8] + nm1[rnd7] + nm2[rnd8] + nm1[rnd3] + nm2[rnd4] + nm1[rnd5] + nm2[rnd6];
     39             } else {
     40                 rnd = Math.floor(Math.random() * nm3.length);
     41                 rnd2 = Math.floor(Math.random() * nm2.length);
     42                 rnd3 = Math.floor(Math.random() * nm4.length);
     43                 rnd4 = Math.floor(Math.random() * nm1.length);
     44                 rnd5 = Math.floor(Math.random() * nm2.length);
     45                 rnd6 = Math.floor(Math.random() * nm3.length);
     46                 rnd7 = Math.floor(Math.random() * nm5.length);
     47                 if (rnd6 < 15) {
     48                     rnd7 = 0;
     49                 }
     50                 if (rnd6 > 14) {
     51                     while (rnd7 === 0) {
     52                         rnd7 = Math.floor(Math.random() * nm5.length);
     53                     }
     54                 }
     55                 rnd8 = Math.floor(Math.random() * nm4.length);
     56                 rnd9 = Math.floor(Math.random() * nm1.length);
     57                 rnd10 = Math.floor(Math.random() * nm2.length);
     58                 rnd11 = Math.floor(Math.random() * nm3.length);
     59                 rnd12 = Math.floor(Math.random() * nm5.length);
     60                 if (rnd11 < 15) {
     61                     rnd12 = 0;
     62                 }
     63                 if (rnd11 > 14) {
     64                     while (rnd12 === 0) {
     65                         rnd12 = Math.floor(Math.random() * nm5.length);
     66                     }
     67                 }
     68                 names = nm3[rnd] + nm2[rnd2] + nm4[rnd3] + nm1[rnd4] + nm2[rnd5] + nm3[rnd6] + nm5[rnd7] + nm4[rnd8] + " " + nm1[rnd9] + nm2[rnd10] + nm3[rnd11] + nm5[rnd12] + nm1[rnd4] + nm2[rnd5] + nm3[rnd6] + nm5[rnd7] + nm4[rnd8];
     69             }
     70         }
     71         br = document.createElement('br');
     72         element.appendChild(document.createTextNode(names));
     73         element.appendChild(br);
     74     }
     75     if (document.getElementById("result")) {
     76         document.getElementById("placeholder").removeChild(document.getElementById("result"));
     77     }
     78     document.getElementById("placeholder").appendChild(element);
     79 }