forked from jtw-r/rbng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
99 lines (93 loc) · 4.53 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Random Business Name Generator</title>
<script src="choices.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link type="text/css" rel="stylesheet" href="style.css">
<script>
$(document).ready(function(){
$("#name").on("click", function(){
$("#name_form").toggle();
});
});
</script>
</head>
<body>
<div id="topbar">
<b id="title">Random Business Name Generator</b> | <b id="credits">Developed by Jonathan Reiterman</b> | <b id="version"></b>
</div>
<div id="left">
<p style="text-align: center;"><b>Control Panel</b></p>
<label title="Put a randomaly generated name, like 'Bob', at the begining of your company's name. Ex: Bob's newspapers.">
<input type="checkbox" id="name" >Random person's name at begining
</label><br>
<form action="" id="name_form" hidden>
<label><input type="radio" name="gender" id="rb_male" value="1">Male</label><br>
<label><input type="radio" name="gender" id="rb_female" value="0">Female</label><br>
<label><input type="radio" name="gender" id="rb_both" value="2" checked>Both</label><br>
<label title=""><input type="checkbox" id="end" title="" checked>Keep end piece of name</label><br>
</form>
<button class="green" type="button" id="generateName" onclick="c('generated').innerHTML = generate();">Generate Name</button> <button class="red" type="button" id="clear" onclick="c('history').innerHTML = ''">Clear History</button><br><br>
<p>Please Note that these names are completely random and sometimes might not make much sense, like for example 'Don's Hourglass farm'</p>
</div>
<div id="bottomleft">
<a href="https://github.com/thejonathanr/rbng" target="_blank">Check out the source code on Github</a>
</div>
<div id="middle">
<br><br>
<div id="generated"></div>
</div>
<div id="right">
<div id="history-title">History:</div>
<div id="history"></div>
</div>
<script>
function c(what) { return document.getElementById(what); }
function choose(arr) { return arr[Math.floor(Math.random() * arr.length)]; }
var version = "Version: 1.2.2";
c('version').innerHTML = version;
generate = function () {
choose_namedata = function () {
var p_name = choose(namedata);
if (c('rb_female').checked) { p_gender = 0; } else if (c('rb_male').checked) { p_gender = 1; } else { p_gender = 2; }
if (p_name[0] == p_gender || p_gender == 2) {
return p_name[1];
} else {
return choose_namedata();
}
}
if (c('generated').innerHTML != "") {
c('history').innerHTML += (c('generated').innerHTML) + '<br>';
c('right').scrollTop = c('right').scrollHeight - c('right').clientHeight;
}
var b_name = "";
var choice = choose(thingdata);
if (c('name').checked == true) {
b_name += choose_namedata() + "\'s ";
if (c('end').checked == true) {
b_name += choice[4] + " " + (choose(endingdata));
} else {
if (choice[3] == 0) {
b_name += choice[4] + "s";
} else {
if (choice[3] == 1) {
b_name += choice[4];
} else {
b_name += choice[4] + choice[3];
}
}
}
} else {
var beginingchoice = [];
for (i=0; i < 3; i++) {
if (choice[i]) { beginingchoice.push(beginingdata[i]) }
}
b_name += (choose(beginingchoice)) + " " + choice[4] + " " + (choose(endingdata));
}
return b_name;
}
</script>
</body>
</html>