| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/bpkd/admin/assets/js/ |
Upload File : |
$(document).ready(function() {
// Tooltip initialization
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
});
// Auto hide alerts after 5 seconds
setTimeout(function() {
$('.alert').fadeOut('slow');
}, 5000);
// Character counter for excerpt
$('textarea[name="excerpt"]').on('keyup', function() {
var maxLength = 160;
var currentLength = $(this).val().length;
var remaining = maxLength - currentLength;
if (remaining >= 0) {
$(this).next('small').text('Tersisa ' + remaining + ' karakter');
} else {
$(this).next('small').text('Melebihi batas!');
}
});
// Preview image before upload
$('input[name="featured_image"]').on('change', function() {
var file = this.files[0];
if (file) {
var reader = new FileReader();
reader.onload = function(e) {
// Create preview if not exists
if ($('.image-preview').length === 0) {
$(this).closest('.card-body').append('<img class="image-preview img-fluid mt-3 rounded" src="' + e.target.result + '">');
} else {
$('.image-preview').attr('src', e.target.result);
}
}.bind(this);
reader.readAsDataURL(file);
}
});
// Confirm before delete
$('.btn-delete').on('click', function(e) {
if (!confirm('Apakah Anda yakin ingin menghapus item ini?')) {
e.preventDefault();
}
});
// Search form submit on enter
$('input[name="search"]').on('keypress', function(e) {
if (e.which === 13) {
$(this).closest('form').submit();
}
});
// Smooth scroll to top
$('.scroll-to-top').on('click', function() {
$('html, body').animate({scrollTop: 0}, 500);
});
// Show/hide scroll to top button
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
$('.scroll-to-top').fadeIn();
} else {
$('.scroll-to-top').fadeOut();
}
});
});