-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
403 lines (365 loc) · 14 KB
/
index.html
File metadata and controls
403 lines (365 loc) · 14 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
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>SharpINT Docs</title>
<script type="module">
// Importar las funciones necesarias del SDK de Firebase
import { initializeApp } from "https://www.gstatic.com/firebasejs/12.0.0/firebase-app.js";
import { getAuth, createUserWithEmailAndPassword, signInWithEmailAndPassword, signOut, onAuthStateChanged } from "https://www.gstatic.com/firebasejs/12.0.0/firebase-auth.js";
import { getFirestore, collection, addDoc, onSnapshot, orderBy, query, serverTimestamp } from "https://www.gstatic.com/firebasejs/12.0.0/firebase-firestore.js";
// Configuración de Firebase
const firebaseConfig = {
apiKey: "AIzaSyBnW3Yh0k79PVdkzg1Y1FJH9XGtPfkXRPg",
authDomain: "deltarune-shitpost-page.firebaseapp.com",
projectId: "deltarune-shitpost-page",
storageBucket: "deltarune-shitpost-page.firebasestorage.app",
messagingSenderId: "996411698644",
appId: "1:996411698644:web:9d08505dac98273022ba41"
};
// Inicializar Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const db = getFirestore(app);
// Formularios y elementos
const registroDiv = document.getElementById('registro');
const loginDiv = document.getElementById('login');
const foroDiv = document.getElementById('foro');
const mensajerosDiv = document.getElementById('mensajes');
const emailRegistro = document.getElementById('emailRegistro');
const passwordRegistro = document.getElementById('passwordRegistro');
const emailLogin = document.getElementById('emailLogin');
const passwordLogin = document.getElementById('passwordLogin');
// Función para iniciar sesión
document.getElementById('iniciarSesionBtn').addEventListener('click', async () => {
const email = emailLogin.value;
const password = passwordLogin.value;
try {
const userCredential = await signInWithEmailAndPassword(auth, email, password);
console.log("Usuario iniciado sesión:", userCredential.user);
loginDiv.style.display = 'none';
foroDiv.style.display = 'block';
} catch (error) {
console.error("Error al iniciar sesión:", error);
}
});
// Función para registrarse
document.getElementById('registrarseBtn').addEventListener('click', async () => {
const email = emailRegistro.value;
const password = passwordRegistro.value;
try {
const userCredential = await createUserWithEmailAndPassword(auth, email, password);
console.log("Usuario registrado:", userCredential.user);
registroDiv.style.display = 'none';
loginDiv.style.display = 'block';
} catch (error) {
console.error("Error al registrarse:", error);
}
});
// Función para cerrar sesión
document.getElementById('cerrarSesionBtn').addEventListener('click', async () => {
try {
await signOut(auth);
console.log("Sesión cerrada");
loginDiv.style.display = 'block';
foroDiv.style.display = 'none';
} catch (error) {
console.error("Error al cerrar sesión:", error);
}
});
// Comprobar si el usuario está autenticado
onAuthStateChanged(auth, user => {
if (user) {
foroDiv.style.display = 'block'; // Mostrar foro si el usuario está autenticado
loginDiv.style.display = 'none'; // Ocultar login
registroDiv.style.display = 'none'; // Ocultar registro
} else {
foroDiv.style.display = 'none'; // Ocultar foro si no está autenticado
loginDiv.style.display = 'block'; // Mostrar login
registroDiv.style.display = 'none'; // Asegurarse de ocultar el formulario de registro
}
});
// Manejar el formulario de mensaje en el foro
const foroForm = document.getElementById('foroForm');
foroForm.addEventListener('submit', async (event) => {
event.preventDefault();
const nombre = document.getElementById('nombre').value;
const mensaje = document.getElementById('mensaje').value;
// Verificar si el usuario está autenticado
const user = auth.currentUser;
if (!user) {
alert("Debes iniciar sesión para publicar un mensaje.");
return;
}
// Guardar el mensaje en Firestore
if (nombre && mensaje) {
try {
await addDoc(collection(db, "mensajes"), {
nombre: nombre,
mensaje: mensaje,
timestamp: serverTimestamp(),
uid: user.uid // Guardar el ID del usuario para referencia futura
});
console.log("Mensaje guardado con éxito!");
document.getElementById('nombre').value = '';
document.getElementById('mensaje').value = '';
} catch (error) {
console.error("Error al guardar el mensaje: ", error);
}
} else {
alert("Por favor, completa ambos campos.");
}
});
// Escuchar los mensajes en tiempo real
const q = query(collection(db, "mensajes"), orderBy("timestamp", "asc"));
onSnapshot(q, (snapshot) => {
mensajerosDiv.innerHTML = '';
snapshot.forEach((doc) => {
const mensajeData = doc.data();
const mensajeElement = document.createElement('div');
mensajeElement.classList.add('mensaje');
mensajeElement.innerHTML = `
<strong>${mensajeData.nombre}</strong>: ${mensajeData.mensaje}<br>
<small>Publicado el ${new Date(mensajeData.timestamp.seconds * 1000).toLocaleString()}</small><br><br>
`;
mensajerosDiv.appendChild(mensajeElement);
});
});
</script>
<style>
body {
margin: 0;
background: #11121a;
color: #fff;
font-family: 'Ubuntu Mono', 'Ubuntu Light', arial, monospace;
}
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
background: #0d1117;
padding: 0.5rem 1rem;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.navbar-left {
display: flex;
align-items: center;
gap: 1rem;
}
.navbar-logo {
width: 30px;
height: 30px;
background: #fff;
border-radius: 5px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 0.5rem;
}
.navbar-logo img {
width: 24px;
height: 24px;
}
.navbar-title {
font-weight: bold;
color: #8aff80;
font-size: 1.2rem;
text-decoration: none;
}
.navbar-categories {
display: flex;
align-items: center;
gap: 1rem;
}
.navbar-link {
color: #fff;
text-decoration: none;
font-size: 1rem;
transition: color 0.2s;
}
.navbar-link:hover {
color: #8aff80;
}
.navbar-right {
display: flex;
align-items: center;
gap: 0.75rem;
}
.navbar-icon {
background: #23272f;
border: none;
border-radius: 4px;
padding: 0.5em;
color: #fff;
cursor: pointer;
font-size: 1rem;
}
.navbar-profile {
width: 32px;
height: 32px;
border-radius: 50%;
background: linear-gradient(135deg, #8aff80 40%, #bd34fe 100%);
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 1em;
}
.btn-windows {
display: inline-flex; /* Para alinear icono y texto */
align-items: center;
gap: 8px;
background-color: #21265b; /* Fondo azul oscuro */
color: white; /* Texto blanco */
padding: 10px 16px;
border-radius: 8px;
text-decoration: none; /* Quita subrayado */
font-weight: 600;
font-family: arial;
cursor: pointer;
user-select: none;
border: none; /* Sin borde */
transition: background-color 0.3s;
}
.btn-windows:hover {
background-color: #2e348f; /* Color más claro al hover */
}
.mensaje {
border-bottom: 1px solid #ccc;
padding: 10px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<nav class="navbar">
<div class="navbar-left">
<div class="navbar-logo">
<img src="https://avatars.githubusercontent.com/u/161966183?s=400&u=31eace7386cd10628e198e2e87dcbfdcc3800155&v=4" alt="Logo" />
</div>
<a href="https://sharpint.github.io" class="navbar-title">Home</a>
<div class="navbar-categories">
<a href="https://sharpint.github.io/docs" class="navbar-link">Docs</a>
<a href="https://sharpint.github.io/info" class="navbar-link">Info</a>
<a href="https://sharpint.github.io/sm" class="navbar-link">Social Media</a>
<a href="https://sharpint.github.io/drshitpost" class="navbar-link">DR Shitpost</a>
</div>
</div>
<div class="navbar-right">
<button class="navbar-icon">🔍</button>
<button class="navbar-icon">➕</button>
</div>
</nav>
<main style="padding: 1rem;">
<h1>Documentation</h1>
<p>Welcome to the SharpINT documentation page. Here you can add guides, FAQs, and other resources.</p>
<section>
<h2>Getting Started, Open Source Meme Upload</h2>
<p>You can just send the meme to my dm of Discord! .1mtassinggtv OR using the form in the bottom</p>
<b>For discord: Go to discord -> add friend -> .1mtassinggtv and wait some time</b>
<b>For cloudinary: Use the button Upload Meme to Cloudinary</b>
</section>
<section>
<h1>My mod: OXIDEDTALE</h1>
<p>OXIDEDTALE is a mod that makes frisk oxided, and also, changes some strings, Try out name with the button below!</p>
<a href="ruta/del/archivo.exe" download class="btn-windows">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="white" viewBox="0 0 24 24">
<rect x="1" y="3" width="10" height="7" />
<rect x="12" y="3" width="10" height="7" />
<rect x="1" y="12" width="10" height="9" />
<rect x="12" y="12" width="10" height="9" />
</svg>
Download for Windows
</a>
</section>
<section>
<h2>Submit Your Meme</h2>
<form id="memeForm">
<label for="memeImage">Select an image:</label><br/>
<input type="file" id="memeImage" accept="image/*" required /><br/><br/>
<label for="memeDesc">Description (optional):</label><br/>
<input type="text" id="memeDesc" maxlength="100" placeholder="e.g.: The best meme of Deltarune" /><br/><br/>
<button type="button" id="uploadButton">Upload Meme to Cloudinary</button>
</form>
<div id="message"></div>
</section>
<!-- Script para cargar el widget -->
<script src="https://upload-widget.cloudinary.com/global/all.js" type="text/javascript"></script>
<script>
// Esperamos que el usuario haga clic en el botón para abrir el widget
document.getElementById('uploadButton').addEventListener('click', function() {
cloudinary.openUploadWidget(
{
cloudName: 'di8p0gzhr', // Tu Cloud Name
uploadPreset: 'chetos',
folder: 'memes', // La carpeta en Cloudinary donde se almacenarán los memes
sources: ['local', 'url', 'camera'],
showAdvancedOptions: false,
cropping: false,
multiple: false
},
function(error, result) {
if (result && result.event === 'success') {
// Guardamos la URL de la imagen subida
uploadedImageUrl = result.info.secure_url;
document.getElementById('message').innerHTML = 'Image uploaded successfully!';
console.log(result.info);
} else if (error) {
document.getElementById('message').innerHTML = 'Error uploading image.';
console.log(error);
}
}
);
});
</script>
<h2>Foro - Preguntas y Respuestas</h2>
<form id="foroForm">
<!-- Formulario de registro -->
<div id="registro">
<h3>Regístrate</h3>
<input type="email" id="emailRegistro" placeholder="Correo electrónico" required><br><br>
<input type="password" id="passwordRegistro" placeholder="Contraseña" required><br><br>
<button id="registrarseBtn">Registrarse</button>
</div>
<!-- Formulario de login -->
<div id="login" style="display: none;">
<h3>Inicia sesión</h3>
<input type="email" id="emailLogin" placeholder="Correo electrónico" required><br><br>
<input type="password" id="passwordLogin" placeholder="Contraseña" required><br><br>
<button id="iniciarSesionBtn">Iniciar sesión</button>
</div>
<!-- Formulario del foro, solo visible cuando el usuario esté autenticado -->
<div id="foro" style="display: none;">
<h3>Publicar un mensaje</h3>
<input type="text" id="nombre" placeholder="Tu nombre" required><br><br>
<textarea id="mensaje" placeholder="Escribe tu mensaje" required></textarea><br><br>
<button type="submit">Publicar</button>
</form>
<button id="publicarBtn">Publicar</button>
<button id="cerrarSesionBtn">Cerrar sesión</button>
</div>
<div id="mensajes">
<!-- Los mensajes se cargarán aquí -->
</div>
<script>
cloudinary.api.resources({
type: 'upload',
<script>
cloudinary.api.resources({
type: 'upload',
prefix: 'memes/', // Nombre de la carpeta
resource_type: 'image',
max_results: 100 // O el número que necesites
}, function(result) {
const memesContainer = document.getElementById('memes-container');
result.resources.forEach(function(image) {
const imgElement = document.createElement('img');
imgElement.src = image.secure_url; // URL de la imagen
memesContainer.appendChild(imgElement);
});
});
</script>
<footer style="background: #0d1117; color: #aaa; text-align: center; padding: 1rem; font-size: 0.9rem; margin-top: 2rem;">
© SharpINT 2025 | <a href="https://github.com/sharpint" style="color: #8aff80; text-decoration: none;">GitHub</a>
</footer>
</body>