-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
165 lines (137 loc) · 5.43 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>โปรแกรมคำนวณราคาพื้นที่ต่อตารางเมตร</title>
<!-- https://electronjs.org/docs/tutorial/security#csp-meta-tag -->
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<link rel="stylesheet" href="./inclu/bootstrap/css/bootstrap.min.css">
<style>
table {
text-align: center;
width: 100%;
}
.action-menu-item {
text-decoration: none;
}
/* Hide Scroll */
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}
</style>
</head>
<body>
<div class="container text-center">
ความยาวที่ต้องการจะกรอก
<div class="btn-group btn-group-sm">
<input type="radio" class="btn-check" name="leeeeee" id="in" autocomplete="off" onclick="check()">
<label class="btn btn-secondary" for="in">นิ้ว</label>
<input type="radio" class="btn-check" name="leeeeee" id="cm" autocomplete="off" onclick="check()">
<label class="btn btn-secondary" for="cm">เซนติเมตร</label>
<input type="radio" class="btn-check" name="leeeeee" id="m" autocomplete="off" onclick="check()" checked>
<label class="btn btn-secondary" for="m">เมตร</label>
</div>
<table class="mb-2">
<tr>
<td>
กว้าง <input type="number" id="width" class="form-control" name="width" placeholder="กว้าง" onkeyup="check()">
</td>
<td>
ยาว <input type="number" id="length" class="form-control" name="length" placeholder="ยาว" onkeyup="check()">
</td>
</tr>
<table>
<form>
<div class="form-group row">
<label for="pricepre" class="col-sm-2 col-form-label">ราคาต่อตารางเมตร</label>
<div class="col-sm-10">
<input type="number" id="pricepre" class="form-control" name="pricepre" onkeyup="calu(this.value)">
</div>
</div>
<div class="form-group row">
<label for="pricesum" class="col-sm-2 col-form-label">ราคาพื้นที่ทั้งหมด</label>
<div class="col-sm-10">
<input type="text" id="pricesum" readonly class="form-control-plaintext">
</div>
</div>
</form>
</div>
<script>require('popper.js');</script>
<script>require('bootstrap');</script>
<script>
function check() {
var wv = document.getElementById("width").value;
var lv = document.getElementById("length").value;
var nv = document.getElementById("pricepre").value;
if (wv !== "" && lv !== "" && nv !== "") {
calu(document.getElementById("pricepre").value);
} else {
document.getElementById("pricesum").value = "";
}
}
function calu(price) {
var width = document.getElementById("width").value;
var length = document.getElementById("length").value;
if (document.getElementById("in").checked) {
var num = ((width / 39.37) * (length / 39.37)) * price;
document.getElementById("pricesum").value = num.toFixed(2);
}
else if (document.getElementById("cm").checked) {
var num = ((width / 100) * (length / 100)) * price;
document.getElementById("pricesum").value = num.toFixed(2);
}
else if (document.getElementById("m").checked) {
var num = (width * length) * price;
document.getElementById("pricesum").value = num.toFixed(2);
}
else {
alert("กรุณาเลือกหน่วยวัดความยาว");
document.getElementById("pricepre").value = "";
}
}
const customTitlebar = require('custom-electron-titlebar');
let MyTitleBar = new customTitlebar.Titlebar({
backgroundColor: customTitlebar.Color.fromHex('#444'),
maximizable: false,
shadow: true
});
const { remote } = require('electron')
const { Menu, MenuItem } = remote
const isMac = process.platform === 'darwin'
const menu = new Menu();
menu.append(new MenuItem({
label: 'เมนู',
submenu: [
isMac ? { label: 'ปิด', role: 'close' } : { label: 'ออก', role: 'quit' }
]
}));
menu.append(new MenuItem({
label: 'ช่วยเหลือ',
submenu: [
{
label: 'ติดตาม เฟสบุ๊ค',
click: async () => {
const { shell } = require('electron')
await shell.openExternal('https://www.facebook.com/QuadBCoder/')
}
}, {
label: 'สนับสนุน',
click: async () => {
const { shell } = require('electron')
await shell.openExternal('https://ko-fi.com/boyphongsakorn')
}
}
]
}));
MyTitleBar.updateMenu(menu);
MyTitleBar.updateTitle("โปรแกรมคำนวณราคาพื้นที่ต่อตารางเมตร");
</script>
</body>
</html>