-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.java
More file actions
58 lines (45 loc) · 2.04 KB
/
Copy pathscript.java
File metadata and controls
58 lines (45 loc) · 2.04 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
// JavaScript for the Game Top-Up Website
document.addEventListener('DOMContentLoaded', () => {
// Event listener for all "Top Up Now" buttons
const buttons = document.querySelectorAll('.btn-primary');
buttons.forEach(button => {
button.addEventListener('click', (event) => {
event.preventDefault();
// Simulate fetching game ID or showing a form
const gameTitle = button.closest('.card').querySelector('.card-title').textContent;
const userID = prompt(`Enter your ID for ${gameTitle}:`);
if (userID) {
alert(`Processing top-up for ${gameTitle} with ID: ${userID}`);
// Add logic to send this data to a backend or process the top-up
} else {
alert('Top-up canceled. Please enter a valid ID.');
}
});
});
});
const slider = document.querySelector('.banner-slider');
let index = 0;
const slides = document.querySelectorAll('.slide');
const totalSlides = slides.length;
function slideNext() {
index = (index + 1) % totalSlides;
slider.style.transform = `translateX(-${index * 100}%)`;
}
setInterval(slideNext, 3000); // Slide setiap 3 detik
function showGames(category) {
const games = {
popular: ['images/emel.jpg', 'images/epep.jpg', 'images/hok.png', 'images/pubg.jpg'],
new: ['images/CODM.jpg', 'images/game-new2.jpg', 'images/game-new3.jpg', 'images/game-new4.jpg'],
mobile: ['images/game-mobile1.jpg', 'images/game-mobile2.jpg', 'images/game-mobile3.jpg', 'images/game-mobile4.jpg'],
pc: ['images/game-pc1.jpg', 'images/game-pc2.jpg', 'images/game-pc3.jpg', 'images/game-pc4.jpg']
};
const game1 = document.getElementById('game1');
const game2 = document.getElementById('game2');
const game3 = document.getElementById('game3');
const game4 = document.getElementById('game4');
game1.src = games[category][0];
game2.src = games[category][1];
game3.src = games[category][2];
game4.src = games[category][3];
}
}