From bdf231082f4b4ca7c4c90d8b0cd40b6c4201723d Mon Sep 17 00:00:00 2001
From: Alex Yatskov <alex@foosoft.net>
Date: Mon, 14 Aug 2017 21:43:09 -0700
Subject: lots of fixes to backend

---
 ext/fg/js/api.js      | 22 +++++++++++++++-------
 ext/fg/js/frontend.js |  2 +-
 ext/fg/js/popup.js    |  2 +-
 3 files changed, 17 insertions(+), 9 deletions(-)

(limited to 'ext/fg/js')

diff --git a/ext/fg/js/api.js b/ext/fg/js/api.js
index b4d75c3c..174531ba 100644
--- a/ext/fg/js/api.js
+++ b/ext/fg/js/api.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016  Alex Yatskov <alex@foosoft.net>
+ * Copyright (C) 2016-2017  Alex Yatskov <alex@foosoft.net>
  * Author: Alex Yatskov <alex@foosoft.net>
  *
  * This program is free software: you can redistribute it and/or modify
@@ -17,6 +17,10 @@
  */
 
 
+function apiOptionsSet(options) {
+    return utilInvoke('optionsSet', {options});
+}
+
 function apiOptionsGet() {
     return utilInvoke('optionsGet');
 }
@@ -29,18 +33,22 @@ function apiKanjiFind(text) {
     return utilInvoke('kanjiFind', {text});
 }
 
-function apiTemplateRender(template, data) {
-    return utilInvoke('templateRender', {data, template});
+function apiDefinitionAdd(definition, mode) {
+    return utilInvoke('definitionAdd', {definition, mode});
 }
 
 function apiDefinitionsAddable(definitions, modes) {
     return utilInvoke('definitionsAddable', {definitions, modes}).catch(() => null);
 }
 
-function apiDefinitionAdd(definition, mode) {
-    return utilInvoke('definitionAdd', {definition, mode});
-}
-
 function apiNoteView(noteId) {
     return utilInvoke('noteView', {noteId});
 }
+
+function apiTemplateRender(template, data) {
+    return utilInvoke('templateRender', {data, template});
+}
+
+function apiCommandExec(command) {
+    return utilInvoke('commandExec', {command});
+}
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 005139e6..cc4d99c8 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -230,7 +230,7 @@ class Frontend {
 
         const sentence = docSentenceExtract(textSource, this.options.anki.sentenceExt);
         const url = window.location.href;
-        this.popup.showKanji(
+        this.popup.kanjiShow(
             textSource.getRect(),
             definitions,
             this.options,
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 8e61169a..8cb16b5a 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -102,7 +102,7 @@ class Popup {
 
     async kanjiShow(elementRect, definitions, options, context) {
         await this.show(elementRect, options);
-        this.invokeApi('termsShow', {definitions, options, context});
+        this.invokeApi('kanjiShow', {definitions, options, context});
     }
 
     invokeApi(action, params={}) {
-- 
cgit v1.2.3