You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
5.5 KiB
JavaScript

var nm1 = ["", "g", "h", "l", "m", "n", "gy", "p", "r", "s", "t"];
var nm2 = ["aa", "io", "ue", "ee", "a", "e", "i", "o", "a", "e", "i", "o", "u", "a", "e", "i", "o", "a", "e", "i", "o", "u"];
var nm3 = ["h", "l", "ll", "m", "n", "ng", "nz", "r", "s", "sh", "ts"];
var nm4 = ["", "hn", "l", "ng", "n"];
var nm5 = ["", "h", "l", "n", "m", "p", "r", "s", "y"];
var nm6 = ["h", "l", "m", "ng", "n", "sh", "r", "rr"];
var nm7 = ["", "", "hn", "h", "n"];
first = -1;
triggered = 0;
reset = 0;
function preload(arrayOfImages) {
$(arrayOfImages).each(function() {
$('<img/>')[0].src = this;
});
}
preload(['../images/backgrounds/avatarAang.jpg', '../images/backgrounds/avatarTenzin.jpg', '../images/backgrounds/avatarGyatso.jpg']);
function nameGen(type) {
if (reset === 1) {
$("#nameGen").css("background-image", bg);
reset = 0;
}
var nm8 = ["Bhakto", "Bhuchung", "Bhuti", "Chodag", "Chodak", "Choden", "Chodrak", "Choedon", "Choegyal", "Choejor", "Choenyi", "Choephel", "Choezom", "Chokey", "Chokphel", "Chokzay", "Chonden", "Chophel", "Dakpa", "Damchoe", "Dawa", "Dema", "Dhadul", "Dhakpa", "Dhardon", "Dhargay ", "Dhargey", "Dhargye", "Dharma", "Dhundup", "Dolkar", "Dolker", "Dolma", "Dorje", "Dorjee", "Duga", "Gelek", "Gephel", "Gonpo", "Gurmey", "Gyalchok", "Gyaltsen", "Gyamtso", "Gyatso", "Gyurmey", "Jamma", "Jampa", "Jamtso", "Jamyang", "Jangchup", "Jinpa", "Jorden", "Jungney", "Kalsang", "Karma", "Kechok", "Kelden", "Kelsang", "Kesang", "Khando", "Khandro", "Khedrup", "Khetsun", "Konchok", "Kunchen", "Kundang", "Kunga", "Legshey", "Lhakpa", "Lhamo", "Lhawang", "Lhundrup", "Lhundup", "Lobsang", "Metok", "Monlam", "Namdak", "Namdol", "Namgyal", "Namgyal Wangchuk", "Ngawang", "Ngodup", "Ngonga", "Norbu", "Norzin", "Nyandak", "Nyima", "Padma", "Palden", "Paldon", "Paljor", "Palkyi", "Palmo", "Passang", "Pema", "Pemba", "Penpa", "Phuntsok", "Rabgyal", "Rabten", "Rabyang", "Rangdol", "Rapten", "Richen", "Rigsang", "Rigzin", "Rinchen", "Samdup", "Samten", "Sangey", "Sangmo", "Sangyal", "Sangye", "Sherab", "Sherap", "Sonam", "Tamdin", "Tashi", "Tempa", "Tenzin", "Thekchen", "Thokmay", "Thubten", "Tinley", "Topden", "Tsamchoe", "Tselha", "Tsering", "Tseten", "Tsewang", "Tsomo", "Tsultrim", "Tsundue", "Ugyen", "Wangchen", "Wangchuk", "Wangdak", "Wangdue", "Wangdup", "Wangmo", "Wangyal", "Woenang", "Woeser", "Woeten", "Yama", "Yangdon", "Yangkey", "Yangtso", "Yangzom", "Yeshi", "Yonten", "Youdon", "Youdron", "Yudron", "Yungdrung", "Zopa"];
$('#placeholder').css('textTransform', 'capitalize');
var tp = type;
var br = "";
var element = document.createElement("div");
element.setAttribute("id", "result");
nTp = Math.random() * 50 | 0;
if (nTp === 0 && first !== 0 && triggered === 0) {
nTp = Math.random() * 3 | 0;
if (nTp === 0) {
aang();
} else if (nTp === 1) {
tenzin();
} else {
gyatso();
}
} else {
for (i = 0; i < 10; i++) {
if (i < 4) {
rnd = Math.random() * nm8.length | 0;
nMs = nm8[rnd];
nm8.splice(rnd, 1);
} else {
if (tp === 1) {
nameFem()
while (nMs === "") {
nameFem();
}
} else {
nameMas()
while (nMs === "") {
nameMas();
}
}
}
br = document.createElement('br');
element.appendChild(document.createTextNode(nMs));
element.appendChild(br);
}
if (document.getElementById("result")) {
document.getElementById("placeholder").removeChild(document.getElementById("result"));
}
document.getElementById("placeholder").appendChild(element);
first++;
}
}
function nameMas() {
nTp = Math.random() * 4 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd5 = Math.random() * nm4.length | 0;
if (nTp === 0) {
while (nm1[rnd] === "" && nm4[rnd5] === "") {
rnd5 = Math.random() * nm4.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd5];
} else {
rnd3 = Math.random() * nm3.length | 0;
rnd4 = Math.random() * nm2.length | 0;
if (rnd2 < 4) {
while (rnd4 < 4) {
rnd4 = Math.random() * nm2.length | 0;
}
}
while (nm3[rnd3] === nm1[rnd] || nm3[rnd3] === nm4[rnd5]) {
rnd3 = Math.random() * nm3.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm4[rnd5];
}
testSwear(nMs);
}
function nameFem() {
nTp = Math.random() * 4 | 0;
rnd = Math.random() * nm5.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd5 = Math.random() * nm7.length | 0;
if (nTp === 0) {
while (nm5[rnd] === "" && nm7[rnd5] === "") {
rnd = Math.random() * nm5.length | 0;
}
nMs = nm5[rnd] + nm2[rnd2] + nm7[rnd5];
} else {
rnd3 = Math.random() * nm6.length | 0;
rnd4 = Math.random() * nm2.length | 0;
if (rnd2 < 4) {
while (rnd4 < 4) {
rnd4 = Math.random() * nm2.length | 0;
}
}
while (nm6[rnd3] === nm5[rnd] || nm6[rnd3] === nm7[rnd5]) {
rnd3 = Math.random() * nm6.length | 0;
}
nMs = nm5[rnd] + nm2[rnd2] + nm6[rnd3] + nm2[rnd4] + nm7[rnd5];
}
testSwear(nMs);
}