summaryrefslogtreecommitdiff
path: root/ext/bg/js/popup.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-03-02 20:23:56 -0800
committerAlex Yatskov <alex@foosoft.net>2017-03-02 20:23:56 -0800
commit5ecca4627e4edd54b8af606c69aa51e4b659deef (patch)
tree3ef86e9408c6050a895c966704bd17b307e1ce55 /ext/bg/js/popup.js
parentb9c849a02078a5d6b99a0650b1ef3373232dc0c4 (diff)
enable and disable via toggle switch
Diffstat (limited to 'ext/bg/js/popup.js')
-rw-r--r--ext/bg/js/popup.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/bg/js/popup.js b/ext/bg/js/popup.js
index a666b580..4f6942f0 100644
--- a/ext/bg/js/popup.js
+++ b/ext/bg/js/popup.js
@@ -20,5 +20,14 @@ $(document).ready(() => {
$('#open-search').click(() => window.open(chrome.extension.getURL('bg/search.html')));
$('#open-options').click(() => chrome.runtime.openOptionsPage());
$('#open-help').click(() => window.open('http://foosoft.net/projects/yomichan'));
-});
+ optionsLoad().then(options => {
+ const toggle = $('#enable-search');
+ toggle.prop('checked', options.general.enable).change();
+ toggle.bootstrapToggle();
+ toggle.change(() => {
+ options.general.enable = toggle.prop('checked');
+ optionsSave(options).then(() => getYomichan().setOptions(options));
+ });
+ });
+});