Init commit
This commit is contained in:
7
js/bootstrap.js
vendored
Normal file
7
js/bootstrap.js
vendored
Normal file
File diff suppressed because one or more lines are too long
72
js/captcha.js
Normal file
72
js/captcha.js
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
|
||||
// captcha source origin: https://codepen.io/hirensojitra/pen/OJBpVvB
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
// Generate captcha on page load
|
||||
|
||||
generateCaptcha();
|
||||
|
||||
// Handle captcha refresh button click
|
||||
|
||||
$("#refresh-captcha").click(function () {
|
||||
|
||||
generateCaptcha();
|
||||
|
||||
$("#captcha-input").val("");
|
||||
|
||||
});
|
||||
|
||||
// Handle form submit
|
||||
|
||||
$("#captcha-form").submit(function (event) {
|
||||
|
||||
|
||||
|
||||
// Validate captcha
|
||||
|
||||
var captchaInput = $("#captcha-input").val();
|
||||
|
||||
var captchaCode = sessionStorage.getItem("captchaCode");
|
||||
|
||||
if (captchaInput != captchaCode) {
|
||||
|
||||
alert("Nesprávně opsaný CAPTCHA kód. Dodržujte velká-malá písmena!");
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
generateCaptcha();
|
||||
|
||||
$("#captcha-input").val("");
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Form validation successful, submit form
|
||||
|
||||
alert("E-mail úspěšně odeslán. Kopie dorazí na Vaší adresu.");
|
||||
|
||||
//$("#captcha-form").submit();
|
||||
|
||||
generateCaptcha();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Define the function generateCaptcha()
|
||||
|
||||
function generateCaptcha() {
|
||||
|
||||
// Get the canvas element with ID captcha and create an instance of its canvas rendering context
|
||||
|
||||
var a = $("#captcha")[0],
|
||||
|
||||
b = a.getContext("2d");
|
||||
|
||||
// Clear the canvas
|
||||
|
||||
b.clearRect(0, 0, a.width, a.height);
|
||||
|
||||
4
js/jquery-3.js
vendored
Normal file
4
js/jquery-3.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
js/popper.js
Normal file
5
js/popper.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user