NokiMo
Touhou-Project.com
Touhou-Project.com

patreon


Leveling and Less Bloat

Hey, hope you’re well and keeping sane if you’re quarantined. I’ll be talking about some of the things I’ve done since the last time I posted. For sake of convenience, we can broadly divide them up into three categories.

The first of these categories is the work done to integrate the mobile site to base code. Previously, a special library would check if the user agent of a device matched a mobile browser and other code would execute, loading up elements and adjusting the site to make it look better on smaller screens. This is mostly done away with; the relative width of the screen being favored as the trigger.  

Additionally, the previously ‘exclusive’ stylesheet is now loaded always, changing how the site looks even if you’re just decreasing the size of the browser window. Going by the statistics I gathered, most desktop users will never notice it and, if they do, the changes (hopefully)  make sense on smaller view areas anyways. I feel it’s a good compromise solution without having to rewrite the site from scratch to be mobile-first.  

With display made common, it was then possible to bring in some more features to all versions of the site. There was a rewrite of the navbar which, in turn, allowed for me to hook in the thread watcher into there. It’s been live for over a week now and it works well on my phone but I’ve been keeping an eye out on edge cases and bugs. No one has reported anything thus far which means it’s working fine or no one has noticed. Either way, I’ve built on all those changes to try to make things as consistent as possible. It’s easier to maintain code when it’s shared instead of having different portions for special cases. 

This leads into the second category: simplifying and unifying code. I’ve done a lot of that. A few external libraries were removed in favor for my own solutions and that has meant a net change of about 67KB less in what has to be loaded when a page is opened. I generally dislike bringing in external code and have done my best to minimize that on THP but implementing your own solutions from scratch can be very time-consuming—it’s taken me this long to do away with those libraries for good reason!

Quite a few functions had to be at least partially rewritten as a result of my ditching ready-made libraries. From my testing functionality is about the same, if not better due to specific optimizations, but I did have to go line by line for a lot of the user-facing script to make sure that nothing broke. This is undoubtedly better in the long run but it also requires me to be more directly involved in adding my own libraries and helper functions to a degree. THP’s code base is more of my own but at the cost that any mistakes are clearly on me.  

Some HTML and CSS was likewise simplified but not to a very dramatic degree. Most of the work done there was in support of the scripting to, say, make the watched threads functionality work more consistently. Getting notices when a thread has updated and holding off on stealing focus is made easier when the elements it uses are more cleanly defined. Speaking of, there’s new settings and tweaked wording for them because I never quite know if they’re clearly stated.

That brings us to the final set of changes: new features. I mentioned tweaks and you should infer bugfixes as well but there’s outright new as well. Watched threads for mobile is one of them. As is inline embedded for quoted posts. The latter is something I’ve meant to do for a while and I got around to it because the related HTML was made easier to manage over the also month.  

Simply put: turn on the setting click on a link (e.g >>1342). It’ll put said post into your own post. Posts it quotes or are backlinks can similarly be clicked. Soon you’ve got a russian nesting doll of posts. It’s an easy way to follow a conversation and took some effort to implement.

The basic idea is easy but then you want conditions for less typical cases, like posts that aren’t already extant on the page. You need to call them up asynchronously and then render them in the right place. Oh and it also helps if you limit these embeds from not being recursive. That’s a memory hog and confusing as all hell. After a day of coding and testing, I think I got the feature polished to an acceptable degree. There are some limitations such as backlinks for posts on other boards but I think that’s the sort of thing that no one will ever really need, much less notice.  

All in all, it wasn’t too difficult to get all of this sorted, just time-consuming. There’s more that I want to do in terms of page presentation. There’s room for greeted integration between mobile and desktop views, for one. But I’ve hit enough of my milestones to put that on the back burner for the time being.  

My next goal will be the gradual process of overhauling the story list (finally!). I’ll no doubt talk about that in the future but be warned that it’s going to take a while. And not just only because of the complexity involved.  

Beyond the basics of funding the site every month, this patreon serves as a pool of funds for other activities for the site. Coding is time-consuming and, while it’s something I’d do for the site in my own free time regardless, it’s something that goes faster if I can allocate time that’s not quite-so-free. In other words, being able to allot time for something that’s more than a hobby though not quite work. As much as I would like not to worry about bills, I have to prioritize some things in life over the site. With fewer patrons and less money in the last several months, it becomes more important that I take care of things that put food on the table.  

Again, I’m not saying that I’m going to stop work on the site or anything. I can’t emphasize that enough. I’m just being honest about why things take time to do. Don’t worry too much about it either—in my view this is under the category of “things that can’t be helped”, especially during a pandemic. It just may be a while before I roll out some of the shinier changes that I have in mind for THP. I’ll be trying my best, regardless.

Please stay safe and continue being awesome. Until next time, take it easy!


Related Creators