[Request] Default hide button for translation of example sentences


#1

My Japanese is finally getting well enough to make sense of (some) example sentences you can find in lessons, but as I’m trying to skim through them, I noticed one thing that is really bothering me: The translation is right beneath. Even if you try not to look at it (with is btw impossible when the sentence is a bit longer), most of the time certain words will just leap to the eye. Which makes the point of trying to translate on your own kind of redundant. 

Would it be possible to include a “show translation” button to the page, so the translation is hidden by default? Or is this whole example paragraph a single text block you can’t divide? Tbh I have no idea of coding ^^’ 


[Userscript]: Hide Context Sentence Translation
#2

If you can email me the html of a lesson page, I can take a look to see if it’s easy enough to implement.  I don’t have lessons anymore, so I can’t look myself.


#3

sure thing. Thanks for checking!


#4

I currently have no reviews or lessons either, I’ll check when my next lessons come up (maybe 5 days?).

If it’s anything like the example sentences provided on the individual vocab pages, it should be cake to do this.
For example at https://www.wanikani.com/vocabulary/%E6%B9%AF%E6%B0%97  we have div.context-sentence-group > p,ja + p 
I have a feeling the markup would be very similar for the lesson item info.

I’ll make an extension or copy the markup for rfindley if I have too much work next week :stuck_out_tongue: 

(Also, good idea!)


#5

I just checked and the markup is the same for lesson pages. It should really be easy for someone with decent js/html knowledge.


#6

Yesss this is a good idea. Thank you OP, thank you code m@sterz. 


#7

https://greasyfork.org/en/scripts/14844-wanikani-hide-context-sentence

I’m only able to test this on vocab item pages, not on lesson pages, so I’m not entirely sure if it looks good on the lesson pages.  But it should work, at least.
The English translation should be covered with a gray box, which will disappear when you hover over it.


#8
rfindley said... https://greasyfork.org/en/scripts/14844-wanikani-hide-context-sentence

I'm only able to test this on vocab item pages, not on lesson pages, so I'm not entirely sure if it looks good on the lesson pages.  But it should work, at least.
The English translation should be covered with a gray box, which will disappear when you hover over it.
 It works, but i suggest you make a new post about this or not many people will find it.

#9

This is great rfindley, thanks. Works perfectly.

What a sweet, elegant and simple solution. I looked at this a while back and went down an awful rabbit-hole of mutation observers (which failed anyway).

I just added the line:

// @include     https://www.wanikani.com/review/session*

So it works on reviews too.

Thanks for sharing it.


#10
Mempo said...

 It works, but i suggest you make a new post about this or not many people will find it.


Yeah, probably so.  I’ll see if there’s any additional feedback in the next half day or so, then will post a new thread.

hoovard said…// @include     https://www.wanikani.com/review/session*
Good idea.  I didn’t even realize context sentences were on the review pages, because I use an external system for studying.

v1.0.1
 - Added support for Review pages.

#11


v1.0.1
 - Added support for Review pages.
 Nice, thanks.

Thanks to Umbrea for suggesting this too, it's a really good addition.

#12

Great! Thanks rfindley!


#13

Wow that was really fast, thanks so much rfindley!
Edit: Just took a look at it and it works perfectly. :slight_smile:


#14

+1 on how elegant rfindley’s solution is. Really nice :slight_smile: