[Userscript] Level Duration 2.0

Eyyyy its not too bad actually, here’s a step by step for changing level text:

  1. Make sure you have the updated script first.
  2. Replace: let date, level_duration;let date, level_duration, level_current, level_text;
  3. Update the following functions
function fetch_date() {
            return wkof.Apiv2.fetch_endpoint('/level_progressions').then(data => {data = data.data.pop().data; date = data.unlocked_at; level_current = data.level;});
        }
function install_display() {
            level_duration = document.createElement('div');
            level_duration.className = 'level-duration';
            level_duration.innerHTML = '<span></span>';
            let target = document.querySelector('.sitemap .sitemap__section-header[aria-controls="sitemap__levels"').parentElement;
            let old_target = document.querySelector('.dropdown.levels')
            if (old_target) { // Support for old header script
                level_duration.className = 'level-duration-old';
                target = old_target;
            }
            else level_text = target.firstElementChild;
            target.append(level_duration);
            //Update moved further down to be after assignment of level_text
            update_display(level_duration, date);
            setInterval(update_display, 1000*60*15); // Update every 15 minutes
        }
function update_display() {
            let text = format_date();
            level_duration.children[0].innerText = text;
            level_text.firstElementChild.innerText = "レベル " + level_current;
            level_text.lastElementChild.innerText = "Level " + level_current;
        }
1 Like

Changing the font is literally just adding one line, Add font-family: [font name]; under font-size: 14px;
Screenshot from 2020-05-19 23-46-49

The name of the font can found be opening your font file (file.ttf or file.otf) and going to its info page. Here’s what mine looks like on linux:

Yeah. I could easily make the buttons look like they should and not obstruct the level duration indicator, but it’s really something that should be done in Breeze Dark itself. I might just post a fix for Breeze Dark myself, though.

If you go back to where you installed the script there should be a button to update instead of installing. If you wait long enough they will also update on their own.

Omg I didn’t even notice that you added the level in your original post :sweat_smile:

I don’t think I will make that a native feature, though, seeing as it obscures that it’s actually a drop down list. There are separate level indicator scripts already.

Hmm, if others are asking for the font maybe I should include it as an option

1 Like

Ooooh what if you allowed users to type the name of a font on their system into the menu. I’d def appreciate.

I think that’s too much effort for the average user, so I was thinking just another formatting option for that specific font

True, true. Def true

1 Like

Added it as a separate format. If a user wishes to change the font out for another, they just need to change out the font family in the CSS

Thank you, I found it. Also thank you for the script btw. It’s really neat

1 Like

Thanks for the detailded description! But I have to admit defeat yet again. I tried interchaning the code as you did, but since there was another update it didn’t properly work after that. When I tried finding only those lines of code, that would affect the current level data, it broke completely, so yeah. If you were to go through the trouble of readjusting the current level display to the new version, I’d be happy if you could share that with me. But I understand, if you don’t.

2 Likes

Btw @Kumirei and @ToastedRice , I just read through your conversation and even though I’ve got quite a few friends actually, who can code as well, I’m still amazed every time I can witness this magic.

2 Likes

Revised instructions

EDIT: I missed a line in the last one

1 Like

Thanks for all the hard work Kumi :slight_smile:
And yeah @zEUs_japanese, make sure to follow step 2, otherwise it won’t work at all. You just need to add level_current, level_text to the other variables. But if you’re still having trouble after that, you can just copy the full script here.
Also always happy to help ^^.

1 Like

image
Nice XD, it finally works! Thank you very much, Kumirei.

1 Like

In case you’re using Tampermonkey @zEUs_japanese, for future reference you can update all your scripts by clicking on the extension icon and selecting “Check for userscript updates”.

1 Like

Oh, you’re right. Thank you

image :upside_down_face: this is fine

4 Likes

Y do u have so many reviews? It seems like u don’t manage ur daily reviews properly since they seem to have piled up. Do u still have this problem in 2023?

I think the new update broke this script

Edit: nevermind! A separate script was turning it off