Custom SRS Level Names Feature (or userscript)

Just asking for a user-side aesthetic change, not deck based.

Edit: User-script would probably be better but I can’t do it myself as I have the technical skill of a late middle-aged man

2 Likes

I think this would work best in a userscript form. I’d like to keep the SRS rank names the same for everyone to make it easier to talk about.

3 Likes

I agree. While the differences in level meanings don’t matter too much, it’s already separate enough as it is with the fact that everyone is studying differently. But I agree, a userscript to change the level names might be good. Any advice on making userscripts?

2 Likes

Because Kitsun is a SPA it does not refresh the page upon navigation, so it needs a bit of a workaround for you to check the page:

    (function() {
        var pS = window.history.pushState;
        var rS = window.history.replaceState;

        window.history.pushState = function(a, b, url) {
            run(url);
            pS.apply(this, arguments);
        };

        window.history.replaceState = function(a, b, url) {
            run(url);
            rS.apply(this, arguments);
        };

        run(window.location.href);
    })();

    function run(url) {
        if (url.endsWith('cards/manage')) {
            document.addEventListener('keydown', onKeyDown);
        }
        else {
            document.removeEventListener('keydown', onKeyDown);
        }
    }

^ Example I found online, modified by @seanblue. Maybe there’s a better way, or maybe I can add something to Kitsun that makes it easier to do this. I’d love some input on this :slight_smile:

2 Likes

You could fire off an event every time:

  • the page changes
  • a popup is opened
  • a popup is closed

The event would include additional data to indicate the page or popup. This would allow userscripts to listen for that event, and then conditionally add/remove their own events/UI/whatever based on if the Kitsun event matches the page they want to affect.

1 Like