diff options
Diffstat (limited to 'ext/fg')
-rw-r--r-- | ext/fg/frame.html | 2 | ||||
-rw-r--r-- | ext/fg/js/api.js (renamed from ext/fg/js/background.js) | 30 | ||||
-rw-r--r-- | ext/fg/js/display-frame.js | 10 | ||||
-rw-r--r-- | ext/fg/js/frontend.js | 6 |
4 files changed, 24 insertions, 24 deletions
diff --git a/ext/fg/frame.html b/ext/fg/frame.html index 80e69967..9ff2c585 100644 --- a/ext/fg/frame.html +++ b/ext/fg/frame.html @@ -35,7 +35,7 @@ <script src="/mixed/js/audio.js"></script> <script src="/mixed/js/display.js"></script> <script src="/fg/js/dictionary.js"></script> - <script src="/fg/js/background.js"></script> + <script src="/fg/js/api.js"></script> <script src="/fg/js/display-frame.js"></script> </body> </html> diff --git a/ext/fg/js/background.js b/ext/fg/js/api.js index c072468b..e252637e 100644 --- a/ext/fg/js/background.js +++ b/ext/fg/js/api.js @@ -17,7 +17,7 @@ */ -function bgInvoke(action, params={}) { +function apiInvoke(action, params={}) { return new Promise((resolve, reject) => { try { chrome.runtime.sendMessage({action, params}, ({result, error}) => { @@ -34,30 +34,30 @@ function bgInvoke(action, params={}) { }); } -function bgOptionsGet() { - return bgInvoke('optionsGet'); +function apiOptionsGet() { + return apiInvoke('optionsGet'); } -function bgTermsFind(text) { - return bgInvoke('termsFind', {text}); +function apiTermsFind(text) { + return apiInvoke('termsFind', {text}); } -function bgKanjiFind(text) { - return bgInvoke('kanjiFind', {text}); +function apiKanjiFind(text) { + return apiInvoke('kanjiFind', {text}); } -function bgTemplateRender(template, data) { - return bgInvoke('templateRender', {data, template}); +function apiTemplateRender(template, data) { + return apiInvoke('templateRender', {data, template}); } -function bgDefinitionsAddable(definitions, modes) { - return bgInvoke('definitionsAddable', {definitions, modes}).catch(() => null); +function apiDefinitionsAddable(definitions, modes) { + return apiInvoke('definitionsAddable', {definitions, modes}).catch(() => null); } -function bgDefinitionAdd(definition, mode) { - return bgInvoke('definitionAdd', {definition, mode}); +function apiDefinitionAdd(definition, mode) { + return apiInvoke('definitionAdd', {definition, mode}); } -function bgNoteView(noteId) { - return bgInvoke('noteView', {noteId}); +function apiNoteView(noteId) { + return apiInvoke('noteView', {noteId}); } diff --git a/ext/fg/js/display-frame.js b/ext/fg/js/display-frame.js index c7da43e8..09bd9255 100644 --- a/ext/fg/js/display-frame.js +++ b/ext/fg/js/display-frame.js @@ -24,23 +24,23 @@ window.displayFrame = new class extends Display { } definitionAdd(definition, mode) { - return bgDefinitionAdd(definition, mode); + return apiDefinitionAdd(definition, mode); } definitionsAddable(definitions, modes) { - return bgDefinitionsAddable(definitions, modes); + return apiDefinitionsAddable(definitions, modes); } noteView(noteId) { - return bgNoteView(noteId); + return apiNoteView(noteId); } templateRender(template, data) { - return bgTemplateRender(template, data); + return apiTemplateRender(template, data); } kanjiFind(character) { - return bgKanjiFind(character); + return apiKanjiFind(character); } handleError(error) { diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 8b4c182c..9974d878 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -28,7 +28,7 @@ window.yomichanFrontend = new class { this.pendingLookup = false; this.options = null; - bgOptionsGet().then(options => { + apiOptionsGet().then(options => { this.options = options; window.addEventListener('mouseover', this.onMouseOver.bind(this)); window.addEventListener('mousedown', this.onMouseDown.bind(this)); @@ -175,7 +175,7 @@ window.yomichanFrontend = new class { searchTerms(textSource) { textSource.setEndOffset(this.options.scanning.length); - return bgTermsFind(textSource.text()).then(({definitions, length}) => { + return apiTermsFind(textSource.text()).then(({definitions, length}) => { if (definitions.length === 0) { return false; } else { @@ -203,7 +203,7 @@ window.yomichanFrontend = new class { searchKanji(textSource) { textSource.setEndOffset(1); - return bgKanjiFind(textSource.text()).then(definitions => { + return apiKanjiFind(textSource.text()).then(definitions => { if (definitions.length === 0) { return false; } else { |