make form search be always enabled

This commit is contained in:
Alex Yatskov 2017-05-24 20:42:54 -07:00
parent cf4a86fa1c
commit 992852d3c0
5 changed files with 7 additions and 14 deletions

View File

@ -39,7 +39,6 @@ function formRead() {
optionsNew.scanning.requireShift = $('#hold-shift-to-scan').prop('checked');
optionsNew.scanning.middleMouse = $('#middle-mouse-button-scan').prop('checked');
optionsNew.scanning.selectText = $('#select-matched-text').prop('checked');
optionsNew.scanning.imposter = $('#search-form-text-fields').prop('checked');
optionsNew.scanning.alphanumeric = $('#search-alphanumeric').prop('checked');
optionsNew.scanning.delay = parseInt($('#scan-delay').val(), 10);
optionsNew.scanning.length = parseInt($('#scan-length').val(), 10);
@ -136,7 +135,6 @@ $(document).ready(() => {
$('#hold-shift-to-scan').prop('checked', options.scanning.requireShift);
$('#middle-mouse-button-scan').prop('checked', options.scanning.middleMouse);
$('#select-matched-text').prop('checked', options.scanning.selectText);
$('#search-form-text-fields').prop('checked', options.scanning.imposter);
$('#search-alphanumeric').prop('checked', options.scanning.alphanumeric);
$('#scan-delay').val(options.scanning.delay);
$('#scan-length').val(options.scanning.length);

View File

@ -111,7 +111,6 @@ function optionsSetDefaults(options) {
requireShift: true,
middleMouse: true,
selectText: true,
imposter: true,
alphanumeric: true,
delay: 15,
length: 10

View File

@ -90,10 +90,6 @@
<label><input type="checkbox" id="select-matched-text"> Select matched text</label>
</div>
<div class="checkbox">
<label><input type="checkbox" id="search-form-text-fields"> Search form text fields</label>
</div>
<div class="checkbox">
<label><input type="checkbox" id="search-alphanumeric"> Search alphanumeric text</label>
</div>
@ -173,15 +169,15 @@
<a href="https://foosoft.net/projects/anki-connect/">AnkiConnect</a> plugin for Anki.
</p>
<div class="checkbox">
<label><input type="checkbox" id="anki-enable"> Enable Anki integration</label>
</div>
<div class="alert alert-danger" id="anki-error">
<strong>Error:</strong>
<span></span>
</div>
<div class="checkbox">
<label><input type="checkbox" id="anki-enable"> Enable Anki integration</label>
</div>
<div id="anki-general">
<div class="checkbox options-advanced">
<label><input type="checkbox" id="generate-html-cards"> Generate HTML cards</label>

View File

@ -142,7 +142,7 @@ window.driver = new class {
return;
}
const textSource = docRangeFromPoint(point, this.options.scanning.imposter);
const textSource = docRangeFromPoint(point);
if (!textSource || !textSource.containsPoint(point)) {
docImposterDestroy();
return;

View File

@ -112,12 +112,12 @@ function docImposterDestroy() {
}
}
function docRangeFromPoint(point, imposter) {
function docRangeFromPoint(point) {
const element = document.elementFromPoint(point.x, point.y);
if (element !== null) {
if (element.nodeName === 'IMG' || element.nodeName === 'BUTTON') {
return new TextSourceElement(element);
} else if (imposter && (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA')) {
} else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
docImposterCreate(element);
}
}