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

lotrDwarfNames.js (1775B)


      1 var nm1 = ["b", "br", "d", "dr", "dw", "f", "fl", "fr", "g", "gl", "gr", "k", "kh", "kr", "l", "m", "mh", "n", "t", "th", "thr"];
      2 var nm2 = ["a", "e", "i", "o", "u"];
      3 var nm3 = ["b", "f", "fr", "l", "lb", "lr", "lv", "m", "mb", "ml", "mr", "n", "nd", "nr", "r", "rb", "rl", "rv", "s", "sr"];
      4 var nm4 = ["k", "m", "n", "r"];
      5 var nm5 = ["a", "ai", "e", "i", "o", "oi", "u"];
      6 var nm6 = ["b", "d", "f", "g", "k", "l", "m", "n", "t"];
      7 var nm7 = ["a", "e", "i", "o", "u", "", "", "", ""];
      8 var br = "";
      9 
     10 function nameGen() {
     11     $('#placeholder').css('textTransform', 'capitalize');
     12     var element = document.createElement("div");
     13     element.setAttribute("id", "result");
     14     for (i = 0; i < 10; i++) {
     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() * nm3.length);
     19             rnd4 = Math.floor(Math.random() * nm2.length);
     20             rnd5 = Math.floor(Math.random() * nm4.length);
     21             names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm4[rnd5];
     22         } else {
     23             rnd = Math.floor(Math.random() * nm1.length);
     24             rnd2 = Math.floor(Math.random() * nm5.length);
     25             rnd3 = Math.floor(Math.random() * nm6.length);
     26             rnd4 = Math.floor(Math.random() * nm7.length);
     27             names = nm1[rnd] + nm5[rnd2] + nm6[rnd3] + nm7[rnd4];
     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 }