summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/bg/js/options-form.js12
-rw-r--r--ext/bg/js/options.js7
-rw-r--r--ext/bg/options.html10
-rw-r--r--ext/fg/js/client.js4
4 files changed, 22 insertions, 11 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index bc21793e..9799f664 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -18,16 +18,18 @@
function optionsToForm(opts) {
- $('#scanLength').val(opts.scanLength);
+ $('#enableAnkiConnect').prop('checked', opts.ankiConnect);
+ $('#selectMatchedText').prop('checked', opts.selectMatchedText);
$('#loadOnStartup').prop('checked', opts.loadOnStartup);
- $('#highlightText').prop('checked', opts.highlightText);
+ $('#scanLength').val(opts.scanLength);
}
function formToOptions() {
return sanitizeOptions({
- scanLength: $('#scanLength').val(),
- loadOnStartup: $('#loadOnStartup').prop('checked'),
- highlightText: $('#highlightText').prop('checked')
+ loadOnStartup: $('#loadOnStartup').prop('checked'),
+ selectMatchedText: $('#selectMatchedText').prop('checked'),
+ ankiConnect: $('#enableAnkiConnect').prop('checked'),
+ scanLength: $('#scanLength').val()
});
}
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index 9ff947b1..c73bc4c0 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -19,9 +19,10 @@
function sanitizeOptions(options) {
const defaults = {
- scanLength: 20,
- loadOnStartup: false,
- highlightText: true
+ loadOnStartup: false,
+ selectMatchedText: true,
+ enableAnkiConnect: false,
+ scanLength: 20
};
for (const key in defaults) {
diff --git a/ext/bg/options.html b/ext/bg/options.html
index a88ea402..961d11f7 100644
--- a/ext/bg/options.html
+++ b/ext/bg/options.html
@@ -34,7 +34,15 @@
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
- <label><input type="checkbox" id="highlightText" checked> Highlight text</label>
+ <label><input type="checkbox" id="selectMatchedText" checked> Select matched text</label>
+ </div>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <div class="col-sm-offset-2 col-sm-10">
+ <div class="checkbox">
+ <label><input type="checkbox" id="enableAnkiConnect" checked> Enable AnkiConnect</label>
</div>
</div>
</div>
diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js
index fdb46acb..8393e58c 100644
--- a/ext/fg/js/client.js
+++ b/ext/fg/js/client.js
@@ -126,7 +126,7 @@ class Client {
showPopup(range, content) {
this.popup.showNextTo(range.getRect(), content);
- if (this.options.highlightText) {
+ if (this.options.selectMatchedText) {
range.select();
}
@@ -136,7 +136,7 @@ class Client {
hidePopup() {
this.popup.hide();
- if (this.options.highlightText && this.lastRange !== null) {
+ if (this.options.selectMatchedText && this.lastRange !== null) {
this.lastRange.deselect();
}