aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/frame.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js/frame.js')
-rw-r--r--ext/fg/js/frame.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js
index c8528fe7..4d126b94 100644
--- a/ext/fg/js/frame.js
+++ b/ext/fg/js/frame.js
@@ -36,9 +36,21 @@ function registerActionLinks() {
}
}
-function domContentLoaded() {
+function onDomContentLoaded() {
registerKanjiLinks();
registerActionLinks();
}
-document.addEventListener('DOMContentLoaded', domContentLoaded, false);
+function onMessage(e) {
+ const {action, data} = e.data, handlers = {
+ 'disableAction': ({mode, index}) => {
+ const matches = document.querySelectorAll(`.action-link[data-index="${index}"][data-mode="${mode}"]`);
+ matches[0].classList.add('disabled');
+ }
+ };
+
+ handlers[action](data);
+}
+
+document.addEventListener('DOMContentLoaded', onDomContentLoaded, false);
+window.addEventListener('message', onMessage);