-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathspeaking_part1.html
More file actions
365 lines (330 loc) · 17.2 KB
/
speaking_part1.html
File metadata and controls
365 lines (330 loc) · 17.2 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
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Speaking - Part 1</title>
<link rel="stylesheet" href="css/style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;700&display=swap" rel="stylesheet">
<link rel="icon" href="img/favicon.png" type="image/x-icon">
<!-- 1. Tích hợp CSS của Driver.js -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/driver.js@1.0.1/dist/driver.css"/>
<style>
/* CSS cho nút Help/Tour */
.tour-btn {
position: fixed;
bottom: 20px;
right: 20px;
background-color: #fff;
border: 1px solid #ddd;
color: #333;
width: 50px;
height: 50px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
z-index: 999;
font-size: 24px;
transition: transform 0.2s, background-color 0.2s;
}
.tour-btn:hover {
transform: scale(1.1);
background-color: #f8f9fa;
}
/* Tùy chỉnh giao diện Popover của Driver.js */
.driver-popover.driverjs-theme {
background-color: #fff;
color: #333;
border-radius: 8px;
padding: 15px;
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
max-width: 300px;
}
.driver-popover.driverjs-theme .driver-popover-title {
font-size: 18px;
font-weight: 700;
margin-bottom: 8px;
color: var(--primary-blue, #007bff);
}
.driver-popover.driverjs-theme .driver-popover-description {
font-size: 14px;
line-height: 1.5;
color: #555;
}
.driver-popover.driverjs-theme button {
background-color: var(--primary-blue, #007bff);
color: #fff;
text-shadow: none;
border: none;
border-radius: 4px;
padding: 6px 12px;
}
</style>
</head>
<body>
<header id="header-placeholder"></header>
<!-- 2. Nút kích hoạt lại Tour -->
<div class="tour-btn" id="restart-tour" title="Hướng dẫn sử dụng">❓</div>
<div class="content-pusher">
<div class="container">
<div class="page-intro">
<h1>Speaking - Part 1</h1>
<p>Luyện tập trả lời câu hỏi với đồng hồ bấm giờ</p>
</div>
<div class="explanation-box">
<h3>💡 Phương pháp luyện tập hiệu quả</h3>
<p>Trang web này mô phỏng điều kiện thi bằng cách cung cấp câu hỏi và đồng hồ đếm ngược. Vì trình duyệt
chưa hỗ trợ ghi âm trực tiếp, hãy làm theo các bước sau:</p>
<ul>
<li><strong>Bước 1:</strong> Mở ứng dụng ghi âm trên điện thoại của bạn.</li>
<li><strong>Bước 2:</strong> Trên trang web, nhấn nút "▶️ Bắt đầu trả lời" và bắt đầu ghi âm trên
điện thoại cùng lúc.</li>
<li><strong>Bước 3:</strong> Trả lời câu hỏi trong khoảng thời gian cho phép. Đồng hồ sẽ giúp bạn
kiểm soát độ dài câu trả lời.</li>
<li><strong>Bước 4:</strong> Sau khi hoàn thành, bạn có thể tải file ghi âm (MP3) lên các công cụ AI
như Google Studio, ChatGPT-4o, hoặc các dịch vụ sửa bài nói chuyên dụng để nhận feedback.</li>
</ul>
</div>
<div class="method-guide-card" style="margin-bottom: 30px;">
<h2>Chiến lược thi Part 1</h2>
<p>Bạn sẽ trả lời 3 câu hỏi cá nhân, mỗi câu trong 30 giây. Mục tiêu là trả lời trôi chảy và phát triển
ý một cách tự nhiên.</p>
<h4>Chiến lược trong phòng thi:</h4>
<ul>
<li><strong>Đừng lo lắng về thời gian:</strong> 30 giây là đủ dài. Khi thấy đồng hồ đếm ngược, hãy
giữ bình tĩnh, hít thở sâu và tập trung vào câu hỏi.</li>
<li><strong>Sử dụng "Bàn tay 5W1H":</strong> Nếu "bí" ý, hãy xòe bàn tay ra và tự hỏi:
<ul>
<li><strong>What?</strong> (Cái gì?)</li>
<li><strong>Where?</strong> (Ở đâu?)</li>
<li><strong>When?</strong> (Khi nào?)</li>
<li><strong>Who?</strong> (Với ai?)</li>
<li><strong>Why?</strong> (Tại sao?)</li>
<li><strong>How?</strong> (Như thế nào?)</li>
</ul>
Chỉ cần trả lời 2-3 trong số các câu hỏi này là bạn đã có một câu trả lời đầy đủ.
</li>
<li><strong>Đừng cố nhớ, hãy sáng tạo:</strong> Bạn không cần phải kể đúng 100% sự thật.</li>
<li> Hãy thoải mái <strong>"bịa" ra một câu chuyện ngắn</strong> sao cho nó phù hợp và dễ trả lời
nhất với câu hỏi được đề ra. Giám khảo chỉ quan tâm đến khả năng sử dụng tiếng Anh của bạn,
không phải tính xác thực của câu chuyện.</li>
</ul>
</div>
<div class="page-intro">
<p>Chọn một chủ đề để bắt đầu luyện tập</p>
</div>
<!-- BẢNG ĐIỀU KHIỂN CHỌN CHỦ ĐỀ -->
<div id="topic-selector-grid" class="topic-grid">
<!-- 37 nút sẽ được tự động chèn vào đây -->
</div>
<main id="speaking-container">
<!-- Chỉ một bài tập được hiển thị tại một thời điểm -->
</main>
</div>
<footer id="footer-placeholder"></footer>
</div>
<script src="js/main.js"></script>
<script src="js/data-speaking-part1.js"></script>
<!-- 3. Tích hợp Script của Driver.js -->
<script src="https://cdn.jsdelivr.net/npm/driver.js@1.0.1/dist/driver.js.iife.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
const selectorContainer = document.getElementById('topic-selector-grid');
const contentContainer = document.getElementById('speaking-container');
const topics = speakingPart1Data;
if (!topics || topics.length === 0) {
contentContainer.innerHTML = `<p class="error">Không có dữ liệu cho Speaking Part 1.</p>`;
return;
}
// --- GIAI ĐOẠN 1: CHỈ TẠO CÁC NÚT BẤM ---
topics.forEach((topic, index) => {
const button = document.createElement('button');
button.className = 'topic-selector-btn';
button.textContent = `Chủ đề ${index + 1}`;
button.dataset.index = index; // Lưu trữ chỉ số của chủ đề
selectorContainer.appendChild(button);
});
const allButtons = selectorContainer.querySelectorAll('.topic-selector-btn');
let activeTimer = null;
// --- GIAI ĐOẠN 2: HÀM TẠO CARD "THEO YÊU CẦU" ---
function renderTopicCard(index) {
// Xóa nội dung cũ trong container
contentContainer.innerHTML = '';
// Lấy dữ liệu của chủ đề được chọn
const topic = topics[index];
if (!topic) return;
// Tạo card nội dung
const card = document.createElement('div');
card.className = 'quiz-card speaking-card active'; // Thêm active để nó hiện ra ngay
// Thêm ID cho card để Driver.js có thể target chính xác
card.id = 'active-speaking-card';
const prompt = topic.prompt;
card.innerHTML = `
<div class="card-header">
<h2>${topic.title}</h2>
</div>
<div class="prompt-container">
<p class="prompt-question"><strong>Câu hỏi:</strong> ${prompt.question}</p>
<h4>Tự luyện tập:</h4>
<div class="timer-controls" id="timer-area">
<button class="action-btn start-timer-btn" data-duration="${prompt.duration}">▶️ Bắt đầu trả lời (Bấm giờ)</button>
<div class="timer-display"><span class="time-left">${prompt.duration}</span>s</div>
</div>
<div class="card-actions" style="margin-top: 25px; border-top: 1px dashed var(--border-color); padding-top: 25px;">
<button class="action-btn show-sample-btn" id="sample-btn">📖 Xem câu trả lời mẫu</button>
</div>
<div class="sample-answer-wrapper" style="display: none;">
<div class="sample-answer-container">
<h4>Nghe & Đọc câu trả lời mẫu:</h4>
<div class="audio-player-container"><audio controls class="custom-audio-player" src="${topic.audioSrc}"></audio></div>
<div class="sample-answer"><p>${prompt.sampleAnswer}</p></div>
</div>
</div>
</div>
`;
// Chèn card vừa tạo vào container
contentContainer.appendChild(card);
}
// GÁN SỰ KIỆN CLICK CHO CÁC NÚT
selectorContainer.addEventListener('click', function (e) {
if (e.target.classList.contains('topic-selector-btn')) {
// Bỏ active ở tất cả các nút
allButtons.forEach(btn => btn.classList.remove('active'));
// Thêm active cho nút được nhấn
e.target.classList.add('active');
// Lấy index và render card tương ứng
const topicIndex = parseInt(e.target.dataset.index, 10);
renderTopicCard(topicIndex);
}
});
// MẶC ĐỊNH HIỂN THỊ CHỦ ĐỀ ĐẦU TIÊN KHI TẢI TRANG
if (allButtons.length > 0) {
allButtons[0].classList.add('active');
renderTopicCard(0);
}
// --- KÍCH HOẠT TOUR HƯỚNG DẪN (Sau khi đã render card đầu tiên) ---
initSpeakingTour();
// LOGIC CHO TIMER VÀ NÚT XEM ĐÁP ÁN (hoạt động bên trong card)
contentContainer.addEventListener('click', function (e) {
if (e.target.classList.contains('start-timer-btn')) {
if (activeTimer) {
clearInterval(activeTimer.intervalId);
activeTimer.button.textContent = '▶️ Bắt đầu trả lời (Bấm giờ)';
activeTimer.button.disabled = false;
activeTimer.timeLeftEl.textContent = activeTimer.button.dataset.duration;
if (activeTimer.button === e.target) {
activeTimer = null;
return;
}
}
const button = e.target;
const duration = parseInt(button.dataset.duration, 10);
const timerDisplay = button.nextElementSibling;
const timeLeftEl = timerDisplay.querySelector('.time-left');
let timeLeft = duration;
timeLeftEl.textContent = timeLeft;
button.textContent = '⏱️ Đang đếm ngược...';
button.disabled = true;
const intervalId = setInterval(() => {
timeLeft--;
timeLeftEl.textContent = timeLeft;
if (timeLeft <= 0) {
clearInterval(intervalId);
button.textContent = 'Hết giờ! Bắt đầu lại';
button.disabled = false;
activeTimer = null;
}
}, 1000);
activeTimer = { button, intervalId, timeLeftEl };
}
if (e.target.classList.contains('show-sample-btn')) {
const button = e.target;
const wrapper = button.closest('.card-actions').nextElementSibling;
const isVisible = wrapper.style.display === 'block';
wrapper.style.display = isVisible ? 'none' : 'block';
button.textContent = isVisible ? '📖 Xem câu trả lời mẫu' : '🙈 Ẩn câu trả lời mẫu';
}
});
});
// HÀM KHỞI TẠO TOUR
function initSpeakingTour() {
const driver = window.driver.js.driver;
const driverObj = driver({
showProgress: true,
animate: true,
doneBtnText: 'Đã hiểu',
nextBtnText: 'Tiếp theo',
prevBtnText: 'Quay lại',
popoverClass: 'driverjs-theme',
steps: [
{
element: '.method-guide-card',
popover: {
title: 'Chiến thuật thi',
description: 'Đừng bỏ qua phần này! Đây là các mẹo (như phương pháp 5W1H) giúp bạn không bị bí ý tưởng khi thi thật.',
side: "bottom",
align: 'center'
}
},
{
element: '#topic-selector-grid',
popover: {
title: 'Chọn chủ đề',
description: 'Danh sách 37 chủ đề phổ biến nhất. Bạn có thể chọn bất kỳ số nào để luyện tập ngẫu nhiên.',
side: "top",
align: 'center'
}
},
{
element: '#active-speaking-card',
popover: {
title: 'Khu vực luyện tập',
description: 'Đây là câu hỏi chính. Hãy đọc kỹ câu hỏi trước khi bắt đầu.',
side: "top",
align: 'center'
}
},
{
element: '#timer-area',
popover: {
title: 'Đồng hồ bấm giờ',
description: 'Bấm nút này để bắt đầu đếm ngược 30 giây. Hãy cố gắng nói liên tục cho đến khi hết giờ.',
side: "top",
align: 'center'
}
},
{
element: '#sample-btn',
popover: {
title: 'Tham khảo',
description: 'Sau khi tự trả lời xong, hãy bấm vào đây để nghe và đọc bài mẫu Band điểm cao.',
side: "top",
align: 'center'
}
},
{
element: '#restart-tour',
popover: {
title: 'Hỗ trợ',
description: 'Bấm vào dấu hỏi này nếu bạn muốn xem lại hướng dẫn.',
side: "left",
align: 'center'
}
}
]
});
// Logic tự động chạy lần đầu
showTourHint('SpeakingPart1Tour', () => driverObj.drive());
// Gán sự kiện cho nút ?
document.getElementById('restart-tour').addEventListener('click', () => {
driverObj.drive();
});
}
</script>
</body>
</html>