This repository has been archived on 2024-10-20. You can view files and clone it, but cannot push or open issues or pull requests.
burgerstore/static/js/main.js

100 lines
3.2 KiB
JavaScript
Raw Permalink Normal View History

2024-03-08 23:39:24 +00:00
let appGrid = document.getElementById("appGrid")
2024-03-09 16:17:10 +00:00
let AppInfo = document.getElementById("AppInfo")
2024-03-09 14:19:52 +00:00
let iOSAppInfo = document.getElementById("iOSAppInfo")
let unknownAppInfo = document.getElementById("unknownAppInfo")
2024-03-08 23:39:24 +00:00
async function getStore(link) {
const response = await fetch(link);
const data = await response.json();
return data
}
2024-03-09 14:19:52 +00:00
// check if on iOS or iPadOS
if (navigator.userAgent.includes("iPhone") || navigator.userAgent.includes("iPad")) {
2024-03-08 23:39:24 +00:00
2024-03-09 14:19:52 +00:00
// get iOS version
if (navigator.userAgent.split(" ")[5] == "like") {
let iOSVersion = navigator.userAgent.split(" ")[4].replaceAll("_", ".")
} else {
let iOSVersion = navigator.userAgent.split(" ")[5].replaceAll("_", ".")
2024-03-08 23:39:24 +00:00
}
2024-03-09 14:19:52 +00:00
// show iOS app info
2024-03-09 16:17:10 +00:00
AppInfo.classList.remove("hidden")
2024-03-09 14:19:52 +00:00
iOSAppInfo.classList.remove("hidden")
2024-03-09 16:17:10 +00:00
2024-03-09 14:19:52 +00:00
// Load AltStore repository
getStore("repo/store.json").then((data) => {
console.log(data["title"])
console.log(data["apps"])
for (index in data["apps"]) {
let application = data["apps"][index]
2024-03-09 16:17:10 +00:00
2024-03-09 14:19:52 +00:00
// UI stuff
let appDiv = document.createElement("div")
appDiv.classList.add("app")
appGrid.append(appDiv)
2024-03-09 16:17:10 +00:00
2024-03-09 14:19:52 +00:00
let appImage = document.createElement("img")
appImage.src = application["iconURL"]
appDiv.append(appImage)
2024-03-09 16:17:10 +00:00
2024-03-09 14:19:52 +00:00
let appTitle = document.createElement("p")
appTitle.classList.add("title")
appTitle.innerText = application["name"]
appDiv.append(appTitle)
2024-03-09 16:17:10 +00:00
2024-03-09 14:19:52 +00:00
let appInfo = document.createElement("p")
appInfo.classList.add("w300")
appInfo.innerText = application["developerName"] + " | " + application["subtitle"]
appDiv.append(appInfo)
2024-03-09 16:17:10 +00:00
let appButton = document.createElement("button")
appButton.innerText = "Get"
appDiv.append(appButton)
}
});
}
// Check for Linux
if (navigator.userAgent.includes("Linux")) {
// show app info
AppInfo.classList.remove("hidden")
// Load BurgerStore repository
getStore("repo/store.json").then((data) => {
console.log(data["title"])
console.log(data["apps"])
for (index in data["linuxapps"]) {
let application = data["linuxapps"][index]
// UI stuff
let appDiv = document.createElement("div")
appDiv.classList.add("app")
appGrid.append(appDiv)
let appImage = document.createElement("img")
appImage.src = application["iconURL"]
appDiv.append(appImage)
let appTitle = document.createElement("p")
appTitle.classList.add("title")
appTitle.innerText = application["name"]
appDiv.append(appTitle)
let appInfo = document.createElement("p")
appInfo.classList.add("w300")
appInfo.innerText = application["developerName"] + " | " + application["subtitle"]
appDiv.append(appInfo)
2024-03-09 14:19:52 +00:00
let appButton = document.createElement("button")
appButton.innerText = "Get"
appDiv.append(appButton)
}
});
}
// Unknown device
else {
unknownAppInfo.classList.remove("hidden")
}