cleanup
This commit is contained in:
parent
fe137e94c9
commit
ac2e079c98
@ -10,7 +10,7 @@
|
||||
<script src="/mixed/lib/jszip.min.js"></script>
|
||||
<script src="/mixed/js/audio.js"></script>
|
||||
<script src="/bg/js/templates.js"></script>
|
||||
<script src="/bg/js/util.js"></script>
|
||||
<script src="/bg/js/instance.js"></script>
|
||||
<script src="/bg/js/handlebars.js"></script>
|
||||
<script src="/bg/js/dictionary.js"></script>
|
||||
<script src="/mixed/js/japanese.js"></script>
|
||||
|
@ -17,19 +17,6 @@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Commands
|
||||
*/
|
||||
|
||||
function commandExec(command) {
|
||||
instYomi().onCommand(command);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Instance
|
||||
*/
|
||||
|
||||
function instYomi() {
|
||||
return chrome.extension.getBackgroundPage().yomichan;
|
||||
}
|
||||
@ -41,20 +28,3 @@ function instDb() {
|
||||
function instAnki() {
|
||||
return instYomi().anki;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Foreground
|
||||
*/
|
||||
|
||||
function fgBroadcast(action, params) {
|
||||
chrome.tabs.query({}, tabs => {
|
||||
for (const tab of tabs) {
|
||||
chrome.tabs.sendMessage(tab.id, {action, params}, () => null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function fgOptionsSet(options) {
|
||||
fgBroadcast('optionsSet', options);
|
||||
}
|
@ -127,6 +127,5 @@ function optionsSave(options) {
|
||||
chrome.storage.local.set({options: JSON.stringify(options)}, resolve);
|
||||
}).then(() => {
|
||||
instYomi().optionsSet(options);
|
||||
fgOptionsSet(options);
|
||||
});
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
|
||||
$(document).ready(() => {
|
||||
const commandExec = command => instYomi().onCommand(command);
|
||||
|
||||
$('#open-search').click(() => commandExec('search'));
|
||||
$('#open-options').click(() => commandExec('options'));
|
||||
$('#open-help').click(() => commandExec('help'));
|
||||
|
@ -59,6 +59,12 @@ window.yomichan = new class {
|
||||
} else {
|
||||
this.anki = new AnkiNull();
|
||||
}
|
||||
|
||||
chrome.tabs.query({}, tabs => {
|
||||
for (const tab of tabs) {
|
||||
chrome.tabs.sendMessage(tab.id, {action: 'optionsSet', params: options}, () => null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
noteFormat(definition, mode) {
|
||||
|
@ -30,7 +30,7 @@
|
||||
<script src="/mixed/lib/jquery.min.js"></script>
|
||||
<script src="/mixed/lib/bootstrap-toggle/bootstrap-toggle.min.js"></script>
|
||||
<script src="/mixed/lib/handlebars.min.js"></script>
|
||||
<script src="/bg/js/util.js"></script>
|
||||
<script src="/bg/js/instance.js"></script>
|
||||
<script src="/bg/js/dictionary.js"></script>
|
||||
<script src="/mixed/js/request.js"></script>
|
||||
<script src="/mixed/js/japanese.js"></script>
|
||||
|
@ -33,7 +33,7 @@
|
||||
</div>
|
||||
|
||||
<script src="/mixed/lib/jquery.min.js"></script>
|
||||
<script src="/bg/js/util.js"></script>
|
||||
<script src="/bg/js/instance.js"></script>
|
||||
<script src="/bg/js/dictionary.js"></script>
|
||||
<script src="/mixed/js/request.js"></script>
|
||||
<script src="/mixed/js/japanese.js"></script>
|
||||
|
@ -276,7 +276,7 @@
|
||||
<script src="/mixed/lib/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="/mixed/lib/handlebars.min.js"></script>
|
||||
<script src="/bg/js/templates.js"></script>
|
||||
<script src="/bg/js/util.js"></script>
|
||||
<script src="/bg/js/instance.js"></script>
|
||||
<script src="/bg/js/handlebars.js"></script>
|
||||
<script src="/bg/js/dictionary.js"></script>
|
||||
<script src="/mixed/js/japanese.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user