-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.html
582 lines (527 loc) · 18.4 KB
/
view.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
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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="google-adsense-account" content="ca-pub-4711764274538281" />
<title id="pageTitle">View mods</title>
<meta property="og:type" content="article" />
<meta property="og:title" content="Default OG Title" />
<meta property="og:description" content="Default OG Description" />
<meta property="og:url" content="https://example.com" />
<meta property="og:image" content="https://example.com/default-image.jpg" />
<meta
property="article:published_time"
content="2023-12-11T05:35:48+00:00"
/>
<meta name="keywords" content="default, keywords, here" />
<link
rel="icon"
href="https://i.ibb.co/dMxZSX2/20231003-050505-1-min-1.png"
/>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<style>
body {
font-family: "Arial", sans-serif;
animation: colorChange 5s ease-in-out infinite alternate;
background: radial-gradient(
circle,
rgb(97, 78, 245),
rgba(249, 161, 244, 0.404)
);
color: #333;
margin: 0;
padding: 0;
}
@keyframes colorChange {
0% {
background-color: rgba(97, 78, 245, 0.8);
}
50% {
background-color: rgba(249, 161, 244, 0.404);
}
100% {
background-color: rgba(97, 78, 245, 0.8);
}
}
/* Navbar glassmorphism effect */
.navbar {
background: rgba(255, 255, 255, 0.025);
backdrop-filter: blur(10px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}
@font-face {
font-family: "RubikScribble";
src: url("fonts/RubikGlitch-Regular.ttf");
}
/* Navbar glassmorphism effect */
.navbar {
background: rgba(255, 255, 255, 0.025);
backdrop-filter: blur(10px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}
.navbar-brand {
margin-left: 10px;
font-family: "RubikScribble";
font-size: 30px;
letter-spacing: 3px;
}
.navbar-nav .nav-link {
color: #ffffff;
font-weight: bold;
}
/* Glassmorphism effect for Table */
.glass-table {
background: rgba(255, 255, 255, 0.274);
border-radius: 10px;
padding: 20px;
margin: 20px auto;
backdrop-filter: blur(10px);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
width: 90%; /* Adjust the width as needed */
max-width: 800px; /* Increased max-width for larger screens */
overflow: hidden;
}
/* Table row styles */
.glass-table tr {
display: flex;
flex-direction: row;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
/* Header cell styles */
.glass-table th {
background-color: rgba(255, 255, 255, 0.1);
padding: 15px; /* Increased padding for header cells */
text-align: left;
flex: 1;
width: 50%;
}
/* Content cell styles */
.glass-table td {
background-color: rgba(255, 255, 255, 0.05);
padding: 15px; /* Increased padding for content cells */
flex: 1;
width: 50%;
}
/* Main Banner Image */
.main-image {
margin-top: 80px; /* Adjust top margin for better visibility */
width: 90%;
max-width: 1200px;
margin-left: auto;
margin-right: auto;
border-radius: 10px;
max-width: 50%;
height: auto;
}
/* Media query for larger screens */
@media (min-width: 1200px) {
.main-image {
width: 60%;
}
}
/* Media query for smaller screens */
@media (max-width: 767px) {
.main-image {
max-width: 100%;
height: auto;
}
}
/* Sub Images */
.sub-image {
max-width: 70%;
height: auto;
}
/* Media query for smaller screens */
@media (max-width: 768px) {
.main-image {
max-width: 100%;
height: auto;
}
.sub-image {
max-width: 100%;
height: auto;
}
}
/* Main Banner Image */
.main-image {
max-width: 100%;
height: auto;
}
/* Sub Images */
.sub-image {
max-width: 70%;
height: auto;
}
/* Media query for smaller screens */
@media (max-width: 768px) {
.main-image {
max-width: 100%;
height: auto;
}
.sub-image {
max-width: 100%;
height: auto;
}
}
.btn-lg {
border: 2px solid #ffffffc1;
padding: 12px 30px; /* Adjust padding to increase button size */
font-size: 16px; /* Increase font size for larger text */
/* Other styles as needed */
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark fixed-top">
<div
class="container-fluid d-flex justify-content-between align-items-center"
>
<div>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="index.html">Kmax Mods</a>
</div>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#tab-about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="dmca.html">DMCA</a>
</li>
</ul>
<form class="d-flex ms-auto" id="searchForm">
<input
class="form-control me-2"
type="search"
id="searchInput"
placeholder="Search"
aria-label="Search"
/>
<button
class="btn btn-outline-light"
type="button"
onclick="searchRedirect()"
>
Search
</button>
</form>
</div>
</div>
</nav>
<!-- Main Banner Image -->
<div id="mods-container"></div>
<footer class="text-center py-4">
<p>© 2023 Kmax Mods. All rights reserved.</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.6.0/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.6.0/firebase-app-check-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.6.0/firebase-database-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.6.0/firebase-storage-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.6.0/firebase-auth-compat.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js"></script>
<script src="https://www.google.com/recaptcha/api.js?render=6Lf1a0cpAAAAAKKFphrD4cd6bd47UTso6Pxo-t03"></script>
<script>
// Firebase Configuration
const firebaseConfig = {
apiKey: "AIzaSyDoiDU6sWAYe-d2AM44OQm_2j2gxXR0Gqk",
authDomain: "project-kmax.firebaseapp.com",
databaseURL: "https://project-kmax-default-rtdb.firebaseio.com",
projectId: "project-kmax",
storageBucket: "project-kmax.appspot.com",
messagingSenderId: "984425559296",
appId: "1:984425559296:web:5f78740bd7b2829d872fe5",
measurementId: "G-DS1MYSDJPC",
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
const appCheck = firebase.appCheck();
appCheck.activate("6Lf1a0cpAAAAAKKFphrD4cd6bd47UTso6Pxo-t03", true);
const db = firebase.database();
const modsRef = db.ref("mods");
// Function to load and display a specific mod based on the ID from URL
function loadModById(id) {
modsRef.once("value", function (snapshot) {
var mods = snapshot.val();
if (mods && mods[id]) {
var mod = mods[id];
// Provided timestamp
const providedTimestamp = mod.timestamp;
// Convert provided timestamp to milliseconds
const providedDate = new Date(providedTimestamp);
// Current date
const currentDate = new Date();
// Calculate the difference in milliseconds
const difference = currentDate - providedDate;
// Calculate different time units
const minutesAgo = Math.floor(difference / (1000 * 60));
const hoursAgo = Math.floor(difference / (1000 * 60 * 60));
const daysAgo = Math.floor(difference / (1000 * 60 * 60 * 24));
const weeksAgo = Math.floor(difference / (1000 * 60 * 60 * 24 * 7));
const monthsAgo = Math.floor(
difference / (1000 * 60 * 60 * 24 * 30)
);
const yearsAgo = Math.floor(
difference / (1000 * 60 * 60 * 24 * 365)
);
// Determine the most relevant time unit
let output;
if (yearsAgo > 0) {
output = `${yearsAgo} year${yearsAgo > 1 ? "s" : ""} ago`;
} else if (monthsAgo > 0) {
output = `${monthsAgo} month${monthsAgo > 1 ? "s" : ""} ago`;
} else if (weeksAgo > 0) {
output = `${weeksAgo} week${weeksAgo > 1 ? "s" : ""} ago`;
} else if (daysAgo > 0) {
output = `${daysAgo} day${daysAgo > 1 ? "s" : ""} ago`;
} else if (hoursAgo > 0) {
output = `${hoursAgo} hour${hoursAgo > 1 ? "s" : ""} ago`;
} else if (minutesAgo > 0) {
output = `${minutesAgo} minute${minutesAgo > 1 ? "s" : ""} ago`;
} else {
output = "Just now";
}
console.log(output); // Output the most relevant time unit
document.getElementById("pageTitle").innerText = mod.title;
var modDiv = document.createElement("div");
modDiv.className = "new";
// JSON-LD structured data
var jsonLD = {
"@context": "https://schema.org",
"@type": "SoftwareApplication",
name: mod.title,
applicationCategory: "Game",
operatingSystem: "Android",
offers: {
"@type": "Offer",
price: "Free",
availability: "https://schema.org/InStock",
},
image: [mod.main_image, mod.sub_image_1, mod.sub_image_2],
description: mod.paragraph1,
author: {
"@type": "Person",
name: mod.author,
},
publisher: {
"@type": "Organization",
name: mod.publisher,
},
version: mod.version,
// Add more relevant fields from your mod data
};
var jsonLDScript = document.createElement("script");
jsonLDScript.type = "application/ld+json";
jsonLDScript.text = JSON.stringify(jsonLD);
modDiv.appendChild(jsonLDScript);
modDiv.innerHTML = `
<div class="text-center" id="wow">
<img
class="main-image img-fluid"
src="${mod.main_image}"
alt="Main Image Description"
/>
</div>
<!-- Table with Glassmorphism Effect -->
<div class="glass-table">
<table class="table table-borderless vertical-table">
<!-- Sample data, replace with actual mod info -->
<tbody>
<tr>
<th>App Name</th>
<td>${mod.title}</td>
</tr>
<tr>
<th>Publisher</th>
<td>${mod.publisher}</td>
</tr>
<tr>
<th>Genre</th>
<td>${mod.genre}</td>
</tr>
<tr>
<th>Size</th>
<td>${mod.size}</td>
</tr>
<tr>
<th>Version</th>
<td>${mod.version}</td>
</tr>
<tr>
<th>MOD Info</th>
<td>${mod.modInfo}</td>
</tr>
<th>Last Updated</th>
<td>${output}</td>
</tr>
<!-- You can add more rows with mod info here -->
</tbody>
</table>
</div>
<!-- Download Button -->
<div class="text-center mt-4">
<a href="${mod.downloadLink}" target="_blank" class="btn btn-primary btn-lg">Download</a>
</div>
<!-- Small Paragraph -->
<div class="glass-table p-4 mt-4">
<p>${mod.paragraph1}</p>
</div>
<!-- Another Image -->
<div class="glass-table mt-4 text-center" id="sub-image1">
<img
class="sub-image img-fluid"
src="${mod.sub_image_1}"
alt="Sub Image 1 Description"
/>
</div>
<!-- Another Small Paragraph -->
<div class="glass-table p-4 mt-4">
<p>${mod.paragraph2}</p>
</div>
<!-- Another Image -->
<div class="glass-table mt-4 text-center" id="sub-image2">
<img
class="sub-image img-fluid"
src="${mod.sub_image_2}"
alt="Sub Image 2 Description"
/>
</div>
<!-- Another Small Paragraph -->
<div class="glass-table p-4 mt-4">
<p>${mod.paragraph3}</p>
</div>
<!-- Second Download Button -->
<div class="text-center mt-4">
<a href="${mod.downloadLink}" target="_blank" class="btn btn-primary btn-lg">Download</a>
</div>
`;
document.getElementById("mods-container").appendChild(modDiv);
} else {
// Redirect to 404.html if the mod with the specified ID doesn't exist
window.location.href = "404.html";
}
});
}
// Get the 'id' parameter from URL
const urlParams = new URLSearchParams(window.location.search);
const id = urlParams.get("id");
// Load mod based on the ID from URL
if (id) {
loadModById(id);
} else {
// Redirect to 404.html if 'id' parameter is missing
window.location.href = "404.html";
}
// Function to update meta tags
function updateMetaTags(mod) {
try {
const timestamp = mod.timestamp;
const keywords = mod.keywords;
console.log(keywords);
const date = new Date(timestamp);
const now = date.toISOString();
document.title = mod.title; // Update page title
// Update meta tags for Open Graph (OG) properties
const ogTitleMeta = document.querySelector(
'meta[property="og:title"]'
);
const ogDescriptionMeta = document.querySelector(
'meta[property="og:description"]'
);
const ogUrlMeta = document.querySelector('meta[property="og:url"]');
const ogImageMeta = document.querySelector(
'meta[property="og:image"]'
);
const ogPublishedTimeMeta = document.querySelector(
'meta[property="article:published_time"]'
);
const keywordsMetaTag = document.querySelector(
'meta[name="keywords"]'
);
if (ogTitleMeta) ogTitleMeta.setAttribute("content", mod.title);
if (ogDescriptionMeta)
ogDescriptionMeta.setAttribute("content", mod.paragraph1);
if (ogUrlMeta)
ogUrlMeta.setAttribute(
"content",
`https://kmaxmods.com/view.html?id=${mod.id}`
);
if (ogImageMeta) ogImageMeta.setAttribute("content", mod.main_image);
if (ogPublishedTimeMeta)
ogPublishedTimeMeta.setAttribute("content", now);
// Check if the keywords exist and are valid before updating the tag
if (keywords) {
keywordsMetaTag.setAttribute("content", keywords);
} else {
console.error("Keywords not found or meta tag missing");
// Handle the situation where 'keywords' are not available or the meta tag is missing
}
} catch (error) {
console.error("Error updating meta tags:", error);
}
}
// Function to load and update meta tags for a specific mod based on the ID from URL
async function loadMetaTagsById() {
try {
// Extracting the ID from the URL
const urlParams = new URLSearchParams(window.location.search);
const id = urlParams.get("id");
console.log("Extracted ID from URL:", id);
if (!id) {
console.error("No ID found in the URL");
return;
}
// Assuming modsRef is properly defined elsewhere
if (!modsRef) {
console.error("modsRef is not defined");
return;
}
// Retrieving data from Firebase using async/await
const snapshot = await modsRef.once("value");
const mods = snapshot.val();
if (mods && mods[id]) {
const mod = mods[id];
// Update meta tags and title
updateMetaTags(mod);
} else {
console.error("Mod with ID " + id + " not found");
}
} catch (error) {
console.error("Error loading meta tags:", error);
// Handle Firebase-related errors separately if needed
}
}
// Call the function to load mods when the page loads
function searchRedirect() {
var searchQuery = document.getElementById("searchInput").value;
if (searchQuery.trim() !== "") {
window.location.href =
"search.html?id=" + encodeURIComponent(searchQuery);
}
}
// Call the function when the page is loaded
loadMetaTagsById();
</script>
</body>
</html>