add editorconfig and convert spaces to tabs
This commit is contained in:
@ -1,86 +1,86 @@
|
||||
const makeArtistImg = function(artistImg) {
|
||||
let imgDiv = document.createElement("div");
|
||||
imgDiv.classList.add("fit-contain");
|
||||
let imgDiv = document.createElement("div");
|
||||
imgDiv.classList.add("fit-contain");
|
||||
|
||||
let img = document.createElement("img");
|
||||
img.src = artistImg.src;
|
||||
let img = document.createElement("img");
|
||||
img.src = artistImg.src;
|
||||
|
||||
/* handle single-line or multi-line alts */
|
||||
if (typeof artistImg.alt === "string") img.alt = artistImg.alt;
|
||||
else {
|
||||
let fullAlt = `a ${artistImg.alt.length} image collage.`
|
||||
for (let i = 0; i < artistImg.alt.length; i++)
|
||||
fullAlt += ` ${i}: ${artistImg.alt[i]}`
|
||||
img.alt = fullAlt;
|
||||
}
|
||||
/* handle single-line or multi-line alts */
|
||||
if (typeof artistImg.alt === "string") img.alt = artistImg.alt;
|
||||
else {
|
||||
let fullAlt = `a ${artistImg.alt.length} image collage.`
|
||||
for (let i = 0; i < artistImg.alt.length; i++)
|
||||
fullAlt += ` ${i}: ${artistImg.alt[i]}`
|
||||
img.alt = fullAlt;
|
||||
}
|
||||
|
||||
imgDiv.append(img);
|
||||
return imgDiv;
|
||||
imgDiv.append(img);
|
||||
return imgDiv;
|
||||
}
|
||||
|
||||
const makeArtistDesc = function(bio, contact) {
|
||||
let descDiv = document.createElement("div");
|
||||
descDiv.classList.add("description");
|
||||
let descDiv = document.createElement("div");
|
||||
descDiv.classList.add("description");
|
||||
|
||||
/* multi-line bio array */
|
||||
for (const bioLine of bio) {
|
||||
let p = document.createElement("p");
|
||||
p.innerHTML = bioLine;
|
||||
descDiv.append(p);
|
||||
}
|
||||
/* multi-line bio array */
|
||||
for (const bioLine of bio) {
|
||||
let p = document.createElement("p");
|
||||
p.innerHTML = bioLine;
|
||||
descDiv.append(p);
|
||||
}
|
||||
|
||||
/* artist contact info */
|
||||
let contacts = document.createElement("p");
|
||||
for (let i = 0; i < contact.length; i++) {
|
||||
let a = document.createElement("a");
|
||||
a.href = contact[i].href;
|
||||
a.innerHTML = contact[i].title;
|
||||
a.target = "_blank";
|
||||
contacts.append(a);
|
||||
/* artist contact info */
|
||||
let contacts = document.createElement("p");
|
||||
for (let i = 0; i < contact.length; i++) {
|
||||
let a = document.createElement("a");
|
||||
a.href = contact[i].href;
|
||||
a.innerHTML = contact[i].title;
|
||||
a.target = "_blank";
|
||||
contacts.append(a);
|
||||
|
||||
if (i !== contact.length - 1) contacts.append(" ● ");
|
||||
}
|
||||
descDiv.append(contacts);
|
||||
if (i !== contact.length - 1) contacts.append(" ● ");
|
||||
}
|
||||
descDiv.append(contacts);
|
||||
|
||||
return descDiv;
|
||||
return descDiv;
|
||||
}
|
||||
|
||||
const makeArtist = function(artist) {
|
||||
let container = document.createElement("div");
|
||||
container.classList.add("artist");
|
||||
container.id = artist.id;
|
||||
let container = document.createElement("div");
|
||||
container.classList.add("artist");
|
||||
container.id = artist.id;
|
||||
|
||||
/* artist img */
|
||||
container.append(makeArtistImg(artist.img));
|
||||
/* artist img */
|
||||
container.append(makeArtistImg(artist.img));
|
||||
|
||||
/* artist name */
|
||||
let h3 = document.createElement("h3");
|
||||
h3.innerHTML = artist.name;
|
||||
container.append(h3);
|
||||
/* artist name */
|
||||
let h3 = document.createElement("h3");
|
||||
h3.innerHTML = artist.name;
|
||||
container.append(h3);
|
||||
|
||||
/* artist description */
|
||||
container.append(makeArtistDesc(artist.bio, artist.contact));
|
||||
return container;
|
||||
/* artist description */
|
||||
container.append(makeArtistDesc(artist.bio, artist.contact));
|
||||
return container;
|
||||
}
|
||||
|
||||
let artistContainer = document.getElementById("artists");
|
||||
|
||||
const makeArtistPage = function(artists) {
|
||||
for (const artist of artists)
|
||||
artistContainer.append(makeArtist(artist));
|
||||
for (const artist of artists)
|
||||
artistContainer.append(makeArtist(artist));
|
||||
}
|
||||
|
||||
let script = document.currentScript;
|
||||
let artistsfile = script.dataset.artists;
|
||||
|
||||
fetch(artistsfile)
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error, status = ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((artists) => makeArtistPage(artists))
|
||||
.catch((error) => {
|
||||
console.log(`Error: ${error.message}`);
|
||||
});
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error, status = ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((artists) => makeArtistPage(artists))
|
||||
.catch((error) => {
|
||||
console.log(`Error: ${error.message}`);
|
||||
});
|
||||
|
||||
@ -1,76 +1,76 @@
|
||||
/* Top nav */
|
||||
const navItems = [
|
||||
{
|
||||
href: "/about/",
|
||||
title: "ⓘ about",
|
||||
tooltip: "about the Beall Greenhouses"
|
||||
},
|
||||
{
|
||||
href: "/events/",
|
||||
title: "🗓 events",
|
||||
tooltip: "events at the Beall Greenhouses"
|
||||
},
|
||||
{
|
||||
href: "/artists/",
|
||||
title: "🖌 artists",
|
||||
tooltip: "artists in residence at the Beall Greenhouses"
|
||||
}
|
||||
{
|
||||
href: "/about/",
|
||||
title: "ⓘ about",
|
||||
tooltip: "about the Beall Greenhouses"
|
||||
},
|
||||
{
|
||||
href: "/events/",
|
||||
title: "🗓 events",
|
||||
tooltip: "events at the Beall Greenhouses"
|
||||
},
|
||||
{
|
||||
href: "/artists/",
|
||||
title: "🖌 artists",
|
||||
tooltip: "artists in residence at the Beall Greenhouses"
|
||||
}
|
||||
];
|
||||
|
||||
const createMenuLink = function(title, href, tooltip) {
|
||||
let path = window.location.pathname;
|
||||
let path = window.location.pathname;
|
||||
|
||||
let a = document.createElement("a");
|
||||
a.href = href;
|
||||
a.innerHTML = title;
|
||||
a.title = tooltip;
|
||||
a.ariaLabel = tooltip;
|
||||
if (href === "#main") a.id = "skip";
|
||||
else if (href === path) a.id = "current-page";
|
||||
let a = document.createElement("a");
|
||||
a.href = href;
|
||||
a.innerHTML = title;
|
||||
a.title = tooltip;
|
||||
a.ariaLabel = tooltip;
|
||||
if (href === "#main") a.id = "skip";
|
||||
else if (href === path) a.id = "current-page";
|
||||
|
||||
return a;
|
||||
return a;
|
||||
}
|
||||
|
||||
const createHomeLink = function() {
|
||||
let path = window.location.pathname;
|
||||
let path = window.location.pathname;
|
||||
|
||||
let a = document.createElement("a");
|
||||
a.href = "/";
|
||||
a.ariaLabel = "Beall Greenhouses home";
|
||||
if (path === "/") {
|
||||
a.id = "current-page";
|
||||
a.title = "Beall Greenhouses home";
|
||||
} else {
|
||||
a.title = "↩ Beall Greenhouses home"
|
||||
}
|
||||
let a = document.createElement("a");
|
||||
a.href = "/";
|
||||
a.ariaLabel = "Beall Greenhouses home";
|
||||
if (path === "/") {
|
||||
a.id = "current-page";
|
||||
a.title = "Beall Greenhouses home";
|
||||
} else {
|
||||
a.title = "↩ Beall Greenhouses home"
|
||||
}
|
||||
|
||||
let logo = document.createElement("img");
|
||||
logo.src = "/assets/img/logo.jpg";
|
||||
logo.alt = "block print in black and orange of a rufous hummingbird in flight with tail flared. the hummingbird holds a banner that reads 'become ungovernable.'"
|
||||
let logo = document.createElement("img");
|
||||
logo.src = "/assets/img/logo.jpg";
|
||||
logo.alt = "block print in black and orange of a rufous hummingbird in flight with tail flared. the hummingbird holds a banner that reads 'become ungovernable.'"
|
||||
|
||||
a.append(logo);
|
||||
a.append(logo);
|
||||
|
||||
return a;
|
||||
return a;
|
||||
}
|
||||
|
||||
const createNav = function() {
|
||||
let nav = document.createElement("nav");
|
||||
nav.title = "background image shows the peak of a dilapidated greenhouse in black and white";
|
||||
let nav = document.createElement("nav");
|
||||
nav.title = "background image shows the peak of a dilapidated greenhouse in black and white";
|
||||
|
||||
nav.append(createMenuLink("skip ↷", "#main", "skip to main content"));
|
||||
nav.append(createHomeLink());
|
||||
nav.append(createMenuLink("skip ↷", "#main", "skip to main content"));
|
||||
nav.append(createHomeLink());
|
||||
|
||||
let ul = document.createElement("ul");
|
||||
let ul = document.createElement("ul");
|
||||
|
||||
for (const item of navItems) {
|
||||
let li = document.createElement("li");
|
||||
li.append(createMenuLink(item.title, item.href, item.tooltip));
|
||||
ul.append(li);
|
||||
}
|
||||
for (const item of navItems) {
|
||||
let li = document.createElement("li");
|
||||
li.append(createMenuLink(item.title, item.href, item.tooltip));
|
||||
ul.append(li);
|
||||
}
|
||||
|
||||
nav.append(ul);
|
||||
nav.append(ul);
|
||||
|
||||
return nav;
|
||||
return nav;
|
||||
}
|
||||
|
||||
let header = document.querySelector("header");
|
||||
@ -78,15 +78,15 @@ header.append(createNav());
|
||||
|
||||
/* Footer */
|
||||
const footerHTML = `
|
||||
<p>questions?
|
||||
<a href="mailto:beall.greenhouses@gmail.com">email us!</a>
|
||||
</p>
|
||||
<p>brought to you in 2026</p>
|
||||
<p>questions?
|
||||
<a href="mailto:beall.greenhouses@gmail.com">email us!</a>
|
||||
</p>
|
||||
<p>brought to you in 2026</p>
|
||||
`
|
||||
|
||||
const populateFooter = function() {
|
||||
let footer = document.getElementById("footer");
|
||||
footer.innerHTML = footerHTML;
|
||||
let footer = document.getElementById("footer");
|
||||
footer.innerHTML = footerHTML;
|
||||
}
|
||||
|
||||
populateFooter();
|
||||
|
||||
Reference in New Issue
Block a user