I know how to add elements to the question area manually.
window.addEventListener('didAnswerQuestion', (ev) => {
let divQuestion = document.querySelector("#turbo-body > div.quiz > div > div.character-header.character-header--vocabulary > div > div.character-header__characters");
divQuestion.insertAdjacentHTML('afterend', `<div class="reading-with-audio__reading" lang="ja">${reading}</div>`);
})
But it’s pretty untidy, and I must manually delete the div later when moving to the next question.
Are there any existing user script frameworks that will help to manage adding objects to the question area? It’s just quite untidy to do so much manipulation.
I’ve only made one extension so far myself and am not too familiar with the WK Open Framework yet, however, I don’t see too much wrong doing it this way. For starters, though I would recommend creating a permanent div (under character-header__content instead of character-header__characters) for the pitch accent and then toggling the display of it whilst changing it’s content upon an answer (instead of creating a new one and deleting it each time):
(note that this code obviously won’t work, I have no idea how to actually hook into answer / continue events)