| Current Path : /home/h/a/p/happyrenas/myreco.online/administration/js/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/h/a/p/happyrenas/myreco.online/administration/js/fonction.js |
function randomString() {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = 10;
var randomstring = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
document.getElementById('password').value = randomstring;
}
// Fonction pour générer un mot de passe aléatoire
function generatePassword(length) {
var charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#%&*!?";
var password = "";
for (var i = 0, n = charset.length; i < length; ++i) {
password += charset.charAt(Math.floor(Math.random() * n));
}
return password;
}
$('#fullscreenBtn').on('click', function() {
$('.card').toggleClass('fullscreen');
var icon = $('#fullscreenIcon');
if ($('.card').hasClass('fullscreen')) {
icon.removeClass('fa-expand').addClass('fa-compress'); // Changer l'icône en minimisation
} else {
icon.removeClass('fa-compress').addClass('fa-expand'); // Revenir à l'icône plein écran
}
});
$("#show_hide_password a").on('click', function(event) {
event.preventDefault();
if($('#show_hide_password input').attr("type") == "text"){
$('#show_hide_password input').attr('type', 'password');
$('#show_hide_password i').addClass( "fa-eye-slash" );
$('#show_hide_password i').removeClass( "fa-eye" );
}else if($('#show_hide_password input').attr("type") == "password"){
$('#show_hide_password input').attr('type', 'text');
$('#show_hide_password i').removeClass( "fa-eye-slash" );
$('#show_hide_password i').addClass( "fa-eye" );
}
});
$('#generatePassword').click(function() {
var newPassword = generatePassword(12); // Générer un mot de passe de 12 caractères
$('input[name="password"]').val(newPassword);
$('#show_hide_password input').attr('type', 'text');
$('#show_hide_password i').removeClass( "fa-eye-slash" );
$('#show_hide_password i').addClass( "fa-eye" );
});
function message_confirmation() {
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": true,
"progressBar": true,
"positionClass": "toast-top-right",
"preventDuplicates": true,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
toastr.success("Mise à jour effectuée");
}
function message_erreur() {
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": true,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": true,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
toastr.success("Une erreur au eu lieu");
}
function copyToClipboard(element) {
// Créer un élément temporaire pour contenir le texte à copier
var tempInput = document.createElement("input");
tempInput.value = element.innerText;
document.body.appendChild(tempInput);
// Sélectionner et copier le texte
tempInput.select();
document.execCommand("copy");
// Supprimer l'élément temporaire
document.body.removeChild(tempInput);
// Changer le texte de l'élément pour afficher "Copié"
element.innerText = "Copié";
// Remettre le texte d'origine après 1.5 seconde
setTimeout(function() {
element.innerText = tempInput.value;
}, 1500);
}
function showLoader() {
$('#halt_loader_overlay').show();
$('#halt_loader').show();
$('#message_erreur').text("").removeClass('alert-danger').attr("title", '').show();
}
function hideLoader(error = null) {
$('#halt_loader_overlay').hide();
$('#halt_loader').hide();
if (error) {
$('#message_erreur')
.text("Une erreur est survenue")
.addClass('alert-danger')
.attr("title", error) // Affiche l'erreur au survol
.show();
}
}
function showLoaderInitialisation() {
$('#halt_loader_overlay').show();
$('#halt_initialisation').show();
$('#message_erreur').text("").removeClass('alert-danger').attr("title", '').show();
}
function hideLoaderInitialisation(error = null) {
$('#halt_loader_overlay').hide();
$('#halt_initialisation').hide();
if (error) {
$('#message_erreur')
.text("Une erreur est survenue")
.addClass('alert-danger')
.attr("title", error) // Affiche l'erreur au survol
.show();
}
}