pfAutomaton.js (3664B)
1 var nm1 = ["", "", "b", "d", "h", "k", "m", "n", "r", "t", "y", "z"]; 2 var nm2 = ["a", "e", "i", "u"]; 3 var nm3 = ["d", "g", "gh", "hk", "hm", "hn", "hr", "lm", "ln", "lnh", "lr", "lrh", "m", "mh", "n", "nh", "nt", "ntr", "ns", "s", "sn", "sm", "sr", "ss", "t", "tr", "v", "z", "zh", "zr"]; 4 var nm4 = ["a", "a", "e", "i", "i", "o", "u"]; 5 var nm5 = ["h", "l", "m", "n", "r", "y", "z"]; 6 var nm6 = ["ia", "a", "a", "e", "i", "i", "o", "o", "u"]; 7 var nm7 = ["h", "l", "n", "r", "s"]; 8 var br = ""; 9 10 function nameGen(type) { 11 var nm8 = ["Academic", "Acclaimed", "Admirable", "Admired", "Adored", "Affectionate", "Agile", "Angel", "Architect", "Artist", "Artistic", "Austere", "Authentic", "Beautiful", "Beloved", "Blessed", "Blissful", "Bold", "Brave", "Bright", "Brilliant", "Butterfly", "Calm", "Carefree", "Celebrated", "Charming", "Clever", "Complex", "Composed", "Conjurer", "Content", "Cook", "Cuddly", "Cuddly Bear", "Cunning", "Dancer", "Dapper", "Defiant", "Devoted", "Diligent", "Doctor", "Earnest", "Educated", "Elegant", "Emotional", "Enchanted", "Enchanting", "Enigma", "Enlightened", "Exalted", "Example", "Expert", "Fair", "Famous", "Fancy", "Fearless", "Flamboyant", "Flawed", "Flawless", "Forgiving", "Free", "Friend", "Funny", "Generous", "Gentle", "Genuine", "Gifted", "Giving", "Glorious", "Good", "Graceful", "Grand", "Great", "Guardian", "Guest", "Honest", "Honorable", "Honored", "Hospitable", "Humble", "Idealist", "Illustrious", "Immortal", "Incredible", "Infamous", "Innocent", "Inventor", "Ironclad", "Judge", "Just", "Keen", "Kind", "Lawful", "Learned", "Light", "Loving", "Loyal", "Magnificent", "Majestic", "Marvelous", "Master", "Mellow", "Merciful", "Merry", "Mighty", "Moral", "Nightingale", "Noble", "Ox", "Paragon", "Passionate", "Patient", "Peaceful", "Pleasant", "Precious", "Protector", "Proud", "Quaint", "Quiet", "Scholar", "Scientist", "Shield", "Silent", "Soothsayer", "Sophisticated", "Speaker", "Specialist", "Strong", "Student", "Swift", "Sympathetic", "Thoughtful", "Treasure", "Treasured", "Vagabond", "Valiant", "Victorious", "Vigilant", "Watcher", "Wayfarer", "Wise", "Wonderful"]; 12 var tp = type; 13 $('#placeholder').css('textTransform', 'capitalize'); 14 var element = document.createElement("div"); 15 element.setAttribute("id", "result"); 16 for (i = 0; i < 10; i++) { 17 if (i < 6) { 18 nameMas(); 19 while (nMs === "") { 20 nameMas(); 21 } 22 } else { 23 rnd = Math.random() * nm8.length | 0; 24 nMs = "The " + nm8[rnd]; 25 nm8.splice(rnd, 1); 26 } 27 br = document.createElement('br'); 28 element.appendChild(document.createTextNode(nMs)); 29 element.appendChild(br); 30 } 31 if (document.getElementById("result")) { 32 document.getElementById("placeholder").removeChild(document.getElementById("result")); 33 } 34 document.getElementById("placeholder").appendChild(element); 35 } 36 37 function nameMas() { 38 nTp = Math.random() * 7 | 0; 39 rnd = Math.random() * nm1.length | 0; 40 rnd2 = Math.random() * nm2.length | 0; 41 rnd3 = Math.random() * nm3.length | 0; 42 rnd4 = Math.random() * nm6.length | 0; 43 rnd7 = Math.random() * nm7.length | 0; 44 if (nTp < 5) { 45 nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm6[rnd4] + nm7[rnd7]; 46 } else { 47 rnd5 = Math.random() * nm5.length | 0; 48 rnd6 = Math.random() * nm4.length | 0; 49 while (nm3[rnd3] === nm5[rnd5] || nm5[rnd5] === nm7[rnd7]) { 50 rnd5 = Math.random() * nm5.length | 0; 51 } 52 nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd6] + nm5[rnd5] + nm6[rnd4] + nm7[rnd7]; 53 } 54 testSwear(nMs); 55 }