-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdev.html
190 lines (166 loc) · 6.37 KB
/
dev.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="emulator, games, unblocked, gaming, game website, nintendo ds emulator, etc.">
<title>RJsGamesV2</title>
<!-- Styles and Fonts -->
<link rel="stylesheet" href="head/styles.css">
<link rel="icon" type="image/png" href="head/RJs Games.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
<style>
#particles-js {
position: absolute;
width: 100vw;
height: 100vh;
top: 0;
left: 0;
z-index: -2;
overflow: hidden;
}
#particles-fade {
position: absolute;
top: 8vw;
background-image: linear-gradient(rgba(0, 0, 0, 0), var(--background-color));
width: 100vw;
height: 92vh;
z-index: -1;
}
.random-button-container {
margin-top: 20px;
}
</style>
</head>
<body>
<!-- Particle container -->
<div id="particles-js"></div>
<div id="particles-fade"></div>
<!-- Header and Navigation -->
<div id="header">
<h1><a href="#" id="title">RJsGamesV2</a></h1>
<div class="nav-links">
<a href="#games">Games</a>
<a href="#faq">FAQ</a>
<a href="#changelog">Changelog</a>
<input type="text" id="search" placeholder="Search for a game...">
<button id="theme-toggle">☀️</button>
</div>
</div>
<!-- Dropdown for settings -->
<div id="dropdown">
<h2>Settings</h2>
<label>
<input type="checkbox" id="particles-toggle" checked> Show Particles
</label>
</div>
<!-- Game buttons container -->
<div class="random-button-container">
<button id="random-game">Random Game 🎲</button>
</div>
<div class="container"></div>
<!-- Sections for FAQ and Changelog -->
<div id="faq" class="section">
<h2>FAQ</h2>
<p><b>Q: Why isn't my game working on mobile?</b></p>
<p>A: Sometimes, switching to desktop mode can resolve interaction issues.</p>
<p><b>Q: How can I provide feedback?</b></p>
<p>A: Visit our <a href="https://github.com/MajesticWafer/wafercafe/">GitHub</a> and create an issue.</p>
</div>
<div id="changelog" class="section">
<h2>Changelog</h2>
<p>New homepage created.</p>
<ul>
<li>Light/Dark mode</li>
<li>Game search bar</li>
<li>New button layout</li>
<li>Button name overlay on hover</li>
<li>FAQ and changelog sections added</li>
</ul>
</div>
<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
const particlesToggle = document.getElementById('particles-toggle');
const particlesContainer = document.getElementById('particles-js');
const title = document.getElementById('title');
const dropdown = document.getElementById('dropdown');
const themeToggle = document.getElementById('theme-toggle');
// Load and save particles setting in localStorage
const savedParticlesSetting = JSON.parse(localStorage.getItem('particlesEnabled')) ?? true;
particlesToggle.checked = savedParticlesSetting;
particlesContainer.style.display = savedParticlesSetting ? 'block' : 'none';
particlesToggle.addEventListener('change', function () {
const isChecked = particlesToggle.checked;
particlesContainer.style.display = isChecked ? 'block' : 'none';
localStorage.setItem('particlesEnabled', JSON.stringify(isChecked));
});
title.addEventListener('click', function () {
dropdown.classList.toggle('open');
});
// Function to load particles based on theme
function loadParticles(theme) {
const particlesConfig = theme === 'light-mode' ? 'dark-particles.json' : 'light-particles.json';
particlesJS.load('particles-js', `head/${particlesConfig}`, function() {
console.log(`Particles.js config (${particlesConfig}) loaded`);
});
}
// Theme toggle functionality
const savedTheme = localStorage.getItem('theme') || 'dark-mode';
document.body.classList.add(savedTheme);
themeToggle.textContent = savedTheme === 'light-mode' ? '🌙' : '☀️';
loadParticles(savedTheme);
themeToggle.addEventListener('click', function () {
const isLightMode = document.body.classList.toggle('light-mode');
const newTheme = isLightMode ? 'light-mode' : 'dark-mode';
localStorage.setItem('theme', newTheme);
themeToggle.textContent = isLightMode ? '🌙' : '☀️';
loadParticles(newTheme);
});
// Random game function
document.getElementById('random-game').addEventListener('click', function () {
const games = document.querySelectorAll('.button-container');
const randomGame = games[Math.floor(Math.random() * games.length)];
const onClickValue = randomGame.getAttribute('onclick');
const url = onClickValue.match(/location\.href='([^']+)'/)[1];
window.location.href = url;
});
});
// Load game buttons dynamically from games.json
window.onload = function() {
fetch('games.json')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText);
}
return response.json();
})
.then(data => {
const games = data.games;
const container = document.querySelector('.container');
Object.keys(games).forEach(gameName => {
const gameLink = games[gameName];
const buttonContainer = document.createElement('div');
buttonContainer.classList.add('button-container');
buttonContainer.setAttribute('onclick', `location.href='${gameLink}/'`);
const img = document.createElement('img');
img.src = `/${gameLink}/img.jpeg`;
img.alt = gameName;
const span = document.createElement('span');
span.classList.add('button-text');
span.textContent = gameName;
buttonContainer.appendChild(img);
buttonContainer.appendChild(span);
container.appendChild(buttonContainer);
});
})
.catch(error => {
console.error('There was a problem with the fetch operation:', error);
});
};
</script>
</body>
</html>