-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
187 lines (155 loc) · 4.75 KB
/
index.html
File metadata and controls
187 lines (155 loc) · 4.75 KB
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
<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<title>Smart Panel - แผงควบคุมบ้าน</title>
<style>
body {
font-family: 'Segoe UI', sans-serif;
margin: 0;
padding: 0;
background: linear-gradient(to right, #1e3c72, #2a5298);
color: #fff;
}
.panel {
max-width: 700px;
margin: 40px auto;
background: #ffffff20;
border-radius: 15px;
padding: 30px;
box-shadow: 0 10px 25px rgba(0,0,0,0.3);
backdrop-filter: blur(12px);
}
h1 {
text-align: center;
margin-bottom: 20px;
color: #ffda44;
}
.buttons {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
gap: 15px;
}
.btn {
padding: 15px 25px;
border: none;
border-radius: 10px;
cursor: pointer;
font-size: 16px;
font-weight: bold;
transition: all 0.3s ease;
color: white;
min-width: 120px;
}
.btn-lock {
background-color: #007bff;
}
.btn-auto {
background-color: #28a745;
}
.btn-file {
background-color: #ffc107;
color: black;
}
.btn-run {
background-color: #dc3545;
}
.btn:hover {
transform: scale(1.05);
opacity: 0.9;
}
.status-box {
margin-top: 25px;
background-color: #00000033;
padding: 15px;
border-radius: 10px;
}
.status-box p {
margin: 8px 0;
}
.success-message {
margin-top: 20px;
padding: 12px;
border-radius: 8px;
background-color: #4caf50;
color: white;
display: none;
animation: fadeIn 0.5s ease-in-out;
}
.file-input {
display: none;
margin-top: 15px;
}
.file-name {
margin-top: 10px;
background-color: #ffffff33;
padding: 10px;
border-radius: 8px;
font-size: 14px;
color: #fff;
display: none;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
</style>
</head>
<body>
<div class="panel">
<h1>แผงควบคุมอัจฉริยะ</h1>
<div class="buttons">
<button class="btn btn-lock" onclick="toggleLock()">🔒 ล็อก</button>
<button class="btn btn-auto" onclick="toggleAuto()">⚙️ Auto</button>
<button class="btn btn-file" onclick="triggerFileInput()">📁 เลือกไฟล์ ZIP</button>
<button class="btn btn-run" onclick="triggerRun()">📱 Run</button>
</div>
<div class="status-box">
<p id="lockStatus">สถานะล็อก: ❌ ปลดล็อก</p>
<p id="autoStatus">ระบบอัตโนมัติ: ❌ ปิดอยู่</p>
</div>
<!-- input ไฟล์ zip -->
<input type="file" accept=".zip" id="zipInput" class="file-input" onchange="handleZipFile(event)">
<!-- แสดงชื่อไฟล์ที่เลือก -->
<div class="file-name" id="fileName"></div>
<!-- แสดงข้อความสำเร็จเมื่อกด Run -->
<div class="success-message" id="successMessage">✅ ท่านสำเร็จ!</div>
<!-- เสียงกระดิ่ง -->
<audio id="dingSound" src="https://www.soundjay.com/buttons/sounds/button-3.mp3" preload="auto"></audio>
</div>
<script>
let isLocked = false;
let isAuto = false;
function toggleLock() {
isLocked = !isLocked;
document.getElementById("lockStatus").innerText = "สถานะล็อก: " + (isLocked ? "✅ ล็อกแล้ว" : "❌ ปลดล็อก");
}
function toggleAuto() {
isAuto = !isAuto;
document.getElementById("autoStatus").innerText = "ระบบอัตโนมัติ: " + (isAuto ? "✅ เปิดอยู่" : "❌ ปิดอยู่");
}
function triggerFileInput() {
document.getElementById("zipInput").click();
}
function handleZipFile(event) {
const file = event.target.files[0];
const fileNameBox = document.getElementById("fileName");
if (file && file.name.endsWith(".zip")) {
fileNameBox.innerText = `📦 ไฟล์ที่เลือก: ${file.name}`;
fileNameBox.style.display = 'block';
} else {
fileNameBox.innerText = "⚠️ กรุณาเลือกไฟล์ .zip เท่านั้น";
fileNameBox.style.display = 'block';
}
}
function triggerRun() {
const success = document.getElementById("successMessage");
const sound = document.getElementById("dingSound");
success.style.display = 'block';
sound.currentTime = 0;
sound.play();
}
</script>
</body>
</html>