${news.title}
${news.caption}
const urlSearchParams = new URLSearchParams(window.location.search); const sourceURL = urlSearchParams.get('source'); // If no source if (!urlSearchParams.has('source') || !sourceURL) { alert(`No source provided.`); window.location.replace("index.html"); } // https://stackoverflow.com/a/31760088 const urlRegex = /(https?:\/\/[^ ]*)/g; // "g": global flag; without this, match() returns only the first matching result // If source is not a URL if (!sourceURL.match(urlRegex)) { alert("Invalid URL."); window.location.replace("index.html"); } // Back button document.getElementById("back")?.addEventListener("click", () => history.back(1)); // Add to AltStore banner document.getElementById("top")?.insertAdjacentHTML("afterbegin", `
`); function waitForAllImagesToLoad() { const allImages = document.querySelectorAll("img"); var count = 0; allImages.forEach(image => { // New img element that won't be rendered to the DOM var newImage = document.createElement("img"); // Attach load listener newImage.addEventListener("load", imageLoaded); // Set src newImage.src = image.src; }) function imageLoaded() { if (++count == allImages.length) { document.querySelector("body").classList.remove("loading"); document.getElementById("loading").remove(); } } } function setTintColor(color) { document.querySelector(':root').style.setProperty("--accent-color", `#${color}`); } function addNavigationBar(title) { document.getElementById("top").insertAdjacentHTML("beforeend", ` `); document.getElementById("back")?.addEventListener("click", () => history.back(1)); } function newsItemHTML(news, apps, minimal) { let html = `${news.caption}