diff options
Diffstat (limited to 'ext/fg/js/frame.js')
-rw-r--r-- | ext/fg/js/frame.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js index 868f07ce..c8f8211e 100644 --- a/ext/fg/js/frame.js +++ b/ext/fg/js/frame.js @@ -17,3 +17,17 @@ */ +function onKanjiQuery(kanji) { + alert(kanji); +} + +function registerKanjiLinks() { + for (const link of [].slice.call(document.getElementsByClassName('kanji-link'))) { + link.addEventListener('click', (e) => { + e.preventDefault(); + onKanjiQuery(e.target.innerHTML); + }); + } +} + +document.addEventListener('DOMContentLoaded', registerKanjiLinks, false); |