I wrote a simple script to study forming sentences in the Cram page

Hey,

I believe forming the Japanese sentences from English translation yourself is one of the best ways you can study but there is no such option in Bunpro. So I wrote a user script to somewhat achieve that, it’s ugly but hopefully works.

Script basically do two things, in the Cram page:

  • It hides the Japanese translation completely until you answer the quiz (by using submit button),
  • It shows all hints/English words.

So basically you only see the English translation, you translate it to Japanese in any way you want, Kanji, kana or romaji, doesn’t matter, when you click on the submit button it shows the japanese sentence. It doesn’t check if your answer is correct at all and because you enter the full sentence into the answer field, Bunpro will always say “wrong answer”. You have to compare it to the correct answer yourself.

I think it’s a decent option to study so I wanted to share. You need to use any browser extension for user scripts (I use “User JavaScript and CSS” in Chrome), copy paste the code and make sure you only enable it on the Cram page. Also you need to disable the script to use the website normally. If you don’t disable it, it will cause issues in Review / Cram pages.

Here is the code:

setInterval(function(){ 
	// Shows all English translation and hints
	if (document.getElementById("show-english-hint").value != "Hide") {
		document.getElementById("show-english-hint").click();
	}
}, 100);
	

setInterval(function(){
	// Hides the Japanese translation until you submit your answer
	var item = document.getElementsByClassName("study-question-japanese")[0];
	if (document.getElementById("study-answer-input").style.background == "") {
		if (item.style.display != "none") item.style.display = "none"
	} else {
		if (item.style.display != "block") item.style.display = "block"
	}
}, 500);
7 Likes

great, I have never used cram, maybe I will now

can you post screens how it shows?

Well, like I said, it simply hides Japanese translation until you use the submit button. And when you use the submit button, it shows the translation:

Do you think in the future there will be a way to have the system mark an answer as correct or not so when you wrap up, you’re able to remember what you need to work on? Or is this something that’s just not possible? No idea if you’d be able to pull the answer from the system or not, maybe something from the admin side could help you out.

It may be possible but as a script it would so much time to make, especially when you consider there are multiple ways to say the same thing, so I can’t do that basically.

It’s even hard for Bunpro to implement it so I wanted make this kind of hack. I don’t think Cram page saves the result of your answers anyways so even if script could tell your answer is correct or not, nothing would change. Only viable way would be Bunpro asking you if you got the correct answer or no like in typical flash card way.