From b6b5461241df9f1a3ffee1f9de25750581349816 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 6 Jan 2024 16:19:31 +0100 Subject: [PATCH] fonte nettoyage des majuscules et des espaces dans l'id de la fonte --- core/module/theme/view/fontAdd/fontAdd.js.php | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/core/module/theme/view/fontAdd/fontAdd.js.php b/core/module/theme/view/fontAdd/fontAdd.js.php index 51eede07..45ae0883 100644 --- a/core/module/theme/view/fontAdd/fontAdd.js.php +++ b/core/module/theme/view/fontAdd/fontAdd.js.php @@ -8,4 +8,30 @@ * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International * @link http://zwiicms.fr/ */ -$("input[name=fontAddFontImported]").on("click",(function(){$("input[name=fontAddFontImported]").is(":checked")?$("input[name=fontAddFontFile]").prop("checked",!1):$("input[name=fontAddFontFile]").prop("checked",!0),$("#containerFontAddFile").hide(),$("#containerFontAddUrl").show()})),$("input[name=fontAddFontFile]").on("click",(function(){$("input[name=fontAddFontFile]").is(":checked")?$("input[name=fontAddFontImported]").prop("checked",!1):$("input[name=fontAddFontImported]").prop("checked",!0),$("#containerFontAddFile").show(),$("#containerFontAddUrl").hide()})); \ No newline at end of file + +$(document).ready(function () { + + $("input[name=fontAddFontImported]").on("click", (function () { + $("input[name=fontAddFontImported]").is(":checked") ? $("input[name=fontAddFontFile]").prop("checked", !1) : $("input[name=fontAddFontFile]").prop("checked", !0), $("#containerFontAddFile").hide(), $("#containerFontAddUrl").show() + })), $("input[name=fontAddFontFile]").on("click", (function () { + $("input[name=fontAddFontFile]").is(":checked") ? $("input[name=fontAddFontImported]").prop("checked", !1) : $("input[name=fontAddFontImported]").prop("checked", !0), $("#containerFontAddFile").show(), $("#containerFontAddUrl").hide() + })); + + + // Exemple d'utilisation : appel de la fonction à chaque saisie dans le champ texte + $('#fontAddFontId').on('input', function () { + cleanString(); + }); + + // Fonction pour supprimer les espaces et convertir en minuscules + function cleanString() { + var champTexte = $('#fontAddFontId'); + var texte = champTexte.val(); + texte = texte.replace(/\s/g, ''); // Supprimer les espaces + texte = texte.toLowerCase(); // Convertir en minuscules + champTexte.val(texte); // Mettre à jour le champ texte avec la nouvelle valeur + } + +}); + +