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

zeldaZoraNames.js (2493B)


      1 var nm1 = ["", "", "", "", "", "h", "j", "k", "m", "n", "p", "t", "v", "z"];
      2 var nm2 = ["a", "i", "o", "e"];
      3 var nm3 = ["j", "k", "l", "p", "r", "t", "v"];
      4 var nm4 = ["", "", "", "", "", "m", "n", "s", "r"];
      5 var nm5 = ["", "", "", "", "l", "n", "r", "m", "h", "f"];
      6 var nm6 = ["a", "u", "o", "e"];
      7 var nm7 = ["r", "t", "l", "n", "r", "t", "l", "ph", "v", "m"];
      8 var nm8 = ["", "", "", "", "", "", "n", "h"];
      9 var br = "";
     10 
     11 function nameGen(type) {
     12     $('#placeholder').css('textTransform', 'capitalize');
     13     var tp = type;
     14     var element = document.createElement("div");
     15     element.setAttribute("id", "result");
     16     for (i = 0; i < 10; i++) {
     17         if (tp === 1) {
     18             rnd = Math.floor(Math.random() * nm5.length);
     19             rnd2 = Math.floor(Math.random() * nm6.length);
     20             rnd3 = Math.floor(Math.random() * nm7.length);
     21             rnd4 = Math.floor(Math.random() * nm8.length);
     22             rnd5 = Math.floor(Math.random() * nm6.length);
     23             if (i < 5) {
     24                 if (rnd < 4) {
     25                     while (rnd4 < 6) {
     26                         rnd4 = Math.floor(Math.random() * nm8.length);
     27                     }
     28                 }
     29                 names = nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd5] + nm8[rnd4];
     30             } else {
     31                 rnd6 = Math.floor(Math.random() * nm6.length);
     32                 rnd7 = Math.floor(Math.random() * nm7.length);
     33                 names = nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd5] + nm7[rnd7] + nm6[rnd6] + nm8[rnd4];
     34             }
     35         } else {
     36             rnd = Math.floor(Math.random() * nm1.length);
     37             rnd2 = Math.floor(Math.random() * nm2.length);
     38             rnd3 = Math.floor(Math.random() * nm3.length);
     39             rnd4 = Math.floor(Math.random() * nm4.length);
     40             rnd5 = Math.floor(Math.random() * nm2.length);
     41             if (i < 5) {
     42                 if (rnd < 5) {
     43                     while (rnd4 < 5) {
     44                         rnd4 = Math.floor(Math.random() * nm4.length);
     45                     }
     46                 }
     47             }
     48             names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd5] + nm4[rnd4];
     49         }
     50         br = document.createElement('br');
     51         element.appendChild(document.createTextNode(names));
     52         element.appendChild(br);
     53     }
     54     if (document.getElementById("result")) {
     55         document.getElementById("placeholder").removeChild(document.getElementById("result"));
     56     }
     57     document.getElementById("placeholder").appendChild(element);
     58 }