Compare commits

...

2 Commits

Author SHA1 Message Date
414178b437 Merge branch 'main' of https://git-eng.ukwms.ac.id/2526-web/Kelompok02-Memory-Card 2025-12-16 11:24:48 +07:00
Evelyn
9af82122b5 leaderboard.js 2025-12-16 11:24:46 +07:00
3 changed files with 32 additions and 30 deletions

View File

@ -1,37 +1,36 @@
// LOGIKA MUSIK // LOGIKA MUSIK
const musicBtn = document.getElementById('musicBtn'); const musicBtn = document.getElementById('musicBtn');
const bgMusic = document.getElementById('bgMusic'); const bgMusic = document.getElementById('bgMusic');
let isMusicPlaying = false; let isMusicPlaying = false;
musicBtn.addEventListener('click', () => { musicBtn.addEventListener('click', () => {
isMusicPlaying ? bgMusic.pause() : bgMusic.play(); isMusicPlaying ? bgMusic.pause() : bgMusic.play();
musicBtn.innerText = isMusicPlaying ? '🔇' : '🔊'; musicBtn.innerText = isMusicPlaying ? '🔇' : '🔊';
isMusicPlaying = !isMusicPlaying; isMusicPlaying = !isMusicPlaying;
}); });
// NAVIGATION // NAVIGATION (Ini yang penting, sudah .php)
function selectStage(stage) { function selectStage(stage) {
window.location.href = "gameboard-" + stage + ".html"; window.location.href = "gameboard-" + stage + ".php";
} }
document.getElementById("leaderboardBtn").addEventListener("click", () => { // OVERLAY CREDITS
window.location.href = "Leaderboard.html"; function openCredits() {
}); document.getElementById('creditsOverlay').style.display = 'flex';
}
// OVERLAY CREDITS function closeCredits() {
function openCredits() { document.getElementById('creditsOverlay').style.display = 'none';
document.getElementById('creditsOverlay').style.display = 'flex'; }
}
function closeCredits() { // LOGOUT
document.getElementById('creditsOverlay').style.display = 'none'; document.getElementById("logoutBtn").addEventListener("click", () => {
} window.location.href = "logout.php";
});
// Karena JS eksternal mungkin tidak tahu lokasi logout.php, kita bantu disini // LEADERBOARD (Cukup ditulis satu kali saja)
document.getElementById("logoutBtn").addEventListener("click", () => { document.getElementById("leaderboardBtn").addEventListener("click", () => {
window.location.href = "logout.php"; // Pastikan file aslinya bernama Leaderboard.html
}); // Kalau sudah diubah jadi PHP, ganti jadi "Leaderboard.php"
window.location.href = "Leaderboard.html";
document.getElementById("leaderboardBtn").addEventListener("click", () => { });
window.location.href = "Leaderboard.html"; // Atau Leaderboard.php jika sudah diubah
});

View File

@ -7,6 +7,7 @@ exit();
} }
$user = $_SESSION['user']; $user = $_SESSION['user'];
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>

View File

@ -60,10 +60,12 @@ $roleIcon = ($roleRaw === 'admin') ? '👑' : '🎮';
<span class="icon">😊</span> <span class="icon">😊</span>
<h3>Easy Mode</h3> <h3>Easy Mode</h3>
</button> </button>
<button class="stage-btn" onclick="selectStage('medium')"> <button class="stage-btn" onclick="selectStage('medium')">
<span class="icon">🤔</span> <span class="icon">🤔</span>
<h3>Medium Mode</h3> <h3>Medium Mode</h3>
</button> </button>
<button class="stage-btn" onclick="selectStage('hard')"> <button class="stage-btn" onclick="selectStage('hard')">
<span class="icon">😤</span> <span class="icon">😤</span>
<h3>Hard Mode</h3> <h3>Hard Mode</h3>