-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
196 lines (167 loc) · 8.53 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Extensions</title>
<meta content="Extensions" property="og:title" />
<meta content="A list of scratch extensions made by @mistium" property="og:description" />
<meta content="https://extensions.mistium.com" property="og:url" />
<meta content="#57cdac" data-react-helmet="true" name="theme-color" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="topbar"></div>
<div class="content">
<h1>Extensions</h1>
<h2>Featured</h2>
<div id="featuredCards"></div>
<h2>All ( Some may not work at all :P )</h2>
<div id="fileCards"></div>
<h2>Other Extension Galleries</h2>
<div id="otherGalleries"></div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
fetch('https://raw.githubusercontent.com/Mistium/Origin-OS/main/topbar.html')
.then(response => response.text())
.then(html => {
document.getElementById('topbar').innerHTML = html;
})
.catch(error => console.error('Error fetching topbar HTML:', error));
fetchAndCacheVersions().then(() => {
generateProfileCards();
generateOtherGalleries();
});
});
// Function to fetch versions data and cache it
async function fetchAndCacheVersions() {
try {
const response = await fetch('https://raw.githubusercontent.com/Mistium/extensions.mistium/main/versions.json');
const versions = await response.json();
localStorage.setItem('extensionVersions', JSON.stringify(versions));
return versions;
} catch (error) {
console.error('Error fetching versions data:', error);
return {};
}
}
// Function to fetch data from GitHub API
async function fetchData() {
try {
const [featuredResponse, filesResponse] = await Promise.all([
fetch('https://api.github.com/repos/Mistium/extensions.mistium/contents/featured'),
fetch('https://api.github.com/repos/Mistium/extensions.mistium/contents/files')
]);
const featuredData = await featuredResponse.json();
const filesData = await filesResponse.json();
return { featured: featuredData, files: filesData };
} catch (error) {
console.error('Error fetching data:', error);
return { featured: [], files: [] };
}
}
// Function to generate profile cards
async function generateProfileCards() {
const featuredCardsContainer = document.getElementById("featuredCards");
const fileCardsContainer = document.getElementById("fileCards");
const data = await fetchData();
let cachedVersions = {};
try {
cachedVersions = JSON.parse(localStorage.getItem('extensionVersions')) || {};
} catch (e) {
console.error('Error parsing cached versions:', e);
}
const versions = await fetchAndCacheVersions();
if (!data || !data.featured || !Array.isArray(data.featured) || !data.files || !Array.isArray(data.files)) return;
data.featured.forEach(item => {
const itemName = item.name.split('.')[0]; // Remove file extension
const isJsFile = item.name.endsWith('.js');
if (isJsFile) {
const profileCardLink = document.createElement("a");
profileCardLink.href = item.download_url;
profileCardLink.target = "_blank";
profileCardLink.rel = "noopener noreferrer";
const profileCard = document.createElement("div");
profileCard.classList.add("profile-card");
const platformHeading = document.createElement("h2");
platformHeading.textContent = itemName;
const profileImage = document.createElement("img");
profileImage.src = `https://raw.githubusercontent.com/Mistium/extensions.mistium/main/images/${itemName}.png`;
profileImage.alt = itemName;
profileImage.classList.add("profile-image");
// Check if the extension is new or updated
const versionTag = document.createElement("span");
versionTag.classList.add("version-tag");
if (!cachedVersions[item.name]) {
versionTag.textContent = "New";
versionTag.classList.add("new-tag");
} else if (versions[item.name] && versions[item.name] !== cachedVersions[item.name]) {
versionTag.textContent = "Updated";
versionTag.classList.add("updated-tag");
}
versionTag.style.color = "#fff";
profileCard.appendChild(profileImage);
profileCard.appendChild(platformHeading);
if (versionTag.textContent) {
profileCard.appendChild(versionTag);
}
profileCardLink.appendChild(profileCard);
featuredCardsContainer.appendChild(profileCardLink);
}
});
data.files.forEach(item => {
const itemName = item.name.split('.')[0]; // Remove file extension
const isJsFile = item.name.endsWith('.js');
if (isJsFile) {
const profileCardLink = document.createElement("a");
profileCardLink.href = item.download_url.replace("https://raw.githubusercontent.com/Mistium/extensions.mistium/main/","https://extensions.mistium.com/");
profileCardLink.target = "_blank";
profileCardLink.rel = "noopener noreferrer";
const profileCard = document.createElement("div");
profileCard.classList.add("profile-card");
const platformHeading = document.createElement("h2");
platformHeading.textContent = itemName;
profileCard.appendChild(platformHeading);
profileCardLink.appendChild(profileCard);
fileCardsContainer.appendChild(profileCardLink);
}
});
// Update the cached versions to the latest versions
localStorage.setItem('extensionVersions', JSON.stringify(versions));
}
// Function to generate other extension gallery links
function generateOtherGalleries() {
const galleries = [
{ name: "PenguinMod", url: "https://extensions.penguinmod.com" },
{ name: "Cally's Gallery", url: "https://cally-jt.github.io/ultimate-extension-gallery" },
{ name: "Miyo's Gallery >:3", url: "https://gallery.miyo.lol" },
{ name: "Sharkpool's Extensions", url: "https://sharkpools-extensions.vercel.app" },
{ name: "Ruby Team Gallery", url: "https://rubyteam.tech/gallery" },
{ name: "TurboWarp Extensions", url: "https://extensions.turbowarp.org" },
{ name: "LDSJVG Webwave", url: "https://ldsjvg.webwave.dev/webpage_20" },
{ name: "LBGS Extensions", url: "https://lbgs-extensions.vercel.app/" },
{ name: "Goofy Warp", url: "https://goofywarp.github.io/extensions/" },
{ name: "Dino Mod :P", url: "https://github.com/GabsTheCuriousKid/FirstExtension/tree/main/extensions" },
{ name: "Pen Group", url: "https://pen-group.github.io/extensions" },
{ name: "Lemon", url: "https://bludisanlemon.github.io/lemons-gallery" }
];
const otherGalleriesContainer = document.getElementById("otherGalleries");
galleries.forEach(gallery => {
const galleryLink = document.createElement("a");
galleryLink.href = gallery.url + "?ref=mistium";
galleryLink.target = "_blank";
galleryLink.rel = "noopener noreferrer";
galleryLink.classList.add("gallery-link");
const galleryCard = document.createElement("div");
galleryCard.classList.add("profile-card");
const galleryHeading = document.createElement("h2");
galleryHeading.textContent = gallery.name;
galleryCard.appendChild(galleryHeading);
galleryLink.appendChild(galleryCard);
otherGalleriesContainer.appendChild(galleryLink);
});
}
</script>