SakeTami
Touhou-Project.com
Touhou-Project.com

patreon


Blowing Away the Cobwebs

Hey all, hope you’ve been well. It’s been a little while since my last post and there’s been good reasons for that. The first, and more boring, is that I’ve been busier than usual and haven’t been able to put in the extra time I usually do each month into working on site stuff. The second reason, however, is because of the nature of the work I’ve been doing.

As I mentioned in previous posts, I intended to be working on user-facing parts of the site. And so I have. While a lot of it is still a work-in-progress, I’ve generally been playing around with the site’s appearance and the interrelated systems that hold things together. I’ve gotten a few things done and, as of a little before this post, these changes have already made it onto the live site.

It’s no secret that THP’s software was originally made over a decade ago and things like offering a good experience on mobile was never considered. Over the years I’ve made my own improvements and worked hard to make sure that the site is usable on any sort of device. That’s why, for example, the old checkboxes that needed to be marked to delete or report a post have been hidden on smaller screens for some time now, and instead these users can click on a button next to a post to bring up those functions. Likewise, things like thread watching or expanding all images haven’t used the old, small and difficult to press, buttons for years and instead a little dropdown menu on the first post gives users access to that.

Why am I mentioning those examples, specifically? I’ve taken their implementation to the next logical step, folding in further functionality into menus that are accessible on every post. Deleting, reporting, watching, finding the source of an image, etc are accessible under the same button that used to be restricted only to the original post. The old checkboxes and submission buttons at the bottom of the page are gone—it didn’t make sense to keep old, somewhat complex code around when I could simplify maintenance as well as provide a uniform experience to all users.

It might not seem obvious but the patchwork nature of THP, made with static HTML as the primary asset that users would load, makes it so a lot of work is needlessly complex and often duplicated. By eliminating the old deletion/report system fully, I was able to clean up some of the templates which, in turn, allowed me to rework on some of the user scripts and well… before I knew it over 28 files had been modified in some manner in the latest round of changes.

A lot of cleanup followed, generally, with references to removed classes and ids removed from the style sheets as well as the scripts. Not to mention changing up variables and simplifying a lot of the input for certain processes. I took the time to further consolidate and refractor some other code and, in one case, removed very similar/duplicated code from three template files into a single other template that could be referred to as necessary. With a little patience and much testing, I was able to cut away several hundreds lines of code. Of course, I was responsible for some of that mess but the bulk was legacy structure and stuff from years ago.

As I mentioned, there’s still more work to come and some that’s half-finished but I think that this little spring cleaning was well worth it. It’s nice to have more consistent variables and less junk to sift through whenever I’m trying to work on a specific feature. The new additions, particularly, the ones for the user-facing parts of the site, are all geared towards providing that aforementioned consistent experience and every little bit helps. I hope to one day not to have any “special” code for mobile users and be able to build on the site without having to worry about divergent experiences.

But well, before I forget, there is also a small feature that I think will be somewhat useful for writers:

The button will take you to the user page, it’s both a shortcut and a reminder that editing posts is possible. While it would be “ideal” to edit-in-place, it would require an unacceptable amount of code complexity to an already somewhat-bloated user script. Further improvements are best left for when there’s a proper overhaul of how THP is used. But, well, in the meantime, the implementation is clever enough to only make the button appear for updates and for a limited time before posts are non-deleteable (and thus, non-editable).

There’s been a few improvements on the moderation side of things as well, though these are mostly minor and mostly compatibility changes with the new menus. More interestingly, I ended up fixing a subtle bug that had been messing with thread archival. Posts were missing in some threads and there were no errors or anything and so it was chance that I noticed. To make a long story short, I ended up partially rewriting how soon-to-be-archived threads are handled. But before that, I spent a good deal of time narrowing down which threads were affected and cross-checking with various backups to restore the threads. My first solution to rebuild these (twenty or so) threads worked just fine for all but one thread. Still I took the time to reference other backups, look in the wayback machine etc to see if there was something else missing.

Just goes to show how I’m never really just doing any one thing. In the same vein, I also changed the default preset for a color scheme because a user complained about text being illegible under some circumstances and that changing colors manually was impossible. This was due to the browser used and their implementation of the HTML color element standard. It’s always annoying to have to work around specific vendors’ bugs or incomplete feature sets and, sadly, this isn’t the first time I’ve had to end up finding an alternate solution. Given the great market share of Chromium-based browsers, most of the non-standard behavior I’ve encountered has been limited to them but this issue happened on mobile Firefox, showing that no one is really immune.

I’m not sure when I’ll have some more things ready. I’m tentatively aiming for one or two little things before the end of the year but, failing that, I expect that early next year I’ll have more to share. Until then, I hope you enjoy using THP and please take it easy!

Comments

Thank you so much for the work you do!

Benjamin Oist


More Creators