Developer Diary, World Biodiversity Day
Today marks the International Day for Biological Diversity, celebrating what biodiversity we have and promoting issues impeding it.
If youâd prefer something more concrete, California celebrates Harvey Milk Day, in memory of the assassinated gay activist and politician. Given current political attempts to criminalize and otherwise marginalize gender and sexual minorities, I can think of worse plans for your day.
On to programming.
Morning Dashboard
I finished the current work on adding my graphs, specifically making the calls to insert the pedometer analysis, and adding the relevant fields to the configuration file.
As usual, I canât guarantee that your setup will work enough like mine that this code will do anything useful for you, but I think that I have it modular enough that you shouldnât have much trouble following it, if it might help you.
Entropy Arbitrage
GitHub - jcolag/entropy-arbitrage-code
Hm. It seems that, last week, I may have jumped the gun. In last weekâs developer diary post, I spent about five hundred words talking about the fancy new plugin that I wrote for the blog to insert emoji, so that you can interact with them like this face đ, rather than a flat emoji character. As mentioned, when you hover over the emoji, itâll zoom in and show a âtitle textâ tool tip, to make it clearer what Iâve added.
And yet, somehow, I hadnât pushed those changes out to the repository. I did so, this week, so you might want to review the linked post from last week, if you want a walk-through on some issues, there.
You might notice, then, that Iâll occasionally need to commit updates to my emoji âdatabaseâ (a JSON file), particularly when I give one a name thatâll cause less trouble in typing. For example, manyâbut somehow not allâof the emoji âofficialâ names in the file have underscores in the words, instead of spaces. Instead of learning what magic rule distinguishes the two, I find it far easier to add a line to the file without the underscore characters. Or in other cases, if I find a character getting a lot of use with an obscure name, I may give it a clearer name. For example, I probably wouldnât use âcouple-with-heart-woman-womanâ đ©ââ€ïžâđ© much, but if it ever comes up again, calling it something like lesbian couple would make for a far more guessable term.
Boring CSS
I didnât expect to revisit Boring CSS at all, since it looked complete to me, but appearances can, in fact, deceive. And, other than having the entire CSS specification committed to memory, I can only see one way of discovering those gaps: Using it.
And, in fact, using the CSS files in the Mastodon Tool Trunkâs Rummagerâfor more on which, see the next itemâturned up a glaring omission. I didnât handle buttons in their :active
state, so the user got no visual feedback on clicking them.
I went with variations on this.
button:active,
input:active,
input::file-selector-button:active {
border-style: inset;
filter: brightness(80%) saturate(80%);
}
Iâll need to investigate further, to make sure that my quick-and-dirty result matches the design languagesâit almost certainly doesnâtâbut it works for now.
Mastodon Tool Trunk
The Rummager looks better by the day.
I fixed one error that I should have caught long before. Specifically, I moved the JavaScript file into a subfolder, because I expect to add a new file, soon. However, when I did that, I didnât think to change the reference in the HTML file to match it, then took a few days off working on it, so I didnât spot the problem.
More importantly, I populated the still-not-in-use buttons for each tootâthe number of likes, boosts, and so forthâadded a basic version of Mastodonâs preview of the most prominent linked website (the âcardâ) behind a collapsible details
element, and moved the media into similar details
elements and into the toot.
I donât consider the layout perfect, by any means, but it now displays pretty much everything for the initial load of toots, unless Iâve overlooked something.
Speaking of the layout, it seems worth mentioning that I feel like this project vindicates a lot of my motivation for creating Boring CSS. Without wasting time on picking colors or messing around with the overall styling, I still have a fairly decent-looking app while I focus almost entirely on making things work. And when, eventually, I need to think about a ârealâ CSS framework, I wonât need to rip out any existing CSS classes to support the new scheme.
Next
Iâll mostly continue on with the Rummager. For the most part, I expect four major tasks over time.
- Connect the buttons, so that clicking them calls the relevant API endpoint.
- Store the list of viewed toots, and probably a last-run timestamp, to Pantry.
- Load all toots since the last-viewed toot.
- Exclude previously viewed toots.
The first task may use HTMX, which seems like the latest iteration of what (at least) the Ruby on Rails people used to call âunobtrusive JavaScript.â Iâd prefer a library that doesnât require dumping so much information into the HTML code, but for such a small library, I can at least give it a try, especially if it handles state changes without the organizational overhead of something like React; I like React, but I donât want to waste time maintaining the build process and maintaining dozens of component files. This all may also mean that Iâll give HTMX a try and then rip it out, so it may take the entire week on its own to go nowhere. Weâll have to see.
At the end of this work, though, I should have a chronological list (not reverse-chronological like most social media) of toots, that doesnât include any repetition. I have other kinds of toots that I want to eventually excludeâboosts for toots older than a couple of days, for example, or those dominated by an image with no descriptionâbut this should work as a starting point. I almost never see value in those messages, especially the old toots that I have surely seen before, so skipping them will save me the time of recognizing them.
At some point, I should also add a way to submit a configuration file and retain it in the browserâs local storage. Thatâll let me deploy the page to someplace like GitHub Pages for other people to play without worrying about security.
Credits: The header image is Fungi of Saskatchewan by Sasata, made available under the terms of the Creative Commons Attribution Share-Alike 3.0 Unported license.
By commenting, you agree to follow the blog's Code of Conduct and that your comment is released under the same license as the rest of the blog.
Tags: programming project devjournal