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

zeldaFairyNames.js (1845B)


      1 var nm1 = ["B", "C", "D", "F", "G", "H", "K", "L", "M", "N", "P", "R", "S", "T", "V", "W", "Z"];
      2 var nm2 = ["ea", "ae", "ai", "ao", "aa", "au", "ei", "ee", "ia", "ie", "io", "oo", "oa"];
      3 var nm3 = ["f", "k", "l", "m", "n", "r", "s"];
      4 var nm4 = ["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", "ie", "ia", "ea", "ae", "io", "eo", "ai"];
      5 var nm5 = ["w", "r", "t", "l", "k", "h", "g", "f", "d", "s", "m", "n", "v", "c"];
      6 var nm6 = ["a", "e", "i", "o", "u"];
      7 var nm7 = ["", "", "", "", "", "", "t", "h", "s", "l", "n", "m"];
      8 var br = "";
      9 
     10 function nameGen(type) {
     11     $('#placeholder').css('textTransform', 'capitalize');
     12     var tp = type;
     13     var element = document.createElement("div");
     14     element.setAttribute("id", "result");
     15     for (i = 0; i < 10; i++) {
     16         if (tp === 1) {
     17             rnd = Math.floor(Math.random() * nm1.length);
     18             rnd2 = Math.floor(Math.random() * nm4.length);
     19             rnd3 = Math.floor(Math.random() * nm5.length);
     20             rnd4 = Math.floor(Math.random() * nm6.length);
     21             rnd5 = Math.floor(Math.random() * nm7.length);
     22             names = nm1[rnd] + nm4[rnd2] + nm5[rnd3] + nm6[rnd4] + nm7[rnd5];
     23         } else {
     24             rnd = Math.floor(Math.random() * nm1.length);
     25             rnd2 = Math.floor(Math.random() * nm2.length);
     26             rnd3 = Math.floor(Math.random() * nm3.length);
     27             names = nm1[rnd] + nm2[rnd2] + nm3[rnd3];
     28         }
     29         br = document.createElement('br');
     30         element.appendChild(document.createTextNode(names));
     31         element.appendChild(br);
     32     }
     33     if (document.getElementById("result")) {
     34         document.getElementById("placeholder").removeChild(document.getElementById("result"));
     35     }
     36     document.getElementById("placeholder").appendChild(element);
     37 }