[Userscript] Book Club Tracker

Thanks for the info! Should be fixed in the just-released version :slight_smile: I hadn’t realised the “New & Unread Topics” list at the bottom of the page also displays the categories, so it was finding “Book Clubs” there sometimes…

2 Likes

Can’t believe I just found this extension!! I used to keep track of these by myself and I was in like 5 clubs so it was so annoying!! The book club I run for 月刊少女野崎くん is starting its next volume soon, so I’ll post about it when I make the thread! Thank you for making this!!

3 Likes

I’m glad you like it! Let me know if you ever have any suggestions for it :slight_smile:

2 Likes

No idea if this is possible/reasonable, but I know myself and several other people here on WK are also in book clubs on the Natively forums. I think they run off of the same forum software and have the same layout structure (though I may be mistaken!). Would it be possible to extend the script to include Natively? If not, no worries, this is already useful enough!

2 Likes

Should be possible, I’m away from my PC for a couple of days but will get it updated as soon as I get back!

2 Likes

Just a heads up, I don’t know when this happened because I only just installed the script, but the class name for the categories is no longer category-name, so the button doesn’t get added to book club threads. It is now badge-category__name.

2 Likes

Oh damn must’ve happened recently, it was working a couple of days ago. Thanks for letting me know!

Yeah I just noticed other style changes here on the forums too (like collapsible details), so it must have been very very recent and I just got (un)lucky that I chose to install it right after.

1 Like

Should now be fixed in 0.5.7! And opening up this script code again has reminded me I need to get some more features added next week when I have time again, like auto-setting finished clubs to inactive and getting it to also work on the Natively forums…

1 Like

Looking forward to it! There are a couple of things I’m going to try and spend some time modifying/adding myself, but I’ll mention them here in case you think they’d be good to add.

  • Get rid of any instance of location.reload because from the very first time that happened I was mildly annoyed; I’m gonna go a bit overboard here and try adding reactivity and state management in these instances.
  • Make the clubs collapsible. [+Collapse/Expand All toggle button]
  • Add toggle for hiding completed weeks OR make a ‘compact view’ that only shows the current week.
1 Like

All those are planned features :slight_smile: (the reloading annoys me loads as well - it was simply the fastest way to get it working).

You’re free to add it yourself in the meantime of course though, it’ll take me a week or two as I’m prioritising getting a custom SRS script working (I’ve decided it would be very useful for book clubs!). I will get to this script fairly soon though as I only have a few major things left to do to get a first working version of the custom SRS one.

Also, if you come up with any other ideas let me know and I’ll see what I can do!

1 Like

Oh great! That’s good to know. As a learning exercise for myself I’m still gonna try and rewrite some things using Svelte, maybe even Typescript; I’ve already got ideas on how to componentize things :3

One last thing that just came to mind: I’d like it if a club being Inactive didn’t like ‘disable’ it. Let me explain. So far the ones I have added are no longer active, they’ve finished; but I still want to read them, so I don’t want to mark them as inactive. To me it would make more sense to have Active/Inactive status be separate from Reading status. That way, when you mark something as finished reading it collapses, but you can tell whether the book club itself is active or inactive independently of that.

1 Like

Hmm, that’s an interesting point. I was imagining the active/inactive to refer to whether you’re actively participating/reading or not, mainly because I didn’t want to make assumptions around how long the last week lasts (because the book club tables obviously don’t tend to have a specific end date marked on the main schedule table - I could just take the average time between previous weeks which will usually be exactly that - a week - but I was hesitant around whether I actually wanted to assume that) and I’d rather not have two toggles you have to manage. But I’ll have a think and see what I come up with.

I’ve played around a bit with Typescript before but am still struggling to see the benefits over pure JS for smaller projects like this :sweat_smile: I’m sure I’ll be converted one day though…

Oh I’m kind of with you there. For a small project like this I don’t think using TS here provides any benefit. It’ll purely be for learning purposes for me. I got a bit of a taste of what working with TS is like when I made a PR to Reorder Omega, and when I was trying to fix Lesson Filter by looking at what Queue Manipulator does I found myself wishing Queue Manipulator was in TS because it was so much more complex than what I was used to and it was hard to keep track of some things; that was a small aha moment for me where I started to realize why TS could be helpful.

1 Like

0.5.9

  • Removed most unnecessary page reloads (only creation reload left)
  • Improve some CSS
  • Error catching for broken clubs in storage
3 Likes

So I’ve discovered a weird issue. The Add button wasn’t showing up for me consistently here on the forums. For example, I went to the Takagi-san thread and it wasn’t there at first; I refreshed and then it was; I refreshed again and it disappeared again and then never came back no matter how many times I refreshed.

It turns out it wasn’t showing up because it thinks the nodeList for the badge-categories is empty. Why does it think this when inspecting shows that they have the right classes? Well apparently it’s because the document returned by the GET doesn’t have the updated class name; it still uses category-name. But it’s only like this while the document is in “interactive” readyState; if it reaches “completed” we’re all good.

So I put a little {sleep for 1s if readyState is interactive} line in checkPage and now the button seems to get added consistently.

Also! I got the date-rolling-over-into-the-next-year thing working. Using the thread creation date was indeed the key as suggested and very very helpfully the timestamp is included as a data- attribute on the span containing the date.

// under: let possibleTables = ...
let threadCreatedDate = new Date(parseInt(document.querySelector('#post_1 span[data-time]').getAttribute('data-time')));

// around let startDate = ... | changed getFullYear() to use threadCreateDate; added line to reassign date if months suddenly go backward
if(!startDateText.match(/\d{4}/)) startDateText += " " + threadCreatedDate.getFullYear();
let startDate = new Date(startDateText);
startDate = startDate.getMonth() < threadCreatedDate.getMonth() ?
    new Date(startDate.getFullYear() + 1, startDate.getMonth(), startDate.getDate()) : startDate;

You can check that it works using the Cells At Work thread.

2 Likes

Hmm interesting, I’ll take a look as soon as possible! And I’ll also get that fix for the dates added in… Thanks!

0.6.0

  • Added settings panel

  • Added show full height / scroll setting

  • Added compact mode setting (scroll with SHIFT + scroll or the buttons):

  • Dates from forum now work correctly when rolling into next year (thanks @LupoMikti)

  • Other small code improvements

7 Likes

0.6.3

  • After much experimentation - permanent fix for WK icon changes, now using a custom icon script!

Just in case anyone were to ever want to use it for any reason, the custom icons script just needs to be @require’d in the format // @require https://greasyfork.org/scripts/489759-wk-custom-icons/code/CustomIcons.js?version=1342522, making sure the version number is up to date. You can then just use the functions Icon.customIcon("iconName e.g. chevron-up") or the equivalent function Icon.customIconTxt (that returns the same but as a String rather than an element) to get a correctly formatted instance of that SVG.

4 Likes

Awesome! I think the script is deserving of its own post since many dashboard scripts are going to need a replacement for font awesome when it stops working on that page, and other scripts can benefit besides (actually, I think if it just ends up being @required in open framework then any script with an open framework dependency would automatically get access to this as well). That’d also provide a place for people request icons to be added.

1 Like