Fix build issue

This commit is contained in:
Jeremy Thomas 2024-01-11 21:17:22 +00:00
parent 2ad384ca41
commit 3c490cf9db
4 changed files with 1911 additions and 2331 deletions

View File

@ -97,28 +97,30 @@ document.addEventListener("DOMContentLoaded", () => {
const $amis = document.getElementById("amis"); const $amis = document.getElementById("amis");
fetch("https://jgthms.com/amis/new.json") if ($amis) {
.then((response) => { fetch("https://jgthms.com/amis/new.json")
if (!response.ok) { .then((response) => {
throw new Error(`HTTP error! Status: ${response.status}`); if (!response.ok) {
} throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.json(); return response.json();
}) })
.then((response) => { .then((response) => {
response.forEach((item) => { response.forEach((item) => {
const el = document.createElement("a"); const el = document.createElement("a");
el.className = "bd-sponsor-item bd-partner-sponsor"; el.className = "bd-sponsor-item bd-partner-sponsor";
el.href = "url"; el.href = "url";
el.target = "_blank"; el.target = "_blank";
el.title = item.title || item.id; el.title = item.title || item.id;
const extension = item.svg ? ".svg" : ".png"; const extension = item.svg ? ".svg" : ".png";
const img = document.createElement("img"); const img = document.createElement("img");
img.src = `https://jgthms.com/amis/images/${item.id}${extension}`; img.src = `https://jgthms.com/amis/images/${item.id}${extension}`;
el.appendChild(img); el.appendChild(img);
$amis.appendChild(el); $amis.appendChild(el);
});
}); });
} }
}); });

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -86,26 +86,28 @@ document.addEventListener("DOMContentLoaded", function () {
var $amis = document.getElementById("amis"); var $amis = document.getElementById("amis");
fetch("https://jgthms.com/amis/new.json").then(function (response) { if ($amis) {
if (!response.ok) { fetch("https://jgthms.com/amis/new.json").then(function (response) {
throw new Error("HTTP error! Status: " + response.status); if (!response.ok) {
} throw new Error("HTTP error! Status: " + response.status);
}
return response.json(); return response.json();
}).then(function (response) { }).then(function (response) {
response.forEach(function (item) { response.forEach(function (item) {
var el = document.createElement("a"); var el = document.createElement("a");
el.className = "bd-sponsor-item bd-partner-sponsor"; el.className = "bd-sponsor-item bd-partner-sponsor";
el.href = "url"; el.href = "url";
el.target = "_blank"; el.target = "_blank";
el.title = item.title || item.id; el.title = item.title || item.id;
var extension = item.svg ? ".svg" : ".png"; var extension = item.svg ? ".svg" : ".png";
var img = document.createElement("img"); var img = document.createElement("img");
img.src = "https://jgthms.com/amis/images/" + item.id + extension; img.src = "https://jgthms.com/amis/images/" + item.id + extension;
el.appendChild(img); el.appendChild(img);
$amis.appendChild(el); $amis.appendChild(el);
});
}); });
} }
}); });