-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
268 lines (240 loc) Β· 10.3 KB
/
script.js
File metadata and controls
268 lines (240 loc) Β· 10.3 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
document.addEventListener('DOMContentLoaded', () => {
const cards = document.querySelectorAll('.etiquette-card');
const achievementBanner = document.getElementById('achievementBanner');
let achievementShown = {}; // Track shown achievements
cards.forEach(card => {
const checkboxes = card.querySelectorAll('input[type="checkbox"]');
const progressCircle = card.querySelector('.progress-circle');
const progressText = card.querySelector('.progress-text');
// Update progress when checkbox is clicked
checkboxes.forEach(checkbox => {
checkbox.addEventListener('change', () => {
updateProgress(card, checkboxes, progressCircle, progressText);
});
});
});
function updateProgress(card, checkboxes, progressCircle, progressText) {
const total = checkboxes.length;
const checked = Array.from(checkboxes).filter(checkbox => checkbox.checked).length;
const progress = Math.round((checked / total) * 100);
const category = card.dataset.category;
// Update progress circle
progressCircle.setAttribute('data-progress', progress);
progressCircle.style.setProperty('--progress', progress);
progressText.textContent = `${progress}%`;
// Rotate progress circle border
progressCircle.style.transform = `rotate(${progress * 3.6}deg)`;
// Show achievement banner only when category is completed for the first time
if (progress === 100 && !achievementShown[category]) {
showAchievement(category);
achievementShown[category] = true; // Mark this achievement as shown
}
}
function showAchievement(category) {
// Hide any existing achievement banner first
achievementBanner.classList.remove('show');
// Wait a brief moment before showing new achievement
setTimeout(() => {
const achievementText = achievementBanner.querySelector('.achievement-text');
achievementText.textContent = `${category.charAt(0).toUpperCase() + category.slice(1)} Master Achievement Unlocked!`;
achievementBanner.classList.add('show');
// Hide banner after 3 seconds
setTimeout(() => {
achievementBanner.classList.remove('show');
}, 3000);
}, 100);
}
// Add hover animation to cards
cards.forEach(card => {
card.addEventListener('mouseenter', () => {
card.style.transform = 'translateY(-10px)';
});
card.addEventListener('mouseleave', () => {
card.style.transform = 'translateY(0)';
});
});
});
const learningContent = {
email: {
title: "Email & Communication Skills",
modules: [
{
title: "Professional Email Writing",
content: `
<div class="lesson-content">
<h3>Key Elements of Professional Emails</h3>
<ul>
<li>Clear and concise subject lines</li>
<li>Professional greetings and closings</li>
<li>Proper formatting and structure</li>
</ul>
<div class="example-box">
<h4>Example:</h4>
<pre>
Subject: Project Update: Q3 Marketing Campaign
Dear Mr. Johnson,
I hope this email finds you well. I'm writing to provide an update on the Q3 marketing campaign progress.
[Content]
Best regards,
Jane Smith
</pre>
</div>
<div class="practice-exercise">
<h4>Quick Exercise:</h4>
<p>Identify the issues in this email:</p>
<pre class="incorrect-example">
hey there!
just wanted 2 check if ur free 2morrow 4 the meeting???
thx
</pre>
<button class="show-answer-btn">Show Answer</button>
<div class="answer" style="display: none;">
Issues:
- Informal greeting
- Text message style writing
- Missing proper structure
- No signature
</div>
</div>
</div>
`
},
{
title: "Meeting Communication",
content: `
<div class="lesson-content">
<h3>Effective Meeting Communication</h3>
<div class="tips-section">
<h4>Before the Meeting:</h4>
<ul>
<li>Review the agenda</li>
<li>Prepare relevant materials</li>
<li>Test technical equipment</li>
</ul>
<h4>During the Meeting:</h4>
<ul>
<li>Active listening</li>
<li>Clear and concise speaking</li>
<li>Professional body language</li>
</ul>
</div>
<div class="interactive-scenario">
<h4>Scenario Practice:</h4>
<p>You need to present a project update. Choose the best approach:</p>
<div class="scenario-options">
<button class="option" data-correct="false">
Wing it and speak off the cuff
</button>
<button class="option" data-correct="true">
Prepare key points and supporting data
</button>
<button class="option" data-correct="false">
Read directly from detailed notes
</button>
</div>
</div>
</div>
`
}
// Add more modules as needed
]
},
workplace: {
title: "Workplace Behavior",
modules: [
{
title: "Office Etiquette",
content: `
<div class="lesson-content">
<h3>Professional Workplace Conduct</h3>
<div class="do-dont-section">
<div class="dos">
<h4>Do's:</h4>
<ul>
<li>Respect others' space and time</li>
<li>Maintain a clean workspace</li>
<li>Be punctual</li>
</ul>
</div>
<div class="donts">
<h4>Don'ts:</h4>
<ul>
<li>Have loud personal conversations</li>
<li>Eat strong-smelling foods at desk</li>
<li>Interrupt meetings unnecessarily</li>
</ul>
</div>
</div>
<div class="case-study">
<h4>Case Study:</h4>
<p>How would you handle this situation?</p>
<div class="scenario">
A colleague consistently plays music without headphones...
</div>
<div class="solution-options">
<!-- Add interactive options -->
</div>
</div>
</div>
`
}
]
}
// Add more categories as needed
};
function openLearningModule(category) {
const modal = document.getElementById('learningModal');
const content = learningContent[category];
let currentModule = 0;
// Set up modal content
document.getElementById('modalTitle').textContent = content.title;
updateContent();
updateProgress();
// Show modal
modal.classList.add('show');
// Event listeners
document.querySelector('.close-modal').onclick = () => {
modal.classList.remove('show');
};
document.getElementById('nextBtn').onclick = () => {
if (currentModule < content.modules.length - 1) {
currentModule++;
updateContent();
updateProgress();
}
};
document.getElementById('prevBtn').onclick = () => {
if (currentModule > 0) {
currentModule--;
updateContent();
updateProgress();
}
};
function updateContent() {
const learningContent = document.getElementById('learningContent');
learningContent.innerHTML = content.modules[currentModule].content;
// Set up interactive elements
setupInteractiveElements();
}
function updateProgress() {
const progress = ((currentModule + 1) / content.modules.length) * 100;
document.getElementById('moduleProgress').style.width = `${progress}%`;
}
function setupInteractiveElements() {
// Set up show/hide answers
document.querySelectorAll('.show-answer-btn').forEach(btn => {
btn.onclick = function() {
const answer = this.nextElementSibling;
answer.style.display = answer.style.display === 'none' ? 'block' : 'none';
};
});
// Set up scenario options
document.querySelectorAll('.scenario-options .option').forEach(option => {
option.onclick = function() {
const isCorrect = this.dataset.correct === 'true';
this.classList.add(isCorrect ? 'correct' : 'incorrect');
// Add feedback animation/message
};
});
}
}