aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/frame.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-05-04 20:08:22 -0700
committerAlex Yatskov <alex@foosoft.net>2016-05-04 20:08:22 -0700
commitbc11e7cbe3a3a3c57967f78933302f7a06dfde24 (patch)
tree06bba5ddc6ef96382fbc652da35d5e94ac5a2538 /ext/fg/js/frame.js
parent320d9bca0e2f4e4a66e58672898722dfeb28f7d4 (diff)
Add note links
Diffstat (limited to 'ext/fg/js/frame.js')
-rw-r--r--ext/fg/js/frame.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js
index 66932c2c..c8528fe7 100644
--- a/ext/fg/js/frame.js
+++ b/ext/fg/js/frame.js
@@ -26,4 +26,19 @@ function registerKanjiLinks() {
}
}
-document.addEventListener('DOMContentLoaded', registerKanjiLinks, false);
+function registerActionLinks() {
+ for (const link of [].slice.call(document.getElementsByClassName('action-link'))) {
+ link.addEventListener('click', (e) => {
+ e.preventDefault();
+ const ds = e.currentTarget.dataset;
+ window.parent.postMessage({action: 'addNote', data: {index: ds.index, mode: ds.mode}}, '*');
+ });
+ }
+}
+
+function domContentLoaded() {
+ registerKanjiLinks();
+ registerActionLinks();
+}
+
+document.addEventListener('DOMContentLoaded', domContentLoaded, false);