mirror of
https://github.com/jgthms/bulma
synced 2026-03-21 20:54:30 -07:00
Fix JS
This commit is contained in:
@@ -97,7 +97,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
|
|
||||||
const $amis = document.getElementById("amis");
|
const $amis = document.getElementById("amis");
|
||||||
|
|
||||||
fetch("https://jgthms.com/amis.json")
|
fetch("https://jgthms.com/amis/new.json")
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||||
@@ -106,21 +106,17 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const { by_id, home } = response;
|
response.forEach((item) => {
|
||||||
|
|
||||||
home.forEach((id) => {
|
|
||||||
const ami = by_id[id];
|
|
||||||
const { url, alt = "", width, height } = ami;
|
|
||||||
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 = alt;
|
el.title = item.title || item.id;
|
||||||
const extension = ami.svg ? ".svg" : ".png";
|
|
||||||
|
const extension = item.svg ? ".svg" : ".png";
|
||||||
const img = document.createElement("img");
|
const img = document.createElement("img");
|
||||||
img.src = `/images/amis/${id}${extension}`;
|
img.src = `https://jgthms.com/amis/images/${item.id}${extension}`;
|
||||||
img.height = height;
|
|
||||||
img.width = width;
|
|
||||||
el.appendChild(img);
|
el.appendChild(img);
|
||||||
$amis.appendChild(el);
|
$amis.appendChild(el);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -86,35 +86,24 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
var $amis = document.getElementById("amis");
|
var $amis = document.getElementById("amis");
|
||||||
|
|
||||||
fetch("https://jgthms.com/amis.json").then(function (response) {
|
fetch("https://jgthms.com/amis/new.json").then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("HTTP error! Status: " + response.status);
|
throw new Error("HTTP error! Status: " + response.status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.json();
|
return response.json();
|
||||||
}).then(function (response) {
|
}).then(function (response) {
|
||||||
var by_id = response.by_id,
|
response.forEach(function (item) {
|
||||||
home = response.home;
|
|
||||||
|
|
||||||
|
|
||||||
home.forEach(function (id) {
|
|
||||||
var ami = by_id[id];
|
|
||||||
var url = ami.url,
|
|
||||||
_ami$alt = ami.alt,
|
|
||||||
alt = _ami$alt === undefined ? "" : _ami$alt,
|
|
||||||
width = ami.width,
|
|
||||||
height = ami.height;
|
|
||||||
|
|
||||||
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 = alt;
|
el.title = item.title || item.id;
|
||||||
var extension = ami.svg ? ".svg" : ".png";
|
|
||||||
|
var extension = item.svg ? ".svg" : ".png";
|
||||||
var img = document.createElement("img");
|
var img = document.createElement("img");
|
||||||
img.src = "/images/amis/" + id + extension;
|
img.src = "https://jgthms.com/amis/images/" + item.id + extension;
|
||||||
img.height = height;
|
|
||||||
img.width = width;
|
|
||||||
el.appendChild(img);
|
el.appendChild(img);
|
||||||
$amis.appendChild(el);
|
$amis.appendChild(el);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user