mirror of
https://github.com/driftywinds/driftywinds.github.io.git
synced 2025-12-19 19:13:33 +00:00
Indent code with spaces instead of tabs
This commit is contained in:
68
js/main.js
68
js/main.js
@@ -1,44 +1,44 @@
|
||||
(function () {
|
||||
// If no source
|
||||
if (!urlSearchParams.has('source'))
|
||||
search();
|
||||
// If source is not a valid HTTP URL
|
||||
else if (!isValidHTTPURL(sourceURL)) {
|
||||
alert("Invalid HTTP URL.");
|
||||
search();
|
||||
} else insertAddToAltStoreBanner();
|
||||
// If no source
|
||||
if (!urlSearchParams.has('source'))
|
||||
search();
|
||||
// If source is not a valid HTTP URL
|
||||
else if (!isValidHTTPURL(sourceURL)) {
|
||||
alert("Invalid HTTP URL.");
|
||||
search();
|
||||
} else insertAddToAltStoreBanner();
|
||||
})();
|
||||
|
||||
fetch(sourceURL)
|
||||
.then(response => response.json())
|
||||
.then(json => {
|
||||
// Set tint color
|
||||
const tintColor = json.tintColor?.replaceAll("#", "");
|
||||
if (tintColor) setTintColor(tintColor);
|
||||
.then(response => response.json())
|
||||
.then(json => {
|
||||
// Set tint color
|
||||
const tintColor = json.tintColor?.replaceAll("#", "");
|
||||
if (tintColor) setTintColor(tintColor);
|
||||
|
||||
setApps(json.apps);
|
||||
main(json);
|
||||
waitForAllImagesToLoad();
|
||||
})
|
||||
.catch(error => console.error("An error occurred.", error));
|
||||
setApps(json.apps);
|
||||
main(json);
|
||||
waitForAllImagesToLoad();
|
||||
})
|
||||
.catch(error => console.error("An error occurred.", error));
|
||||
|
||||
function waitForAllImagesToLoad() {
|
||||
const allImages = document.querySelectorAll("img");
|
||||
var count = 0;
|
||||
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", loaded);
|
||||
// Set src
|
||||
newImage.src = image.src;
|
||||
});
|
||||
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", loaded);
|
||||
// Set src
|
||||
newImage.src = image.src;
|
||||
});
|
||||
|
||||
function loaded() {
|
||||
if (++count == allImages.length) {
|
||||
document.querySelector("body").classList.remove("loading");
|
||||
document.getElementById("loading").remove();
|
||||
}
|
||||
}
|
||||
function loaded() {
|
||||
if (++count == allImages.length) {
|
||||
document.querySelector("body").classList.remove("loading");
|
||||
document.getElementById("loading").remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user