nicknameGenerator.js

Генератор ников на javascript

by xxxwww

HTML

<input id="nickname" type="text" placeholder="Введи свой ник">
<input id="regBtn" type="button" onclick="document.getElementById('log').innerHTML+= 'Юзер зареган <br>'" value="Кнопка регистрации">

<br>
<br>
<input type="button" onclick="regUsers();" value="Начать регистрировать">

<br>
<div id="log"></div>

JavaScript

function generateNickname(){ 

	var syllable_1 = new Array("Ald", "Aeld", "Alf", "Aelf", "Alh", "Aelh", "Athel", "Aethel", "Beo", "Beor", "Berh", "Brih", "Briht", "Cad", "Cead", "Cen", "Coel", "Cuth", "Cyne", "Ed", "Ead", "El", "Eal", "Eld", "Eg", "Ecg", "Eorp", "God", "Guth", "Har", "Hwaet", "Leo", "Leof", "Oft", "Ot", "Oth", "Os", "Osw", "Peht", "Pleg", "Rad", "Raed", "Sig", "Sige", "Si", "Sihr", "Tat", "Tath", "Tost", "Ut", "Uht", "Ul", "Ulf", "Wal", "Walth", "Wer", "Wit", "Wiht", "Wil", "Wulf"); 

	var syllable_2 = new Array("gar", "heah", "here", "bald", "war", "weard", "wulf", "dred", "red", "stan", "wold", "tric", "ric", "wald", "mon", "wal", "walla", "wealh", "frith", "gyth", "rum", "bert", "berht", "gar", "win", "wine", "wiu", "for", "mund", "thoef", "eof", "had", "erth", "ferth", "thin", "er", "ther", "tar", "thar", "wig", "wicg", "mer", "floed", "ith", "hild", "run", "drun", "ny");

	return (syllable_1[Math.round(Math.random()*(60 - 1))] + syllable_2[Math.round(Math.random()*(48 - 1))]) 
} 

function regUser(){
	document.getElementById('nickname').value = generateNickname();
	document.getElementById('regBtn').click();
}

function regUsers(){
	setInterval(regUser, 1000);	
}