-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
196 lines (143 loc) · 5.92 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>khmernamegenerator</title>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="main">
<div class="header">
<h2>Khmer Name Generator</h2>
</div>
<div class="main--text--section">
<div class="text--section">
<h1 id="text"></h1>
</div>
<div class="button--main--layout">
<div>
<button id="fullname">
Get Full Name
</button>
</div>
<div>
<button id='firstname'>
Get First Name
</button>
</div>
<div>
<button id="lastname">
Get Last Name
</button>
</div>
</div>
</div>
<hr>
<div class="main--text--section">
<div class="text--section province">
<ul id="province">
</ul>
</div>
<div class="button--main--layout">
<button id="latlong">
Get province with latlong
</button>
</div>
</div>
<hr>
<div class="main--text--section">
<div class="text--section province">
<ul id="date-text"></ul>
</div>
<div class="button--main--layout">
<div>
<button id="date">
Get Day
</button>
</div>
<div>
<button id='month'>
Get Month
</button>
</div>
</div>
</div>
<hr>
<div class="main--text--section">
<div class="button--main--layout">
<input class="word-input" type="number" id="how-many-word" name="word-to-generate"
placeholder="numbers of word">
<div>
<button id="generate-word">
Generate sentence
</button>
</div>
</div>
<div class="text--section province">
<h4 id="sentence"></h4>
</div>
</div>
</div>
<script src="./dist/khmernamegenerator.min.js" type="text/javascript"></script>
<script>
//////////////// get khmer name////////////////////////////////////////
document.getElementById("fullname").onclick = function () {
var fullname = khmerNameGenerator.name.getRandomName();
document.getElementById('text').innerHTML = fullname;
};
document.getElementById("firstname").onclick = function () {
var firstname = khmerNameGenerator.name.getRandomFirstname();
document.getElementById('text').innerHTML = firstname;
};
document.getElementById("lastname").onclick = function () {
var lastname = khmerNameGenerator.name.getRandomLastname();
document.getElementById('text').innerHTML = lastname;
};
/////////////////////////////////////////////////////////////////////////
//////////////// get khmer date/////////////////////////////////////////
document.getElementById("date").onclick = function () {
document.getElementById('date-text').innerHTML = '';
let khmerDay = khmerNameGenerator.khmerDate.getKhmerDay();
khmerDay.forEach(function (element) {
let list = document.createElement('li');
let textlist = document.createTextNode(element);
list.appendChild(textlist);
document.getElementById('date-text').appendChild(list);
})
};
document.getElementById("month").onclick = function () {
document.getElementById('date-text').innerHTML = '';
let khmerMonth = khmerNameGenerator.khmerDate.getKhmerMonth();
khmerMonth.forEach(function (element) {
let list = document.createElement('li');
let textlist = document.createTextNode(element);
list.appendChild(textlist);
document.getElementById('date-text').appendChild(list);
})
};
/////////////////////////////////////////////////////////////////////////
//////////////// get province lat long /////////////////////////////////
document.getElementById("latlong").onclick = function () {
document.getElementById('province').innerHTML = '';
let latlong = khmerNameGenerator.provincewithlatlong.getProvinceWithLatLong();
latlong.forEach(function (element) {
let list = document.createElement('li');
let textlist = document.createTextNode(element);
list.appendChild(textlist);
document.getElementById('province').appendChild(list);
})
};
/////////////////////////////////////////////////////////////////////////
//////////////// generate sentence //////////////////////////////////////
document.getElementById("generate-word").onclick = function () {
var numberOfWords = document.getElementById("how-many-word").value;
khmerNameGenerator.generateWord.generateSentence(numberOfWords).then(function (generatedSentence) {
document.getElementById('sentence').innerHTML = generatedSentence;
});
};
/////////////////////////////////////////////////////////////////////////
</script>
</body>
</html>