2024-02-20 21:09:52 +00:00
|
|
|
$(function () {
|
|
|
|
$("#get-captcha").click(function () {
|
|
|
|
let btn = $(this);
|
|
|
|
|
|
|
|
let board = btn.attr("data-board");
|
|
|
|
let reply = btn.attr("data-reply");
|
|
|
|
let req_url = `/captcha?board=${board}&reply=${reply}`;
|
|
|
|
|
|
|
|
btn.text("Získat CAPTCHA");
|
2024-02-26 17:55:08 +00:00
|
|
|
btn.attr("disabled", true);
|
2024-02-20 21:09:52 +00:00
|
|
|
btn.addClass("loading");
|
|
|
|
|
|
|
|
$.get(req_url, function (data, _) {
|
|
|
|
try {
|
2024-02-26 17:55:08 +00:00
|
|
|
$("#captcha-id").attr("value", data.id);
|
2024-02-21 15:15:07 +00:00
|
|
|
$("#captcha").html(`<img src="data:image/png;base64,${data.png}">`);
|
2024-02-20 21:09:52 +00:00
|
|
|
} catch {
|
|
|
|
btn.append(" [Chyba]");
|
|
|
|
}
|
|
|
|
|
2024-02-26 17:55:08 +00:00
|
|
|
btn.attr("disabled", false);
|
2024-02-20 21:09:52 +00:00
|
|
|
btn.removeClass("loading");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|