Skip to content

Commit 6d97479

Browse files
committed
textcaptcha empty selectors
1 parent aa9f7e7 commit 6d97479

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

textcaptcha.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
(async () => {
22
function is_present(settings) {
33
try {
4-
const $image = document.querySelector(settings.textcaptcha_image_selector);
5-
if (!$image) {
6-
return false;
7-
}
8-
const $input = document.querySelector(settings.textcaptcha_input_selector);
9-
if (!$input || $input.value) {
10-
return false;
4+
if (settings?.textcaptcha_image_selector && settings?.textcaptcha_input_selector) {
5+
const $image = document.querySelector(settings.textcaptcha_image_selector);
6+
if (!$image) {
7+
return false;
8+
}
9+
const $input = document.querySelector(settings.textcaptcha_input_selector);
10+
if (!$input || $input.value) {
11+
return false;
12+
}
13+
return true;
1114
}
12-
13-
return true;
1415
} catch (e) {}
1516
return false;
1617
}
@@ -73,7 +74,7 @@
7374
const $canvas = await get_canvas(selector);
7475
return $canvas.toDataURL('image/jpeg').split(';base64,')[1];
7576
} catch (e) {
76-
console.error('failed to encode image data', e);
77+
// console.error('failed to encode image data', e);
7778
return null;
7879
}
7980
}

0 commit comments

Comments
 (0)