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

swLightSaberForms.js (3368B)


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