aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/search.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2019-10-27 20:11:23 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2019-10-27 20:11:23 +0200
commit70418202cf2739258a4e95fdc7f0fbe4c7c46821 (patch)
tree0e40711ded4536e5756f1bc8a85fdaa3af616d57 /ext/bg/js/search.js
parent48776145d6bdb8aff82e82546583c790353e75b6 (diff)
make search page checkbox options persist
Diffstat (limited to 'ext/bg/js/search.js')
-rw-r--r--ext/bg/js/search.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index dca4e8fa..65cca002 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -62,17 +62,22 @@ class DisplaySearch extends Display {
this.query.addEventListener('input', () => this.onSearchInput(), false);
if (this.wanakanaEnable !== null) {
- if (this.wanakanaEnable.checked) {
+ if (this.options.general.enableWanakana === true) {
+ this.wanakanaEnable.checked = true;
window.wanakana.bind(this.query);
+ } else {
+ this.wanakanaEnable.checked = false;
}
this.wanakanaEnable.addEventListener('change', (e) => {
let query = DisplaySearch.getSearchQueryFromLocation(window.location.href);
if (e.target.checked) {
window.wanakana.bind(this.query);
this.query.value = window.wanakana.toKana(query);
+ apiOptionsSet({general: {enableWanakana: true}}, this.getOptionsContext());
} else {
window.wanakana.unbind(this.query);
this.query.value = query;
+ apiOptionsSet({general: {enableWanakana: false}}, this.getOptionsContext());
}
this.onSearchQueryUpdated(this.query.value, false);
});
@@ -89,6 +94,12 @@ class DisplaySearch extends Display {
}
}
if (this.clipboardMonitorEnable !== null) {
+ if (this.options.general.enableClipboardMonitor === true) {
+ this.clipboardMonitorEnable.checked = true;
+ this.startClipboardMonitor();
+ } else {
+ this.clipboardMonitorEnable.checked = false;
+ }
this.clipboardMonitorEnable.addEventListener('change', (e) => {
if (e.target.checked) {
chrome.permissions.request(
@@ -96,6 +107,7 @@ class DisplaySearch extends Display {
(granted) => {
if (granted) {
this.startClipboardMonitor();
+ apiOptionsSet({general: {enableClipboardMonitor: true}}, this.getOptionsContext());
} else {
e.target.checked = false;
}
@@ -103,6 +115,7 @@ class DisplaySearch extends Display {
);
} else {
this.stopClipboardMonitor();
+ apiOptionsSet({general: {enableClipboardMonitor: false}}, this.getOptionsContext());
}
});
}