-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlabour.html
More file actions
399 lines (373 loc) · 14.9 KB
/
labour.html
File metadata and controls
399 lines (373 loc) · 14.9 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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Labour Law Trivia</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.4/gsap.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body, html {
height: 100%;
font-family: Arial, sans-serif;
color: white;
background-image: url('Indian-Polity.jpg');
overflow: hidden;
}
#game-screen, #end-screen {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
z-index: 10;
}
.content {
background: rgba(0, 0, 0, 0.7);
padding: 2rem;
border-radius: 10px;
text-align: center;
max-width: 800px;
width: 90%;
position: relative;
z-index: 1;
}
h1 {
font-size: 2.5rem;
margin-bottom: 1rem;
}
.btn {
background: #e50914;
color: white;
border: none;
padding: 0.8rem 1.5rem;
font-size: 1rem;
cursor: pointer;
margin: 0.5rem;
border-radius: 5px;
transition: background-color 0.3s;
}
.btn:hover {
background-color: #f40612;
}
.options {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin-top: 1rem;
}
.info-bar {
display: flex;
justify-content: space-between;
margin-bottom: 1rem;
}
#hint {
font-style: italic;
margin-top: 1rem;
}
.animation-element {
position: absolute;
z-index: 0;
}
#gavel {
width: 100px;
height: 100px;
top: 20px;
left: 20px;
}
#scale {
width: 120px;
height: 120px;
bottom: 20px;
right: 20px;
}
#book {
width: 80px;
height: 80px;
top: 50%;
left: 10px;
}
@media (max-width: 600px) {
h1 {
font-size: 1.8rem;
}
.btn {
font-size: 0.9rem;
padding: 0.6rem 1.2rem;
}
.animation-element {
width: 60px;
height: 60px;
}
}
#end-screen {
display: none; /* Initially hidden */
background-image: url('Indian-Polity.jpg');
background-size: cover;
background-position: center;
}
#final-score {
font-size: 2rem;
margin-bottom: 1rem;
}
.end-buttons {
display: flex;
justify-content: center;
gap: 1rem;
margin-top: 1rem;
}
.back-container {
z-index: 20; /* Ensure it's above the end screen */
}
.back-container {
display: flex;
justify-content: flex-start;
position: fixed;
top: 50%;
left: 20px;
transform: translateY(-50%);
width: auto;
z-index: 20; /* Ensure it's above the end screen */
}
.back-button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
text-decoration: none;
border-radius: 5px;
font-size: 16px;
}
.back-button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div id="game-screen">
<svg class="animation-element" id="gavel" viewBox="0 0 24 24">
<path fill="currentColor" d="M2.81,14.12L5.64,11.29L9.35,15L6.52,17.83L2.81,14.12M17.69,8.89L13.98,5.18L17.69,1.47L21.4,5.18L17.69,8.89M3.86,9.64L9.22,4.28L13.45,8.5L8.09,13.86L3.86,9.64M20.39,15.56L16.66,11.83L18.83,9.66L22.55,13.38L20.39,15.56M10.41,20.98L6.69,17.26L8.86,15.09L12.58,18.81L10.41,20.98Z" />
</svg>
<svg class="animation-element" id="scale" viewBox="0 0 24 24">
<path fill="currentColor" d="M12,3C10.73,3 9.6,3.8 9.18,5H3V7H4.95L2,14C1.53,16 3,17 5.5,17C8,17 9.56,16 9,14L6.05,7H9.17C9.5,7.85 10.15,8.5 11,8.83V20H2V22H22V20H13V8.82C13.85,8.5 14.5,7.85 14.82,7H17.95L15,14C14.53,16 16,17 18.5,17C21,17 22.56,16 22,14L19.05,7H21V5H14.83C14.4,3.8 13.27,3 12,3M12,5A1,1 0 0,1 13,6A1,1 0 0,1 12,7A1,1 0 0,1 11,6A1,1 0 0,1 12,5M5.5,10.25L7,14H4L5.5,10.25M18.5,10.25L20,14H17L18.5,10.25Z" />
</svg>
<svg class="animation-element" id="book" viewBox="0 0 24 24">
<path fill="currentColor" d="M18,22A2,2 0 0,0 20,20V4C20,2.89 19.1,2 18,2H12V9L9.5,7.5L7,9V2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18Z" />
</svg>
<div class="content">
<div class="info-bar">
<div>Score: <span id="score">0</span></div>
<div>Time: <span id="timer">30</span>s</div>
</div>
<h1 id="question"></h1>
<div class="options" id="options"></div>
<button id="hint-btn" class="btn">Get Hint</button>
<p id="hint"></p>
</div>
</div>
<!-- Back Button -->
<div class="back-container">
<a href="second.html" class="back-button">Back</a>
</div>
<div id="end-screen">
<div class="content">
<h1>Quiz Completed!</h1>
<div id="final-score"></div>
<div class="end-buttons">
<a href="index.html" class="btn">Back to Home</a>
<button id="play-again" class="btn">Play Again</button>
</div>
</div>
</div>
<script>
const questions = [
{
question: "What is the primary purpose of labor law?",
options: ["To regulate business transactions", "To protect the rights of workers and regulate employment", "To enforce criminal laws", "To manage public health"],
correct: 1,
hint: "These laws focus on the relationship between employers and employees."
},
{
question: "Which of the following is a right typically protected under labor law?",
options: ["Right to free speech", "Right to organize and form unions", "Right to bear arms", "Right to privacy"],
correct: 1,
hint: "This right allows workers to collectively bargain with employers."
},
{
question: "What is minimum wage?",
options: ["The maximum amount an employer can pay", "The lowest legal hourly wage that can be paid to workers", "A recommended wage for skilled labor", "A bonus given to employees"],
correct: 1,
hint: "This wage sets a floor for worker compensation."
},
{
question: "Which act regulates industrial disputes in India?",
options: ["Minimum Wages Act", "Industrial Disputes Act", "Employees' Provident Funds Act", "Factories Act"],
correct: 1,
hint: "This act provides a framework for resolving conflicts between employers and employees."
},
{
question: "What does collective bargaining refer to?",
options: ["Individual negotiations between an employer and employee", "A process where employees negotiate as a group with employers", "A legal process for resolving disputes", "A method of performance appraisal"],
correct: 1,
hint: "This process involves workers acting together to negotiate with management."
},
{
question: "Which of the following is considered an unfair labor practice?",
options: ["Allowing employees to unionize", "Discriminating against an employee for union activities", "Providing safety equipment to workers", "Offering overtime pay"],
correct: 1,
hint: "This practice violates workers' rights to organize and participate in union activities."
},
{
question: "What is the purpose of the Factories Act?",
options: ["To regulate environmental pollution", "To establish minimum safety and health standards in factories", "To determine wage rates", "To govern public transportation"],
correct: 1,
hint: "This act focuses on the well-being of workers in industrial settings."
},
{
question: "What is workplace harassment?",
options: ["Unfair treatment based on age or gender", "Bullying or unwanted behavior in the workplace", "Discrimination in hiring practices", "Poor working conditions"],
correct: 1,
hint: "This refers to inappropriate conduct that creates a hostile work environment."
},
{
question: "What does employment termination refer to?",
options: ["The process of hiring new employees", "The ending of an employee's contract by the employer or employee", "A temporary leave from work", "A probation period for new hires"],
correct: 1,
hint: "This is the formal process of ending the employment relationship."
},
{
question: "Which act provides for maternity benefits in India?",
options: ["Equal Remuneration Act", "Maternity Benefit Act", "Employees' State Insurance Act", "Industrial Disputes Act"],
correct: 1,
hint: "This act specifically addresses the rights of female employees during and after pregnancy."
}
];
let currentQuestion = 0;
let score = 0;
let timeLeft = 30;
let timer;
const questionEl = document.getElementById('question');
const optionsEl = document.getElementById('options');
const scoreEl = document.getElementById('score');
const timerEl = document.getElementById('timer');
const hintBtn = document.getElementById('hint-btn');
const hintEl = document.getElementById('hint');
const gavel = document.getElementById('gavel');
const scale = document.getElementById('scale');
const book = document.getElementById('book');
hintBtn.addEventListener('click', showHint);
let totalQuestions = questions.length;
function startGame() {
document.getElementById('game-screen').style.display = 'flex';
document.getElementById('end-screen').style.display = 'none';
currentQuestion = 0;
score = 0;
loadQuestion();
updateScore();
startTimer();
animateElements();
}
function endGame() {
clearInterval(timer);
document.getElementById('game-screen').style.display = 'none';
document.getElementById('end-screen').style.display = 'flex';
document.getElementById('final-score').textContent = `Your Score: ${score} / ${totalQuestions}`;
}
function loadQuestion() {
const question = questions[currentQuestion];
questionEl.textContent = question.question;
optionsEl.innerHTML = '';
hintEl.textContent = '';
question.options.forEach((option, index) => {
const button = document.createElement('button');
button.textContent = option;
button.classList.add('btn');
button.addEventListener('click', () => checkAnswer(index));
optionsEl.appendChild(button);
});
gsap.from(questionEl, {duration: 0.5, opacity: 0, y: -50});
gsap.from(optionsEl.children, {duration: 0.5, opacity: 0, y: 50, stagger: 0.1});
}
function checkAnswer(selectedIndex) {
const question = questions[currentQuestion];
if (selectedIndex === question.correct) {
score++;
updateScore();
gsap.to(scoreEl, {duration: 0.3, scale: 1.2, yoyo: true, repeat: 1});
}
currentQuestion++;
if (currentQuestion < questions.length) {
loadQuestion();
resetTimer();
} else {
endGame();
}
}
function showHint() {
hintEl.textContent = questions[currentQuestion].hint;
gsap.from(hintEl, {duration: 0.5, opacity: 0, y: 20});
}
function updateScore() {
scoreEl.textContent = score;
}
function startTimer() {
timeLeft = 30;
timer = setInterval(() => {
timeLeft--;
timerEl.textContent = timeLeft;
if (timeLeft <= 0) {
clearInterval(timer);
currentQuestion++;
if (currentQuestion >= questions.length) {
currentQuestion = 0;
}
loadQuestion();
resetTimer();
}
}, 1000);
}
function resetTimer() {
clearInterval(timer);
startTimer();
}
function animateElements() {
gsap.to(gavel, {
duration: 5,
rotation: 360,
x: "random(-50, 50)",
y: "random(-50, 50)",
repeat: -1,
yoyo: true,
ease: "sine.inOut"
});
gsap.to(scale, {
duration: 4,
rotation: -360,
x: "random(-30, 30)",
y: "random(-30, 30)",
repeat: -1,
yoyo: true,
ease: "sine.inOut"
});
gsap.to(book, {
duration: 6,
rotation: 720,
x: "random(-40, 40)",
y: "random(-40, 40)",
repeat: -1,
yoyo: true,
ease: "sine.inOut"
});
}
document.getElementById('play-again').addEventListener('click', startGame);
startGame();
</script>
</body>
</html>