-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
351 lines (293 loc) · 11.9 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Iraboti Transparent Lottery Software</title>
<meta name='description' content='Choose winners with confidence using this open-source, tamper-proof lottery software'>
<!-- Iraboti Transparent Lottery Software -->
<!-- developed by Tawhidur Rahman Dear, https://www.tawhidurrahmandear.com -->
<!-- Source Code available at https://github.com/tawhidurrahmandear/iraboti -->
<!-- Live Preview available at https://tawhidurrahmandear.github.io/iraboti -->
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
<meta http-equiv='cache-control' content='no-cache, no-store, must-revalidate'>
<style>
.iraboti-content {
font-family: Tahoma, Helvetica, 'Trebuchet MS', sans-serif;
color: #333;
background-color: #f4f4f4;
padding: 20px;
}
.iraboti-content h1, .iraboti-content h2, .iraboti-content h3 {
font-family: Tahoma, Ubuntu, Roboto, Helvetica, 'Trebuchet MS', sans-serif;
color: #6600FF;
text-align: center;
}
.iraboti-tab-buttons {
display: flex;
justify-content: space-between;
max-width: 600px;
margin: 0 auto 20px;
}
.iraboti-tab-buttons button {
flex: 1;
padding: 10px;
margin: 5px;
border: 1px solid #6600FF;
border-radius: 5px;
background-color: white;
color: #6600FF;
cursor: pointer;
font-size: 16px;
transition: all 0.3s ease;
}
.iraboti-tab-buttons button:hover {
background-color: #6600FF;
color: white;
}
.iraboti-tab-buttons button.active {
background-color: #6600FF;
color: white;
border: none;
}
/* Style for tab content */
.iraboti-tab-content {
display: none;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: white;
max-width: 600px;
margin: 0 auto;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.iraboti-tab-content.active {
display: block;
}
/* Label and input styling */
.iraboti-label {
font-weight: bold;
margin-bottom: 5px;
display: block;
}
.iraboti-input, .iraboti-textarea {
width: 100%;
padding: 20px;
margin-top: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
box-sizing: border-box;
background-color: #EEF3FA;
transition: background-color 0.5s ease;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.iraboti-input, .iraboti-textarea {
font-size: 16px;
}
.iraboti-textarea {
font-family: Tahoma, Helvetica, 'Trebuchet MS', sans-serif;
font-size: 15px;
line-height: 1.5;
font-weight: bold;
resize: none;
}
/* Button styling */
.iraboti-button {
display: block;
width: 100%;
padding: 10px;
font-size: 16px;
color: white;
background-color: #6600FF;
border: none;
border-radius: 5px;
cursor: pointer;
transition: all 0.3s ease;
}
.iraboti-button:hover {
background-color: #751aff;
}
/* Alert message styling */
.alert {
margin-top: 10px;
padding: 10px;
font-size: 14px;
border-radius: 5px;
text-align: center;
}
.alert.error {
color: white;
background-color: red;
}
.alert.success {
color: white;
background-color: green;
}
/* Results section styling */
#results {
margin-top: 20px;
max-width: 600px;
margin-left: auto;
margin-right: auto;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
table, th, td {
border: 1px solid #ddd;
}
th, td {
text-align: center;
padding: 10px;
}
th {
background-color: #6600FF;
color: white;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
</style>
</head>
<body>
<div class="iraboti-content">
<h2>Iraboti</h2>
<h3>Transparent Lottery Software</h3>
<div class="iraboti-tab-buttons">
<button class="iraboti-tab-link active" data-tab="rangeInput">Range Input</button>
<button class="iraboti-tab-link" data-tab="customInput">Custom Input</button>
</div>
<!-- Range Input Tab -->
<div class="iraboti-tab-content active" id="rangeInput">
<label class="iraboti-label" for="start">Start Range :<br>(Only numerics from 1 or higher are allowed)</label>
<input type="number" class="iraboti-input" id="start" placeholder="Enter start range">
<br>
<br>
<label class="iraboti-label" for="end">End Range :<br>(Must be a greater number than Start Range)</label>
<input type="number" class="iraboti-input" id="end" placeholder="Enter end range">
<br>
<br>
<label class="iraboti-label" for="winnersRange">Number of Winners:</label>
<input type="number" class="iraboti-input" id="winnersRange" placeholder="Enter number of winners">
<br>
<button class="iraboti-button" id="drawRangeLottery">Draw Lottery</button>
<div id="rangeAlert" class="alert"></div>
</div>
<!-- Custom Input Tab -->
<div class="iraboti-tab-content" id="customInput">
<label class="iraboti-label" for="customNumbers">Paste Lottery Numbers<br>(One per line, alphanumeric and random are allowed)</label>
<textarea id="customNumbers" class="iraboti-textarea" spellcheck="false" rows="10" placeholder="Enter Lottery Numbers, or Names of the Players"></textarea>
<br>
<br>
<label class="iraboti-label" for="winnersCustom">Number of Winners:</label>
<input type="number" class="iraboti-input" id="winnersCustom" placeholder="Enter number of winners">
<button class="iraboti-button" id="drawCustomLottery">Draw Lottery</button>
<div id="customAlert" class="alert"></div>
</div>
<!-- Results Section -->
<div id="results"></div>
</div>
<script>
// Iraboti Transparent Lottery Software
// developed by Tawhidur Rahman Dear, https://www.tawhidurrahmandear.com
// Source Code available at https://github.com/tawhidurrahmandear/iraboti
// Live Preview available at https://tawhidurrahmandear.github.io/iraboti
// Tab Switching Logic
document.querySelectorAll('.iraboti-tab-link').forEach(function (button) {
button.addEventListener('click', function () {
// Remove the 'active' class from all tab buttons
document.querySelectorAll('.iraboti-tab-link').forEach(function (btn) {
btn.classList.remove('active');
});
// Hide all tab content
document.querySelectorAll('.iraboti-tab-content').forEach(function (tab) {
tab.classList.remove('active');
});
// Add 'active' class to the clicked tab button
button.classList.add('active');
// Show the corresponding tab content based on the data-tab attribute
document.getElementById(button.getAttribute('data-tab')).classList.add('active');
});
});
// Lottery Drawing for Range Input
document.getElementById('drawRangeLottery').addEventListener('click', function () {
const start = parseInt(document.getElementById('start').value, 10); // Start of range
const end = parseInt(document.getElementById('end').value, 10); // End of range
const winnersCount = parseInt(document.getElementById('winnersRange').value, 10); // Number of winners
const alertDiv = document.getElementById('rangeAlert'); // Alert area for range input
alertDiv.className = 'alert'; // Reset alert classes
alertDiv.textContent = ''; // Clear previous alerts
if (isNaN(start) || isNaN(end) || isNaN(winnersCount) || start > end || winnersCount > end - start + 1) {
alertDiv.textContent = 'Invalid input. Check your ranges.';
alertDiv.classList.add('error'); // Show error message with red styling
return;
}
const range = [];
for (let i = start; i <= end; i++) {
range.push(i);
}
const winners = [];
while (winners.length < winnersCount) {
const randomIndex = Math.floor(Math.random() * range.length); // Random index from range array
winners.push(range.splice(randomIndex, 1)[0]); // Remove the selected number and add it to winners
}
displayResults(winners);
alertDiv.textContent = 'Lottery draw successful!';
alertDiv.classList.add('success'); // Success message in green
});
// Lottery Drawing for Custom Input
document.getElementById('drawCustomLottery').addEventListener('click', function () {
const customNumbersInput = document.getElementById('customNumbers').value.trim(); // User input (one number per line)
const winnersCount = parseInt(document.getElementById('winnersCustom').value, 10); // Number of winners
const alertDiv = document.getElementById('customAlert'); // Alert area for custom input
alertDiv.className = 'alert'; // Reset alert classes
alertDiv.textContent = ''; // Clear previous alerts
const numbers = customNumbersInput.split('\n').map(function (num) {
return num.trim();
}).filter(Boolean);
if (numbers.length === 0 || isNaN(winnersCount) || winnersCount > numbers.length) {
alertDiv.textContent = 'Invalid input. Check your custom numbers or winner count.';
alertDiv.classList.add('error'); // Show error message in red
return;
}
const winners = [];
const pool = numbers.slice(); // Clone the array to avoid modifying the original input
while (winners.length < winnersCount) {
const randomIndex = Math.floor(Math.random() * pool.length); // Random index from the pool array
winners.push(pool.splice(randomIndex, 1)[0]); // Remove the selected number and add it to winners
}
displayResults(winners);
alertDiv.textContent = 'Lottery draw successful!';
alertDiv.classList.add('success'); // Success message with green styling
});
// Function to display the results in a table
function displayResults(winners) {
var resultsHTML = '<h2>Winners:</h2>' +
'<table>' +
'<thead>' +
'<tr>' +
'<th>#</th>' + // Column for serial numbers
'<th>Winner</th>' + // Column for winner details
'</tr>' +
'</thead>' +
'<tbody>';
// Append rows for each winner
winners.forEach(function (winner, index) {
resultsHTML += '<tr>' +
'<td>' + (index + 1) + '</td>' + // Serial number
'<td>' + winner + '</td>' + // Winner value
'</tr>';
});
resultsHTML += '</tbody></table>';
// Insert the generated table into the results section
document.getElementById('results').innerHTML = resultsHTML;
}
</script>
</body>
</html>