// ==UserScript== // @name Show answer by typing "あ" // @namespace http://tampermonkey.net/ // @version 0.2 // @description When making a mistake, while reviewing, also show the correct answer, when "あ" is pressed. // @author You // @match https://bunpro.jp/study // @icon https://www.google.com/s2/favicons?sz=64&domain=bunpro.jp // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; var input_field = document.getElementById("study-answer-input") var show_answer_label = document.getElementById("show-answer") var alternate_answer_label = document.getElementById("alternate-grammar") function on_japanese_a(event) { if (!event.data.endsWith("あ")) return input_field.value = event.data.substring(0, event.data.length - 1) if (show_answer_label.style.display == "block") show_answer_label.click(); if (alternate_answer_label.style.display == "block") alternate_answer_label.click() } input_field.addEventListener("input", on_japanese_a) })();