Spaces:
Running
Running
Update index.html
Browse files- index.html +212 -261
index.html
CHANGED
@@ -1,315 +1,266 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
-
<html>
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
-
<
|
|
|
6 |
<style>
|
7 |
-
|
8 |
margin: 0;
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
display: flex;
|
12 |
justify-content: center;
|
13 |
align-items: center;
|
14 |
-
height: 100vh;
|
15 |
-
font-family: Arial;
|
16 |
-
color: white;
|
17 |
}
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
}
|
28 |
|
29 |
-
|
30 |
text-align: center;
|
|
|
|
|
|
|
31 |
}
|
32 |
|
33 |
-
.
|
34 |
-
|
35 |
-
margin:
|
36 |
-
|
37 |
-
cursor: pointer;
|
38 |
-
background: #333;
|
39 |
-
color: white;
|
40 |
-
border: 2px solid white;
|
41 |
-
border-radius: 5px;
|
42 |
}
|
43 |
|
44 |
-
.
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
left: 20px;
|
52 |
-
font-size: 24px;
|
53 |
}
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
font-size: 48px;
|
58 |
-
text-align: center;
|
59 |
-
display: none;
|
60 |
}
|
61 |
-
</style>
|
62 |
-
</head>
|
63 |
-
<body>
|
64 |
-
<div id="menu">
|
65 |
-
<h1>Space Shooter</h1>
|
66 |
-
<h2>Select Difficulty:</h2>
|
67 |
-
<button class="difficulty-btn" onclick="startGame('easy')">Easy</button>
|
68 |
-
<button class="difficulty-btn" onclick="startGame('medium')">Medium</button>
|
69 |
-
<button class="difficulty-btn" onclick="startGame('hard')">Hard</button>
|
70 |
-
</div>
|
71 |
-
<div id="score">Score: <span id="scoreValue">0</span></div>
|
72 |
-
<canvas id="gameCanvas" width="800" height="600"></canvas>
|
73 |
-
<div id="gameOver">Game Over!<br>Press R to Restart</div>
|
74 |
-
|
75 |
-
<script>
|
76 |
-
const canvas = document.getElementById('gameCanvas');
|
77 |
-
const ctx = canvas.getContext('2d');
|
78 |
-
const scoreEl = document.getElementById('scoreValue');
|
79 |
-
const gameOverEl = document.getElementById('gameOver');
|
80 |
-
const menuEl = document.getElementById('menu');
|
81 |
-
|
82 |
-
let audioCtx;
|
83 |
-
let player = {
|
84 |
-
x: canvas.width/2,
|
85 |
-
y: 500,
|
86 |
-
speed: 5,
|
87 |
-
size: 30
|
88 |
-
};
|
89 |
-
let bullets = [];
|
90 |
-
let enemies = [];
|
91 |
-
let score = 0;
|
92 |
-
let gameOver = false;
|
93 |
-
let keys = {
|
94 |
-
left: false,
|
95 |
-
right: false
|
96 |
-
};
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
playerSpeed: 5
|
103 |
-
},
|
104 |
-
medium: {
|
105 |
-
enemySpeed: 3,
|
106 |
-
spawnRate: 0.02,
|
107 |
-
playerSpeed: 6
|
108 |
-
},
|
109 |
-
hard: {
|
110 |
-
enemySpeed: 4,
|
111 |
-
spawnRate: 0.03,
|
112 |
-
playerSpeed: 7
|
113 |
-
}
|
114 |
-
};
|
115 |
-
|
116 |
-
let currentConfig;
|
117 |
-
|
118 |
-
function startGame(difficulty) {
|
119 |
-
menuEl.style.display = 'none';
|
120 |
-
canvas.style.display = 'block';
|
121 |
-
currentConfig = gameConfig[difficulty];
|
122 |
-
player.speed = currentConfig.playerSpeed;
|
123 |
-
resetGame();
|
124 |
-
if (!audioCtx) {
|
125 |
-
audio = setupAudio();
|
126 |
-
}
|
127 |
}
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
osc.type = 'square';
|
140 |
-
osc.frequency.setValueAtTime(freq, startTime);
|
141 |
-
|
142 |
-
gain.gain.setValueAtTime(0.1, startTime);
|
143 |
-
gain.gain.exponentialRampToValueAtTime(0.01, startTime + duration);
|
144 |
-
|
145 |
-
osc.start(startTime);
|
146 |
-
osc.stop(startTime + duration);
|
147 |
-
}
|
148 |
-
|
149 |
-
function playBGM() {
|
150 |
-
const notes = [440, 523, 659, 784];
|
151 |
-
setInterval(() => {
|
152 |
-
if (!gameOver) {
|
153 |
-
playNote(notes[Math.floor(Math.random() * notes.length)],
|
154 |
-
audioCtx.currentTime,
|
155 |
-
0.1);
|
156 |
-
}
|
157 |
-
}, 200);
|
158 |
-
}
|
159 |
-
|
160 |
-
function playShoot() {
|
161 |
-
playNote(880, audioCtx.currentTime, 0.1);
|
162 |
-
}
|
163 |
-
|
164 |
-
playBGM();
|
165 |
-
return { playShoot };
|
166 |
}
|
167 |
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
for (let i = 0; i < 5; i++) {
|
172 |
-
const angle = (i * 4 * Math.PI) / 5 - Math.PI / 2;
|
173 |
-
const x = player.x + player.size * Math.cos(angle);
|
174 |
-
const y = player.y + player.size * Math.sin(angle);
|
175 |
-
i === 0 ? ctx.moveTo(x, y) : ctx.lineTo(x, y);
|
176 |
-
}
|
177 |
-
ctx.closePath();
|
178 |
-
ctx.fill();
|
179 |
}
|
180 |
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
y: -30,
|
186 |
-
speed: currentConfig.enemySpeed
|
187 |
-
});
|
188 |
-
}
|
189 |
}
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
|
|
|
|
|
|
198 |
}
|
199 |
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
bullet.y -= 8;
|
205 |
-
return bullet.y > 0;
|
206 |
-
});
|
207 |
-
|
208 |
-
enemies = enemies.filter(enemy => {
|
209 |
-
enemy.y += enemy.speed;
|
210 |
-
|
211 |
-
if (Math.abs(enemy.x - player.x) < 30 &&
|
212 |
-
Math.abs(enemy.y - player.y) < 30) {
|
213 |
-
gameOver = true;
|
214 |
-
gameOverEl.style.display = 'block';
|
215 |
-
}
|
216 |
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
bullets.splice(bi, 1);
|
225 |
-
enemies.splice(ei, 1);
|
226 |
-
score += 100;
|
227 |
-
scoreEl.textContent = score;
|
228 |
-
}
|
229 |
-
});
|
230 |
-
});
|
231 |
|
232 |
-
|
|
|
233 |
}
|
234 |
|
235 |
-
|
236 |
-
|
|
|
|
|
237 |
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
bullets.forEach(bullet => {
|
242 |
-
ctx.fillRect(bullet.x - 2, bullet.y - 8, 4, 16);
|
243 |
-
});
|
244 |
-
|
245 |
-
ctx.font = '30px Arial';
|
246 |
-
enemies.forEach(enemy => {
|
247 |
-
ctx.fillText('🐱', enemy.x - 15, enemy.y + 10);
|
248 |
-
});
|
249 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
}
|
258 |
|
259 |
-
function
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
score = 0;
|
264 |
-
gameOver = false;
|
265 |
-
scoreEl.textContent = '0';
|
266 |
-
gameOverEl.style.display = 'none';
|
267 |
-
gameLoop();
|
268 |
-
}
|
269 |
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
}
|
275 |
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
if (e.key.toLowerCase() === 'r') {
|
281 |
-
returnToMenu();
|
282 |
-
}
|
283 |
-
return;
|
284 |
-
}
|
285 |
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
});
|
298 |
-
if (audio) audio.playShoot();
|
299 |
-
break;
|
300 |
}
|
301 |
-
}
|
302 |
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
}
|
312 |
-
}
|
313 |
</script>
|
314 |
</body>
|
315 |
</html><script async data-explicit-opt-in="true" data-cookie-opt-in="true" src="https://vercel.live/_next-live/feedback/feedback.js"></script>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>RC4 Encoder/Decoder</title>
|
7 |
<style>
|
8 |
+
* {
|
9 |
margin: 0;
|
10 |
+
padding: 0;
|
11 |
+
box-sizing: border-box;
|
12 |
+
font-family: -apple-system, system-ui, sans-serif;
|
13 |
+
}
|
14 |
+
|
15 |
+
body {
|
16 |
+
min-height: 100vh;
|
17 |
+
background: linear-gradient(45deg, #1a1c20, #2d3436);
|
18 |
+
color: #fff;
|
19 |
+
padding: 20px;
|
20 |
display: flex;
|
21 |
justify-content: center;
|
22 |
align-items: center;
|
|
|
|
|
|
|
23 |
}
|
24 |
|
25 |
+
.container {
|
26 |
+
width: 100%;
|
27 |
+
max-width: 800px;
|
28 |
+
background: rgba(255, 255, 255, 0.05);
|
29 |
+
padding: 2rem;
|
30 |
+
border-radius: 12px;
|
31 |
+
backdrop-filter: blur(10px);
|
32 |
+
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
|
33 |
}
|
34 |
|
35 |
+
h1 {
|
36 |
text-align: center;
|
37 |
+
margin-bottom: 2rem;
|
38 |
+
color: #00ff9d;
|
39 |
+
font-size: 2rem;
|
40 |
}
|
41 |
|
42 |
+
.tabs {
|
43 |
+
display: flex;
|
44 |
+
margin-bottom: 2rem;
|
45 |
+
border-bottom: 2px solid rgba(255, 255, 255, 0.1);
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
|
48 |
+
.tab {
|
49 |
+
padding: 1rem 2rem;
|
50 |
+
cursor: pointer;
|
51 |
+
background: none;
|
52 |
+
border: none;
|
53 |
+
color: #fff;
|
54 |
+
font-size: 1rem;
|
55 |
+
opacity: 0.6;
|
56 |
+
transition: all 0.3s;
|
57 |
}
|
58 |
|
59 |
+
.tab.active {
|
60 |
+
opacity: 1;
|
61 |
+
border-bottom: 2px solid #00ff9d;
|
|
|
|
|
62 |
}
|
63 |
|
64 |
+
.input-group {
|
65 |
+
margin-bottom: 1.5rem;
|
|
|
|
|
|
|
66 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
+
label {
|
69 |
+
display: block;
|
70 |
+
margin-bottom: 0.5rem;
|
71 |
+
color: #00ff9d;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
|
74 |
+
textarea, input {
|
75 |
+
width: 100%;
|
76 |
+
padding: 1rem;
|
77 |
+
background: rgba(255, 255, 255, 0.05);
|
78 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
79 |
+
border-radius: 8px;
|
80 |
+
color: #fff;
|
81 |
+
font-size: 1rem;
|
82 |
+
transition: all 0.3s;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
}
|
84 |
|
85 |
+
textarea {
|
86 |
+
min-height: 120px;
|
87 |
+
resize: vertical;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
|
90 |
+
textarea:focus, input:focus {
|
91 |
+
outline: none;
|
92 |
+
border-color: #00ff9d;
|
93 |
+
background: rgba(255, 255, 255, 0.1);
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
|
96 |
+
button {
|
97 |
+
width: 100%;
|
98 |
+
padding: 1rem;
|
99 |
+
background: #00ff9d;
|
100 |
+
border: none;
|
101 |
+
border-radius: 8px;
|
102 |
+
color: #1a1c20;
|
103 |
+
font-size: 1rem;
|
104 |
+
font-weight: bold;
|
105 |
+
cursor: pointer;
|
106 |
+
transition: all 0.3s;
|
107 |
}
|
108 |
|
109 |
+
button:hover {
|
110 |
+
background: #00cc7d;
|
111 |
+
transform: translateY(-2px);
|
112 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
+
.result {
|
115 |
+
margin-top: 1.5rem;
|
116 |
+
padding: 1rem;
|
117 |
+
background: rgba(255, 255, 255, 0.05);
|
118 |
+
border-radius: 8px;
|
119 |
+
word-break: break-all;
|
120 |
+
min-height: 60px;
|
121 |
+
}
|
122 |
|
123 |
+
@keyframes fadeIn {
|
124 |
+
from { opacity: 0; transform: translateY(10px); }
|
125 |
+
to { opacity: 1; transform: translateY(0); }
|
126 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
+
.show {
|
129 |
+
animation: fadeIn 0.3s ease-out;
|
130 |
}
|
131 |
|
132 |
+
@media (max-width: 600px) {
|
133 |
+
.container {
|
134 |
+
padding: 1rem;
|
135 |
+
}
|
136 |
|
137 |
+
.tab {
|
138 |
+
padding: 0.8rem 1rem;
|
139 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
}
|
141 |
+
</style>
|
142 |
+
</head>
|
143 |
+
<body>
|
144 |
+
<div class="container">
|
145 |
+
<h1>RC4 Encoder/Decoder</h1>
|
146 |
+
|
147 |
+
<div class="tabs">
|
148 |
+
<button class="tab active" onclick="switchTab('decode')" id="decodeTab">Decode</button>
|
149 |
+
<button class="tab" onclick="switchTab('encode')" id="encodeTab">Encode</button>
|
150 |
+
</div>
|
151 |
+
|
152 |
+
<div id="decodeSection">
|
153 |
+
<div class="input-group">
|
154 |
+
<label>Base64 Encoded Text:</label>
|
155 |
+
<textarea id="decodeInput" placeholder="Enter base64 encoded text..."></textarea>
|
156 |
+
</div>
|
157 |
+
|
158 |
+
<div class="input-group">
|
159 |
+
<label>RC4 Key:</label>
|
160 |
+
<input type="text" id="decodeKey" placeholder="Enter RC4 key...">
|
161 |
+
</div>
|
162 |
+
|
163 |
+
<button onclick="decode()">Decode</button>
|
164 |
+
<div class="result" id="decodeResult"></div>
|
165 |
+
</div>
|
166 |
+
|
167 |
+
<div id="encodeSection" style="display: none;">
|
168 |
+
<div class="input-group">
|
169 |
+
<label>Text to Encode:</label>
|
170 |
+
<textarea id="encodeInput" placeholder="Enter text to encode..."></textarea>
|
171 |
+
</div>
|
172 |
+
|
173 |
+
<div class="input-group">
|
174 |
+
<label>RC4 Key:</label>
|
175 |
+
<input type="text" id="encodeKey" placeholder="Enter RC4 key...">
|
176 |
+
</div>
|
177 |
+
|
178 |
+
<button onclick="encode()">Encode</button>
|
179 |
+
<div class="result" id="encodeResult"></div>
|
180 |
+
</div>
|
181 |
+
</div>
|
182 |
|
183 |
+
<script>
|
184 |
+
function rc4(key, str) {
|
185 |
+
let s = [], j = 0, x, res = '';
|
186 |
+
for (let i = 0; i < 256; i++) {
|
187 |
+
s[i] = i;
|
188 |
+
}
|
189 |
+
for (let i = 0; i < 256; i++) {
|
190 |
+
j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;
|
191 |
+
x = s[i];
|
192 |
+
s[i] = s[j];
|
193 |
+
s[j] = x;
|
194 |
}
|
195 |
+
let i = 0;
|
196 |
+
j = 0;
|
197 |
+
for (let y = 0; y < str.length; y++) {
|
198 |
+
i = (i + 1) % 256;
|
199 |
+
j = (j + s[i]) % 256;
|
200 |
+
x = s[i];
|
201 |
+
s[i] = s[j];
|
202 |
+
s[j] = x;
|
203 |
+
res += String.fromCharCode(str.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);
|
204 |
+
}
|
205 |
+
return res;
|
206 |
}
|
207 |
|
208 |
+
function decode() {
|
209 |
+
const input = document.getElementById('decodeInput').value;
|
210 |
+
const key = document.getElementById('decodeKey').value;
|
211 |
+
const result = document.getElementById('decodeResult');
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
+
try {
|
214 |
+
const decodedBase64 = atob(input);
|
215 |
+
const decryptedText = rc4(key, decodedBase64);
|
216 |
+
|
217 |
+
result.textContent = decryptedText;
|
218 |
+
result.classList.remove('show');
|
219 |
+
void result.offsetWidth;
|
220 |
+
result.classList.add('show');
|
221 |
+
} catch (e) {
|
222 |
+
result.textContent = 'Error: Invalid input or key';
|
223 |
+
result.classList.add('show');
|
224 |
+
}
|
225 |
}
|
226 |
|
227 |
+
function encode() {
|
228 |
+
const input = document.getElementById('encodeInput').value;
|
229 |
+
const key = document.getElementById('encodeKey').value;
|
230 |
+
const result = document.getElementById('encodeResult');
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
+
try {
|
233 |
+
const encryptedText = rc4(key, input);
|
234 |
+
const encodedBase64 = btoa(encryptedText);
|
235 |
+
|
236 |
+
result.textContent = encodedBase64;
|
237 |
+
result.classList.remove('show');
|
238 |
+
void result.offsetWidth;
|
239 |
+
result.classList.add('show');
|
240 |
+
} catch (e) {
|
241 |
+
result.textContent = 'Error: Invalid input or key';
|
242 |
+
result.classList.add('show');
|
|
|
|
|
|
|
243 |
}
|
244 |
+
}
|
245 |
|
246 |
+
function switchTab(tab) {
|
247 |
+
const decodeSection = document.getElementById('decodeSection');
|
248 |
+
const encodeSection = document.getElementById('encodeSection');
|
249 |
+
const decodeTab = document.getElementById('decodeTab');
|
250 |
+
const encodeTab = document.getElementById('encodeTab');
|
251 |
+
|
252 |
+
if (tab === 'decode') {
|
253 |
+
decodeSection.style.display = 'block';
|
254 |
+
encodeSection.style.display = 'none';
|
255 |
+
decodeTab.classList.add('active');
|
256 |
+
encodeTab.classList.remove('active');
|
257 |
+
} else {
|
258 |
+
decodeSection.style.display = 'none';
|
259 |
+
encodeSection.style.display = 'block';
|
260 |
+
decodeTab.classList.remove('active');
|
261 |
+
encodeTab.classList.add('active');
|
262 |
}
|
263 |
+
}
|
264 |
</script>
|
265 |
</body>
|
266 |
</html><script async data-explicit-opt-in="true" data-cookie-opt-in="true" src="https://vercel.live/_next-live/feedback/feedback.js"></script>
|