diff --git a/eleventy.config.js b/eleventy.config.js index c402834..063571c 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -117,77 +117,22 @@ export default async function (eleventyConfig) { }); // Shortcodes - - // Cowsay - eleventyConfig.addFilter("cowsay", (cowText) => { - const cowCaptionReplacementTable = [ - [ - ` - o ^__^ - o (oo)\\_______ - (__)\\ )\\/\\ - ||----w | - || ||`, - "", - ], - [/\(\s+/g, ""], - [/\s+\(/g, ""], - [/_{3,}/g, ""], - [/-{3,}/g, ""], - [/\s\)/g, ""], - [/\n/g, ""], - [/\s{2,}/g, " "], - [/^ /, ""], - ]; - - return ` -
- -
- A cow thinking: ${multiReplace(cowText, cowCaptionReplacementTable)}. The cow is illustrated using - preformatted text characters. -
-
- `; - }); - - // Embed a toot - eleventyConfig.addAsyncShortcode("toot", async function (instance, ID) { - const tootData = await fetch(`https://${instance}/api/v1/statuses/${ID}`); - - const toot = await tootData.json(); - - const dateObj = new Date(toot.created_at); - - const dateTime = `${dateObj.getDate()}${dateSuffixAdder(dateObj.getDate())} of ${monthMap[dateObj.getMonth()]}, ${dateObj.getFullYear()}, at ${timeFormatter(dateObj.getHours(), dateObj.getMinutes())}`; - - return ` - - - `; - }); - - // Embed audio + // Audio player eleventyConfig.addShortcode( "audio", function (title, artist, media_url, cover_url) { return ` - - - +
+
+ +
+
+
+ ${title}
${artist} +
+ +
+
`; }, ); diff --git a/public/css/index.css b/public/css/index.css index 0d17eb1..b1bc2eb 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -127,18 +127,6 @@ /* Shadow */ --box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); - - /* Web Component Tokens */ - --wc-card-background-color: var(--card-color); - --wc-card-border-radius: var(--border-radius); - --wc-card-margin: 0 0 var(--space-s) 0; - --wc-card-box-shadow: var(--box-shadow); - --wc-link-color: var(--text-color); - --wc-link-decoration-color: var(--contrast-color); - --wc-link-decoration-thickness: var(--link-decoration-thickness); - --wc-comment-text-margin: var(--space-xs) 0 0 0; - --wc-profile-pic-size: var(--space-l); - --wc-profile-pic-border-radius: 10rem; } @media (prefers-color-scheme: dark) { @@ -438,7 +426,7 @@ body.barebones { text-align: center; } -figcaption { +figcaption:not(.mplayerInfo) { font-size: var(--step--1); font-style: italic; padding-top: var(--space-3xs); @@ -504,43 +492,47 @@ table th { } /* Audio Player */ -wc-mplayer { - width: 100%; +.albumCover { + object-fit: cover; } -wc-mplayer::part(artist) { - font-size: var(--meta-font-size); -} - -wc-mplayer::part(cover), -wc-mplayer::part(coverContainer) { - width: var(--space-3xl); - height: var(--space-3xl); +.albumCover, +.coverContainer { + width: var(--space-4xl); + height: var(--space-4xl); border-radius: var(--border-radius); } -wc-mplayer::part(captionAndPlayer) { +.artist { + font-size: var(--meta-font-size); + margin-bottom: var(--space-s); +} + +.captionAndPlayer { display: flex; flex-flow: column nowrap; justify-content: space-between; width: 100%; } -wc-mplayer::part(main) { +.mplayer { + background-color: var(--card-color); border-radius: var(--border-radius); + box-shadow: var(--box-shadow); display: flex; gap: var(--space-s); - margin: 0; + margin: 0 0 var(--space-s) 0; padding: var(--space-m); + width: 100%; } -wc-mplayer::part(player) { +.player { align-self: flex-end; border-radius: var(--border-radius); width: 100%; } -wc-mplayer::part(title) { +.songTitle { font-size: var(--step-1); font-variation-settings: "opsz" 50, @@ -550,41 +542,13 @@ wc-mplayer::part(title) { } /* Comments */ -#comments { - grid-column: var(--span-grid); -} .continue-discussion { grid-column: var(--span-grid); } .continue-discussion button { margin-top: var(--space-xs); } -wc-comment::part(author-link), -wc-toot::part(author-link) { - font-size: var(--step-0); - text-decoration: none; -} -wc-comment::part(main) { - padding: var(--space-m); -} -wc-comment::part(publish-date), -wc-toot::part(publish-date) { - font-family: var(--meta-font-family); - font-size: var(--meta-font-size); - font-style: var(--meta-font-style); - font-variation-settings: var(--font-variation-settings); -} -wc-toot::part(main) { - color: white; - font-family: var(--meta-font-family); - font-size: var(--step--1); -} -wc-toot::part(author), -wc-toot::part(author-link) { - color: white; - font-style: var(--meta-font-style); - font-variation-settings: "wght" 600; -} + /* Code Fences */ pre, code { @@ -1062,6 +1026,18 @@ article.post { margin-right: var(--space-3xs); } } +.card { + align-items: flex-start; + background-color: var(--card-color); + border-radius: var(--border-radius); + box-shadow: var(--box-shadow); + display: flex; + flex-flow: row nowrap; + justify-content: flex-start; + margin: 0 0 var(--space-s) 0; + padding: var(--single-gap) 1.1rem var(--single-gap) 1.1rem; + width: 100%; +} .gallery-images { display: flex; flex-flow: row wrap; diff --git a/public/js/webComponents/card.js b/public/js/webComponents/card.js deleted file mode 100644 index fd0c389..0000000 --- a/public/js/webComponents/card.js +++ /dev/null @@ -1,33 +0,0 @@ -const template = document.createElement('template'); - -template.innerHTML = ` - - -
- -
-` - -class card extends HTMLElement { - constructor() { - super(); - - this._shadowRoot = this.attachShadow({ 'mode': 'open' }); - this._shadowRoot.appendChild(template.content.cloneNode(true)); - } -} - -window.customElements.define('wc-card', card); diff --git a/public/js/webComponents/comment.js b/public/js/webComponents/comment.js deleted file mode 100644 index 2befd81..0000000 --- a/public/js/webComponents/comment.js +++ /dev/null @@ -1,76 +0,0 @@ -const template = document.createElement('template'); - -template.innerHTML = ` - - -
-
-
- -
-
-

- says: -

-

-
-
-
-
-
-` - -class comment extends HTMLElement { - constructor() { - super(); - - this._shadowRoot = this.attachShadow({ 'mode': 'open' }); - this._shadowRoot.appendChild(template.content.cloneNode(true)); - this.$comment = this._shadowRoot.querySelector('#commentContainer'); - } - - static get observedAttributes() { - return ['author_name', 'author_url', 'avatar_url', 'comment_content', 'publish_date']; - } - - attributeChangedCallback(name, oldVal, newVal) { - if (oldVal != newVal) { - this[name] = newVal; - this.render(); - } - } - - render() { - this.$comment.querySelector('#author-link').innerHTML = this.author_name; - this.$comment.querySelector('#author-link').href = this.author_url; - this.$comment.querySelector('wc-profile-pic').setAttribute('url', this.avatar_url) - this.$comment.querySelector('#comment').innerHTML = this.comment_content; - this.$comment.querySelector('#publish-date').innerHTML = this.publish_date; - } -} - -window.customElements.define('wc-comment', comment); diff --git a/public/js/webComponents/musicPlayer.js b/public/js/webComponents/musicPlayer.js deleted file mode 100644 index 283f002..0000000 --- a/public/js/webComponents/musicPlayer.js +++ /dev/null @@ -1,51 +0,0 @@ -const template = document.createElement("template"); - -template.innerHTML = ` - - -
-
- -
-
-
-
-
- -
-
-`; - -class mplayer extends HTMLElement { - constructor() { - super(); - - this._shadowRoot = this.attachShadow({ mode: "open" }); - this._shadowRoot.appendChild(template.content.cloneNode(true)); - this.$mplayer = this._shadowRoot.querySelector(".mplayer"); - } - - static get observedAttributes() { - return ["title", "artist", "media_url", "cover_url"]; - } - - attributeChangedCallback(name, oldVal, newVal) { - if (oldVal != newVal) { - this[name] = newVal; - this.render(); - } - } - - render() { - this.$mplayer.querySelector(".title").innerHTML = this.title; - this.$mplayer.querySelector(".artist").innerHTML = this.artist; - this.$mplayer.querySelector(".player").src = this.media_url; - this.$mplayer.querySelector(".coverContainer > img").src = this.cover_url; - } -} - -window.customElements.define("wc-mplayer", mplayer); diff --git a/public/js/webComponents/profilePic.js b/public/js/webComponents/profilePic.js deleted file mode 100644 index da8a8e6..0000000 --- a/public/js/webComponents/profilePic.js +++ /dev/null @@ -1,40 +0,0 @@ -const template = document.createElement('template'); - -template.innerHTML = ` - - - -` - -class profilePic extends HTMLElement { - constructor() { - super(); - - this._shadowRoot = this.attachShadow({ 'mode': 'open' }); - this._shadowRoot.appendChild(template.content.cloneNode(true)); - this.$profilePic = this._shadowRoot.querySelector('#profilePic'); - } - - static get observedAttributes() { - return ['url']; - } - - attributeChangedCallback(name, oldVal, newVal) { - if (oldVal != newVal) { - this[name] = newVal; - this.render(); - } - } - - render() { - this.url ? this.$profilePic.src = this.url : null; - } -} - -window.customElements.define('wc-profile-pic', profilePic); diff --git a/public/js/webComponents/toot.js b/public/js/webComponents/toot.js deleted file mode 100644 index c53ea6b..0000000 --- a/public/js/webComponents/toot.js +++ /dev/null @@ -1,136 +0,0 @@ -const template = document.createElement('template'); - -template.innerHTML = ` - - -
- -
-
-
-
- -
-
-

- -

-

-
-
- -
-
-
-
-
-
-` - -class toot extends HTMLElement { - constructor() { - super(); - - this._shadowRoot = this.attachShadow({ 'mode': 'open' }); - this._shadowRoot.appendChild(template.content.cloneNode(true)); - this.$toot = this._shadowRoot.querySelector('#tootContainer'); - } - - static get observedAttributes() { - return ['author_name', 'author_username', 'author_url', 'avatar_url', 'toot_content', 'toot_url', 'publish_date']; - } - - attributeChangedCallback(name, oldVal, newVal) { - if (oldVal != newVal) { - this[name] = newVal; - this.render(); - } - } - - render() { - this.$toot.querySelector('#author-link').innerHTML = `${this.author_name} (@${this.author_username})`; - this.$toot.querySelector('#author-link').href = this.author_url; - this.$toot.querySelector('wc-profile-pic').setAttribute('url', this.avatar_url) - this.$toot.querySelector('#toot').innerHTML = this.toot_content; - this.$toot.querySelector('#publish-date').innerHTML = this.publish_date; - this.$toot.querySelector('#toot-link').setAttribute('href', this.toot_url) - } -} - -window.customElements.define('wc-toot', toot);