diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index e977735e..0615ffae 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -40,6 +40,6 @@ class Backend { static instance() { return chrome.extension.getBackgroundPage().yomichanBackend; } -}; +} window.yomichanBackend = new Backend(); diff --git a/ext/bg/js/popup.js b/ext/bg/js/popup.js index 01994827..712839d9 100644 --- a/ext/bg/js/popup.js +++ b/ext/bg/js/popup.js @@ -18,16 +18,14 @@ $(document).ready(() => { - const commandExec = command => instYomi().onCommand(command); - - $('#open-search').click(() => commandExec('search')); - $('#open-options').click(() => commandExec('options')); - $('#open-help').click(() => commandExec('help')); + $('#open-search').click(() => utilCommandDispatch('search')); + $('#open-options').click(() => utilCommandDispatch('options')); + $('#open-help').click(() => utilCommandDispatch('help')); optionsLoad().then(options => { const toggle = $('#enable-search'); toggle.prop('checked', options.general.enable).change(); toggle.bootstrapToggle(); - toggle.change(() => commandExec('toggle')); + toggle.change(() => utilCommandDispatch('toggle')); }); }); diff --git a/ext/bg/popup.html b/ext/bg/popup.html index 26c0f0bb..4113b008 100644 --- a/ext/bg/popup.html +++ b/ext/bg/popup.html @@ -27,13 +27,16 @@

+ + + - - + +