-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfase-protection.js
More file actions
27 lines (23 loc) · 814 Bytes
/
fase-protection.js
File metadata and controls
27 lines (23 loc) · 814 Bytes
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
// fase-protection.js
(function () {
const progress = JSON.parse(localStorage.getItem('quizProgress')) || {
easy: true,
medium: false,
hard: false,
expert: false
};
const path = window.location.pathname;
// Protege páginas de nível
if (path.includes('nivel_2.html') && !progress.medium) {
alert("Você ainda não desbloqueou a fase MÉDIA.");
window.location.href = "fases.html";
}
if (path.includes('nivel_3.html') && !progress.hard) {
alert("Você ainda não desbloqueou a fase DIFÍCIL.");
window.location.href = "fases.html";
}
if (path.includes('nivel_4.html') && !progress.expert) {
alert("Você ainda não desbloqueou a fase EXPERT.");
window.location.href = "fases.html";
}
})();