Skip to content

Commit

Permalink
Merge pull request #53 from evenZh/issue-52-DOMNodeInserted_新版本的chrom…
Browse files Browse the repository at this point in the history
…e_edge_已经不支持了
  • Loading branch information
guanguans authored Aug 20, 2024
2 parents 3909dc1 + f670358 commit afeb781
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions resources/views/captcha.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,18 @@ class="form-control" id="captcha-input" name="captcha"
$(this).attr('src', $(this).attr('src').replace(/\?random=.*$/, '?random=' + Math.random()));
});

$('#captcha .with-errors').bind('DOMNodeInserted', function () {
if ($('#captcha-input').val() !== '' && $(this).html().length > 0) {
$("#captcha-img").trigger("click");
}
});
const observer = new MutationObserver(function(mutationsList) {
for(let mutation of mutationsList) {
if (mutation.type === 'childList') {
if ($('#captcha-input').val() !== '' && $('#captcha .with-errors').html().length > 0) {
$("#captcha-img").trigger("click");
}
}
}
});
observer.observe($('#captcha .with-errors')[0], {
attributes: false,
childList: true,
subtree: true
});
})();

0 comments on commit afeb781

Please sign in to comment.