forked from blueprint-site/blueprint-site.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
random.html
76 lines (74 loc) · 4.51 KB
/
random.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Blueprint - Download, Read, Explore</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="stylesheet" href="static/css/style.css">
<link rel="stylesheet" href="static/css/random.css">
<meta property="og:type" content="website">
<meta property="og:title" content="Blueprint"/>
<meta property="og:description" content="Your all in one Create website"/>
<meta property="og:url" content="https://blueprint-site.github.io/"/>
<meta property="og:image" content="https://blueprint-site.github.io/static/logo.webp"/>
<script src="/static/js/darkmode.js" defer></script>
</head>
<body>
<div id="dark-mode-toggle"></div>
<nav>
<a class="logo" href="/"><img src="/static/logo.webp" alt="Logo">Blueprint</a>
<span style="flex-grow: 1;"></span>
<a href="/addons.html"><img src="/static/minecart_coupling.webp" alt="">Addons</a>
<a href="/schematics.html"><img src="/static/schematic.webp" alt="">Schematics</a>
<a href="/about.html"><img src="/static/Clipboard.webp" alt="">About</a>
</nav>
<main>
<center>
<h1 class="random-header">Here is your Random Addon! 🥳</h1>
<div class="random-addon" id="random-addon">
</div>
</center>
<footer>
<img src="static/logo.webp" alt="" class="bottom-bar-logo">
<h4 class="bottom-bar-sitename">Create Addons</h4>
<h6 class="bottom-bar-bug">Found a bug? Report it to [email protected]</h6>
<h6 class="bottom-bar-bug">NOT AN OFFICIAL MINECRAFT SERVICE. NOT APPROVED BY OR ASSOCIATED WITH MOJANG OR
MICROSOFT</h6>
</footer>
</main>
</body>
<script>
document.addEventListener("DOMContentLoaded", function () {
fetch('static/data/final_data.json') // Fetch the JSON file
.then(response => response.json())
.then(data => {
const addonIds = Object.keys(data); // Get all addon IDs
const randomId = addonIds[Math.floor(Math.random() * addonIds.length)]; // Select a random addon ID
const randomAddon = data[randomId]; // Get the addon object by its ID
displayAddon(randomAddon); // Display the random addon
})
.catch(error => console.error('Error fetching addons:', error));
});
function displayAddon(addon) {
let modloaders = "";
if (addon.addon_categories.includes("forge")) modloaders += `<a class="supports-forge" target="_blank" rel="noopener noreferrer" href="https://forums.minecraftforge.net"><img alt="Forge support" height="30" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/forge_46h.png"></a>`;
if (addon.addon_categories.includes("neoforge")) modloaders += `<a class="supports-neoforge" target="_blank" rel="noopener noreferrer" href="https://neoforged.net"><img alt="NeoForge support" height="30" src="/static/neoforge_46h.png"></a>`;
if (addon.addon_categories.includes("fabric")) modloaders += `<a class="supports-fabric" target="_blank" rel="noopener noreferrer" href="https://fabricmc.net"><img alt="Fabric support" height="30" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/fabric_46h.png"></a>`;
if (addon.addon_categories.includes("quilt")) modloaders += `<a class="supports-quilt" target="_blank" rel="noopener noreferrer" href="https://quiltmc.org"><img alt="Quilt support" height="30" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/quilt_46h.png"></a>`;
const randomAddonDiv = document.getElementById('random-addon');
randomAddonDiv.innerHTML = `
<center>
<img class="random-addon-logo" src="${addon.addon_icon_url}" alt="">
<div class="modloaders"><center>${modloaders}</center></div>
<h3 class="random-addon-name">${addon.addon_name}</h3>
<h4 class="random-addon-description">${addon.addon_short_descriptions}</h4>
<a target="_blank" rel="noopener noreferrer" class="addon-button" href="${"https://modrinth.com/mod/" + addon.addon_slug}"><img alt="Download on Modrinth" height="35" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/available/modrinth_46h.png"></a>
</center>
`;
}
</script>
</html>