From 4b92a728aed5a67a5dceff7ce55b007161714b70 Mon Sep 17 00:00:00 2001 From: Divlo Date: Sun, 15 Sep 2019 21:51:54 +0200 Subject: [PATCH] Ajout de convertIn pour convertBinaryText --- css/style.css | 3 +++ scripts/main.js | 5 +++-- views/function-views/convertBinaryText.php | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/css/style.css b/css/style.css index 4d77e66..a2bef4c 100644 --- a/css/style.css +++ b/css/style.css @@ -59,6 +59,9 @@ header { width: 25% !important; display: inline; } +#convertIn { + width: 6.7em; +} .table { color: white; } diff --git a/scripts/main.js b/scripts/main.js index 8ca9192..c738f4d 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -184,18 +184,19 @@ $(function () { $("#submitConvertBinaryText").click(function() { let binaryTextValue = $('#binaryTextValue').val(); + let convertIn = $("#convertIn option:selected").text(); let isBinaryValue = isStringBin(binaryTextValue); if(isEmptyValue(binaryTextValue)) { $('.results').html(emptyMessageError); } - else if (isBinaryValue === true) { + else if (isBinaryValue === true && convertIn === 'Texte') { // Le replace enlève les espaces let textResult = binToUtf8(binaryTextValue.replace(/\s/g,'')); $('.results').html(textResult); } - else if (isBinaryValue === false) { + else if (isBinaryValue === false && convertIn === 'Binaire') { // Les 2 replace permettent de rajouter un espace tout les 8 bits let binaryResult = utf8ToBin(binaryTextValue); binaryResult = binaryResult.replace(/(\d{8})/g, '$1 ').replace(/(^\s+|\s+$)/,''); diff --git a/views/function-views/convertBinaryText.php b/views/function-views/convertBinaryText.php index 6b19cdb..fd4fc0f 100644 --- a/views/function-views/convertBinaryText.php +++ b/views/function-views/convertBinaryText.php @@ -12,8 +12,14 @@
+
+
+