File reorg and cleanup
This commit is contained in:
parent
1b27832054
commit
ac012b26b3
@ -5,6 +5,6 @@
|
|||||||
<script src="jp/dictionary.js"></script>
|
<script src="jp/dictionary.js"></script>
|
||||||
<script src="jp/deinflector.js"></script>
|
<script src="jp/deinflector.js"></script>
|
||||||
<script src="jp/translator.js"></script>
|
<script src="jp/translator.js"></script>
|
||||||
<script src="jp/init.js"></script>
|
<script src="jp/api.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -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) {
|
function onMessage(request, sender, callback) {
|
||||||
switch (request.action.toLowerCase()) {
|
switch (request.action.toLowerCase()) {
|
||||||
case 'define':
|
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);
|
||||||
|
});
|
||||||
|
})();
|
@ -8,8 +8,7 @@
|
|||||||
"background": {"page": "background.html"},
|
"background": {"page": "background.html"},
|
||||||
|
|
||||||
"content_scripts": [{
|
"content_scripts": [{
|
||||||
"matches": ["http://*/*", "https://*/*"],
|
"matches": ["*://*/*"],
|
||||||
"js": ["content.js", "util.js"],
|
"js": ["content.js", "api.js"]
|
||||||
"run_at": "document_end"
|
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user