summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-04-20 22:18:37 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-04-20 22:23:07 -0400
commitc43dac19a467b055b2e6d16e08cab25dcc748419 (patch)
treee861b33529774c801c43766125502db954201688 /ext/bg
parenta6344f635de2464465317b2ceeb6e19aef056848 (diff)
Use wanakana object directly
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/search.js9
-rw-r--r--ext/bg/js/settings/popup-preview.js5
2 files changed, 9 insertions, 5 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index 871c576b..006536c0 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -22,6 +22,7 @@
* apiClipboardGet
* apiOptionsSet
* apiTermsFind
+ * wanakana
*/
class DisplaySearch extends Display {
@@ -89,7 +90,7 @@ class DisplaySearch extends Display {
if (this.options.general.enableWanakana === true) {
this.wanakanaEnable.checked = true;
- window.wanakana.bind(this.query);
+ wanakana.bind(this.query);
} else {
this.wanakanaEnable.checked = false;
}
@@ -256,9 +257,9 @@ class DisplaySearch extends Display {
onWanakanaEnableChange(e) {
const enableWanakana = e.target.checked;
if (enableWanakana) {
- window.wanakana.bind(this.query);
+ wanakana.bind(this.query);
} else {
- window.wanakana.unbind(this.query);
+ wanakana.unbind(this.query);
}
apiOptionsSet({general: {enableWanakana}}, this.getOptionsContext());
}
@@ -298,7 +299,7 @@ class DisplaySearch extends Display {
}
setQuery(query) {
- const interpretedQuery = this.isWanakanaEnabled() ? window.wanakana.toKana(query) : query;
+ const interpretedQuery = this.isWanakanaEnabled() ? wanakana.toKana(query) : query;
this.query.value = interpretedQuery;
this.queryParser.setText(interpretedQuery);
}
diff --git a/ext/bg/js/settings/popup-preview.js b/ext/bg/js/settings/popup-preview.js
index 091872be..45bf531e 100644
--- a/ext/bg/js/settings/popup-preview.js
+++ b/ext/bg/js/settings/popup-preview.js
@@ -15,6 +15,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+/* global
+ * wanakana
+ */
function appearanceInitialize() {
let previewVisible = false;
@@ -37,7 +40,7 @@ function showAppearancePreview() {
frame.src = '/bg/settings-popup-preview.html';
frame.id = 'settings-popup-preview-frame';
- window.wanakana.bind(text[0]);
+ wanakana.bind(text[0]);
const targetOrigin = chrome.runtime.getURL('/').replace(/\/$/, '');