File: /var/www/html/spion/resources/views/front/partial/script.blade.php
<!-- Option 1: Bootstrap Bundle with Popper -->
{{-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.min.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-rc.0/js/select2.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.5/jquery.validate.min.js"></script> --}}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.validate.min.js"></script>
<script>
const header = document.querySelector(".page-header");
const toggleClass = "is-sticky";
window.addEventListener("scroll", () => {
const currentScroll = window.pageYOffset;
if (currentScroll > 150) {
header.classList.add(toggleClass);
} else {
header.classList.remove(toggleClass);
}
});
</script>
<script>
(function() {
'use strict';
const forms = document.querySelectorAll('.requires-validation'); // Changed from '#requires-validation' to '.requires-validation' to support multiple forms if needed.
Array.from(forms)
.forEach(function(form) {
form.addEventListener('submit', function(event) {
// Check if form is valid
if (!form.checkValidity()) {
event.preventDefault();
event.stopPropagation();
} else {
// You can handle modal or any other action here before submitting the form
// If needed, trigger another modal:
// $('#exampleModal1').modal('show');
}
form.classList.add('was-validated');
}, false);
});
})();
</script>
<script>
(function() {
'use strict';
const forms = document.querySelectorAll('.requires-validation'); // Changed from '#requires-validation' to '.requires-validation' to support multiple forms if needed.
Array.from(forms)
.forEach(function(form) {
form.addEventListener('submit', function(event) {
// Check if form is valid
if (!form.checkValidity()) {
event.preventDefault();
event.stopPropagation();
} else {
// You can handle modal or any other action here before submitting the form
// If needed, trigger another modal:
// $('#exampleModal1').modal('show');
}
form.classList.add('was-validated');
}, false);
});
})();
</script>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
function OTPInput() {
const inputs = document.querySelectorAll('#otp > *[id]');
for (let i = 0; i < inputs.length; i++) {
inputs[i].addEventListener('keydown', function(event) {
if (event.key === "Backspace") {
inputs[i].value = '';
if (i !== 0) inputs[i - 1].focus();
} else {
if (i === inputs.length - 1 && inputs[i].value !== '') {
return true;
} else if (event.keyCode > 47 && event.keyCode < 58) {
inputs[i].value = event.key;
if (i !== inputs.length - 1) inputs[i + 1].focus();
event.preventDefault();
} else if (event.keyCode > 64 && event.keyCode < 91) {
inputs[i].value = String.fromCharCode(event.keyCode);
if (i !== inputs.length - 1) inputs[i + 1].focus();
event.preventDefault();
}
}
});
}
}
OTPInput();
});
</script>
<script>
$(document).ready(function() {
$('#loginForm').validate({
rules: {
email: {
required: true,
email: true,
},
password: {
required: true,
remote: {
url: "{{ route('check.user') }}",
type: "POST",
data: {
_token: '{{ csrf_token() }}',
email: function() {
return $('input[name="email"]').val();
},
password: function() {
return $('input[name="password"]').val();
},
},
},
},
},
messages: {
email: {
required: "Please enter your email",
email: "Please enter a valid email address",
},
password: {
required: "Please enter your password",
remote: "Invalid email or password",
},
},
errorPlacement: function(error, element) {
error.insertAfter(element);
},
submitHandler: function(form) {
form.submit();
},
});
});
</script>