diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/api.js (renamed from ext/util.js) | 0 | ||||
-rw-r--r-- | ext/background.html | 2 | ||||
-rw-r--r-- | ext/jp/api.js (renamed from ext/jp/init.js) | 26 | ||||
-rw-r--r-- | ext/manifest.json | 5 |
4 files changed, 15 insertions, 18 deletions
diff --git a/ext/util.js b/ext/api.js index 0b92cde0..0b92cde0 100644 --- a/ext/util.js +++ b/ext/api.js diff --git a/ext/background.html b/ext/background.html index f0d06216..09a21779 100644 --- a/ext/background.html +++ b/ext/background.html @@ -5,6 +5,6 @@ <script src="jp/dictionary.js"></script> <script src="jp/deinflector.js"></script> <script src="jp/translator.js"></script> - <script src="jp/init.js"></script> + <script src="jp/api.js"></script> </body> </html> diff --git a/ext/jp/init.js b/ext/jp/api.js index 56ec8b34..3f15056a 100644 --- a/ext/jp/init.js +++ b/ext/jp/api.js @@ -17,20 +17,6 @@ */ -function onInit() { - const test = trans.findTerm('食べられない'); - chrome.runtime.onMessage.addListener(onMessage); -} - -const res = { - rules: 'jp/data/rules.json', - edict: 'jp/data/edict.json', - enamdict: 'jp/data/enamdict.json', - kanjidic: 'jp/data/kanjidic.json' -}; - -window.trans = new Translator(res, onInit); - function onMessage(request, sender, callback) { switch (request.action.toLowerCase()) { case 'define': @@ -39,3 +25,15 @@ function onMessage(request, sender, callback) { } } +(() => { + const res = { + rules: 'jp/data/rules.json', + edict: 'jp/data/edict.json', + enamdict: 'jp/data/enamdict.json', + kanjidic: 'jp/data/kanjidic.json' + }; + + window.trans = new Translator(res, function() { + chrome.runtime.onMessage.addListener(onMessage); + }); +})(); diff --git a/ext/manifest.json b/ext/manifest.json index c46e20af..a225faeb 100644 --- a/ext/manifest.json +++ b/ext/manifest.json @@ -8,8 +8,7 @@ "background": {"page": "background.html"}, "content_scripts": [{ - "matches": ["http://*/*", "https://*/*"], - "js": ["content.js", "util.js"], - "run_at": "document_end" + "matches": ["*://*/*"], + "js": ["content.js", "api.js"] }] } |