[UserScript] WaniKani Old Header

Since a number of folks are asking. Put this together for fun more than anything else, but…

Brings back the old header, mostly.
Currently doesn’t get smaller when scrolling down, although it does sticky.
Gets smaller when scrolling down, but a bit ugly if lessons/reviews >99
Also a bug currently, where themes or custom CSS may cause the header to overlap onto the main contents a bit.

Oh, and most likely any scripts that affected the header will be dead when the authors update for the new UI.

Additional Notes:
1: Needs Open Framework for level number. Will try and get rid of this requirement. Hopefully @Viet doesn’t take the js away
2: Due to a brain fart, your user icon will appear as my Batman icon.

19 Likes

Could we get an image on how it looks? :slight_smile:

I’m at work now, so can’t really grab one. But here’s an shot from during development. Just ignore the dev console at bottom, and the new header still being there. Pretend those two things are gone.

1 Like

It’s great! Just 2 things. :stuck_out_tongue:


(this is in my account)

The level 0 thing, and the picture, in case it’s not obvious. :joy:

5 Likes

Oh shoot, didn’t even consider the user icon. Hardcoded as mine, unintentionally. Level should update after a couple seconds if Open Framework is installed. Got an idea to not need wkof, but need to try it out.

4 Likes

Oh, this is the first script I install. :stuck_out_tongue: So I don’t have anything else.

I also have a principle of not installing scripts, so mostly just wanted to test this out. :slight_smile:

window.WaniKani.studyInformation.user_information.level
?

Didn’t think of that, but it’s a good idea.
I was planning to steal it from within the account menu, since it’s displayed in there.

Yeah, not too long ago they starting putting some pretty useful (but basic) information on window.WaniKani.

Do they have username there? If so, I should switch wkof to use that.
I haven’t been in the source code of WK for a while.

Hmm this doesn’t seem to work because the script doesn’t find jQuery on my page (?)

While that should be easy enough to fix I’m curious that I don’t see any other comments here about the script not working o.o

Thank you thank you thank you! :partying_face::partying_face:
My level is displayed correctly, but I do have a cool new Batman icon!
It works perfectly for me! :partying_face::partying_face:

Yep. Here’s the whole object so you know what’s available:

{
	"studyInformation": {
		"user_information": {
			"username": "seanblue",
			"gravatar": "6dc12697dcf00524d3a9e46e6484c7a8",
			"level": 60,
			"title": "Turtles",
			"about": "",
			"website": null,
			"twitter": null,
			"topics_count": 0,
			"posts_count": 0,
			"creation_date": 1473374904,
			"vacation_date": null
		},
		"requested_information": {
			"lessons_available": 0,
			"reviews_available": 105,
			"next_review_date": 1558628540,
			"reviews_available_next_hour": 1,
			"reviews_available_next_day": 64
		}
	}
}
2 Likes

Is it on purpose that the match is https://www.wanikani.com/ and not https://www.wanikani.com/* ?
It’s a little weird that it changes back when you go to items pages etc :thinking:
Added it to my user matches and was wondering if I broke anything :see_no_evil:
Thanks for making this c:

Thank you so much for this script :sob: I love it but right now it only works on the main page. Any way to make it work on the whole site (like the radicals/kanji/vocab pages)?

Good catch. One second.

Updated. Though I can’t test, since I’m on my phone. Might cause issues during reviews/lessons…

@Makise_Kurisu

2 Likes

Guess I’ll add an exclude for WaniKani — Log in* and WaniKani — Log in* just to be sure °-°/
Thanks again.

@viet Didn’t window.WaniKani.studyInformation used to be set on any page that showed the header bar? I think it must have, because I was using it for the Real Numbers script (to not show 42+) and I never heard a complaint saying it didn’t work outside the dashboard.

Right now it’s not set on specific kanji pages (for example), which makes it not that useful. I’d guess it’s only set on the dashboard right now. I think it would need to be available on all pages (except maybe reviews/lessons) to be useful all around. Let me know if this actually worked this way (or if I’m going crazy :laughing:).

CC @DaisukeJigen @rfindley

1 Like

Thank you! It works everywhere now.

Yeah, we used to apply the counts via javascript using window.WaniKani.studyInformation. It has been dropped in favor of adding the count server-side during rendering. So you shouldn’t be seeing it on any page. Can you point to a page that has it?

1 Like