-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.js
65 lines (62 loc) · 1.67 KB
/
mod.js
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
function nogree() {
return false;
}
function returnTip(tip, num) {
i = 0;
result = [];
while (i < num) {
rand = Math.floor(Math.random() * tip.length);
if (result.indexOf(tip[rand]) < 0) {
result.push(tip[rand]);
i++;
}
}
return result;
}
function refresh() {
return window.location.reload();
}
function logg() {
var per = 10;
var bill = document.querySelector(".bill").value;
var service = document.querySelector(".service").value;
var server = document.querySelector(".server").value;
if (bill > 50000) {
per = returnTip(percen, 1);
per = Number(per);
}
var tips = ((per / 100) * bill);
var caltip;
if (bill == "" || bill < 1) {
alert("Enter Bill");
nogree();
}
if (service == -1) {
alert("Rate Service");
nogree();
} else {
if (service == 1) {
caltip = tips;
} else if (service == 2) {
caltip = ((65 / 100) * tips)
} else if (service == 3) {
caltip = ((25 / 100) * tips)
} else if (service == 4) {
caltip = (0 * tips);
}
}
if (caltip > 6000) {
var randtip = returnTip(money, 1);
caltip = randtip;
}
if (server == "" || server < 1) {
alert("Enter Number of Servers");
nogree();
} else {
caltip = caltip / server;
caltip = caltip.toFixed(2);
write.textContent = caltip;
document.querySelector(".result").style.display = "block";
document.querySelector(".clear").style.display = "block";
}
}