-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathreading_part4.html
More file actions
356 lines (322 loc) · 15.1 KB
/
reading_part4.html
File metadata and controls
356 lines (322 loc) · 15.1 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
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reading - Part 4</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 bài tập Part 4 */
.quiz-card {
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
padding: 20px;
margin-bottom: 20px;
}
.part4-question {
margin-bottom: 15px;
padding-bottom: 15px;
border-bottom: 1px solid #eee;
}
.part4-question:last-child {
border-bottom: none;
}
.part4-options {
display: flex;
gap: 10px;
margin-top: 10px;
}
.option-btn {
width: 40px;
height: 40px;
border: 1px solid #ccc;
background: #fff;
border-radius: 50%;
cursor: pointer;
transition: all 0.2s;
font-weight: bold;
}
.option-btn:hover { background: #f0f0f0; }
.option-btn.selected {
background: #007bff;
color: #fff;
border-color: #007bff;
}
/* Feedback styles */
.correct { background-color: #d4edda !important; border-color: #c3e6cb !important; }
.incorrect { background-color: #f8d7da !important; border-color: #f5c6cb !important; }
.part4-question.correct .option-btn.selected { background-color: #28a745; border-color: #28a745; }
.part4-question.incorrect .option-btn.selected { background-color: #dc3545; border-color: #dc3545; }
.card-actions {
display: flex;
gap: 10px;
justify-content: center;
margin-top: 20px;
}
.answer-section {
margin-top: 20px;
padding: 15px;
background: #e2e3e5;
border-radius: 8px;
}
/* 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 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: 350px;
}
.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.6;
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>Reading - Part 4</h1>
<p>Nối câu hỏi với người nói tương ứng</p>
</div>
<div class="explanation-box">
<h3>💡 Phương pháp học Part 4</h3>
<p>Dạng bài này yêu cầu nối 7 câu hỏi với 4 người. Công cụ này sử dụng ký hiệu A, B, C, D để bạn dễ hình dung và học thuộc các liên kết.</p>
<p><strong>Lưu ý quan trọng:</strong>
<ul>
<li>Trong kỳ thi thật, <strong>họ sẽ dùng tên thật</strong> (ví dụ: John, Sarah, Emily, David) thay vì A, B, C, D.</li>
<li>Thứ tự các đoạn văn của những người này cũng sẽ bị <strong>xáo trộn ngẫu nhiên</strong>.</li>
<li><strong>Nhiệm vụ của bạn là nhớ các cặp đáp án đi chung với nhau</strong>.</li>
<!-- Đã thêm phần ví dụ minh họa -->
<li style="margin-top: 10px; background-color: #fff3cd; padding: 10px; border-radius: 5px; border-left: 4px solid #ffc107;">
<strong>Ví dụ minh họa cách tìm ý:</strong><br>
Nếu câu hỏi là <em>"Who thinks the park is a beautiful place to <strong>relax</strong>?"</em> (Ai nghĩ công viên là nơi đẹp để thư giãn?), hãy tìm trong bài đọc người có ý tương tự.<br>
👉 Nếu Người A nói: <em>"I need a beautiful place to <strong>relax</strong>"</em>, thì đáp án chính là <strong>A</strong>.
</li>
</ul>
</p>
</div>
<main id="quiz-container">
<!-- Nội dung Part 4 sẽ được chèn vào đây -->
</main>
</div>
<footer id="footer-placeholder"></footer>
</div>
<script src="js/main.js"></script>
<script src="js/data-reading-part4.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 quizContainer = document.getElementById('quiz-container');
// Kiểm tra dữ liệu
if (typeof readingPart4Data === 'undefined' || readingPart4Data.length === 0) {
quizContainer.innerHTML = `<p class="error">Không tìm thấy dữ liệu (readingPart4Data). Vui lòng kiểm tra file js/data-reading-part4.js</p>`;
return;
}
const topics = readingPart4Data;
topics.forEach((topic, index) => {
const card = document.createElement('div');
card.className = 'quiz-card part4-card';
let questionsHTML = '';
topic.questions.forEach((q, i) => {
questionsHTML += `
<div class="part4-question" data-correct-answer="${topic.key[i]}">
<p>${i + 1}. ${q}</p>
<div class="part4-options">
<button class="option-btn" data-choice="A">A</button>
<button class="option-btn" data-choice="B">B</button>
<button class="option-btn" data-choice="C">C</button>
<button class="option-btn" data-choice="D">D</button>
</div>
</div>
`;
});
card.innerHTML = `
<div class="card-header">
<h2>Đề bài ${index + 1}: ${topic.title}</h2>
</div>
<div class="part4-questions-container">${questionsHTML}</div>
<div class="feedback-message"></div>
<div class="card-actions">
<button class="action-btn check-answer-btn">Kiểm tra đáp án</button>
<button class="action-btn show-story-btn">Xem Key & Câu chuyện</button>
</div>
<div class="answer-section" style="display: none;">
<h4>Đáp án & Câu chuyện</h4>
<p><strong>Key đúng:</strong> ${topic.key.join(' - ')}</p>
<p><strong>Câu chuyện gợi nhớ:</strong> ${topic.story}</p>
</div>
`;
quizContainer.appendChild(card);
});
quizContainer.addEventListener('click', function(e) {
// Chọn đáp án
if (e.target.classList.contains('option-btn')) {
const parentOptions = e.target.parentElement;
parentOptions.querySelectorAll('.option-btn').forEach(btn => btn.classList.remove('selected'));
e.target.classList.add('selected');
}
// Kiểm tra đáp án
if (e.target.classList.contains('check-answer-btn')) {
const card = e.target.closest('.part4-card');
let correctCount = 0;
const questions = card.querySelectorAll('.part4-question');
questions.forEach(q => {
const selectedBtn = q.querySelector('.option-btn.selected');
const correctAnswer = q.dataset.correctAnswer;
q.classList.remove('correct', 'incorrect');
if (selectedBtn) {
if (selectedBtn.dataset.choice === correctAnswer) {
q.classList.add('correct');
correctCount++;
} else {
q.classList.add('incorrect');
}
}
});
const feedbackDiv = card.querySelector('.feedback-message');
feedbackDiv.innerHTML = `Bạn đã trả lời đúng <strong>${correctCount}/${questions.length}</strong> câu.`;
feedbackDiv.style.textAlign = "center";
feedbackDiv.style.marginTop = "15px";
feedbackDiv.style.fontWeight = "bold";
feedbackDiv.style.color = correctCount === questions.length ? "#28a745" : "#333";
}
// Xem key & câu chuyện
if (e.target.classList.contains('show-story-btn')) {
const answerSection = e.target.closest('.card-actions').nextElementSibling;
const isVisible = answerSection.style.display === 'block';
answerSection.style.display = isVisible ? 'none' : 'block';
}
});
// --- KÍCH HOẠT TOUR HƯỚNG DẪN ---
setTimeout(initReadingPart4Tour, 800);
});
// HÀM KHỞI TẠO TOUR CHO READING PART 4
function initReadingPart4Tour() {
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: '.explanation-box',
popover: {
title: 'Reading Part 4',
description: 'Phần này yêu cầu bạn nối 7 câu hỏi với 4 đoạn văn (A, B, C, D). Hãy đọc kỹ lưu ý về việc tên người có thể thay đổi.',
side: "bottom",
align: 'center'
}
},
{
element: '.part4-card:first-child',
popover: {
title: 'Bộ câu hỏi',
description: 'Mỗi chủ đề sẽ gồm 7 câu hỏi.',
side: "top",
align: 'center'
}
},
{
element: '.part4-card:first-child .part4-question:first-child .part4-options',
popover: {
title: 'Chọn đáp án',
description: 'Bấm vào một trong 4 ký tự A, B, C, D tương ứng với người/đoạn văn phù hợp.',
side: "left",
align: 'center'
}
},
{
element: '.part4-card:first-child .check-answer-btn',
popover: {
title: 'Kiểm tra',
description: 'Sau khi làm xong cả 7 câu, bấm nút này để xem kết quả. Màu xanh là đúng, màu đỏ là sai.',
side: "top",
align: 'center'
}
},
{
element: '.part4-card:first-child .show-story-btn',
popover: {
title: 'Mẹo ghi nhớ',
description: 'Bấm vào đây để xem toàn bộ đáp án (Key) và câu chuyện liên kết giúp bạn học thuộc nhanh hơn.',
side: "top",
align: 'center'
}
},
{
element: '#restart-tour',
popover: {
title: 'Hỗ trợ',
description: 'Bấm vào đây bất cứ lúc nào để xem lại hướng dẫn.',
side: "left",
align: 'center'
}
}
]
});
// Logic tự động chạy lần đầu cho Part 4
showTourHint('hasSeenReadingPart4Tour', () => driverObj.drive());
// Gán sự kiện cho nút ?
document.getElementById('restart-tour').addEventListener('click', () => {
driverObj.drive();
});
}
</script>
</body>
</html>