ALT Images et convertBinaryHexDecimal switch case
This commit is contained in:
parent
eaec55fcbb
commit
c3022c0464
@ -245,48 +245,43 @@ function hexToUtf8 (s) {
|
||||
// Convertis des nombres de différents bases
|
||||
function convertDecimalBinaryHexadecimal(value, option) {
|
||||
try {
|
||||
if (option === 'DecimalToBinary') {
|
||||
value = value.replace(" ", "");
|
||||
value = parseInt(value);
|
||||
if (isNaN(value)) {
|
||||
switch (option) {
|
||||
case 'DecimalToBinary':
|
||||
value = value.replace(" ", "");
|
||||
value = parseInt(value);
|
||||
if (isNaN(value)) {
|
||||
return messageError;
|
||||
} else {
|
||||
return value.toString(2);
|
||||
}
|
||||
case 'BinaryToDecimal':
|
||||
return formatNumberResult(parseInt(value, 2));
|
||||
case 'DecimalToHexadecimal':
|
||||
value = value.replace(" ", "");
|
||||
value = parseInt(value);
|
||||
if (isNaN(value)) {
|
||||
return messageError;
|
||||
} else {
|
||||
return value.toString(16).toUpperCase();
|
||||
}
|
||||
case 'HexadecimalToDecimal':
|
||||
return formatNumberResult(parseInt(value, 16));
|
||||
case 'BinaryToHexadecimal':
|
||||
value = parseInt(value, 2);
|
||||
if (isNaN(value)) {
|
||||
return messageError;
|
||||
} else {
|
||||
return parseInt(value).toString(16).toUpperCase();
|
||||
}
|
||||
case 'HexadecimalToBinary':
|
||||
value = parseInt(value, 16);
|
||||
if (isNaN(value)) {
|
||||
return messageError;
|
||||
} else {
|
||||
return parseInt(value).toString(2);
|
||||
}
|
||||
default:
|
||||
return messageError;
|
||||
} else {
|
||||
return value.toString(2);
|
||||
}
|
||||
}
|
||||
else if (option === 'BinaryToDecimal') {
|
||||
return formatNumberResult(parseInt(value, 2));
|
||||
}
|
||||
else if (option === 'DecimalToHexadecimal') {
|
||||
value = value.replace(" ", "");
|
||||
value = parseInt(value);
|
||||
if (isNaN(value)) {
|
||||
return messageError;
|
||||
} else {
|
||||
return value.toString(16).toUpperCase();
|
||||
}
|
||||
}
|
||||
else if (option === 'HexadecimalToDecimal') {
|
||||
return formatNumberResult(parseInt(value, 16));
|
||||
}
|
||||
else if (option === 'BinaryToHexadecimal') {
|
||||
value = parseInt(value, 2);
|
||||
if (isNaN(value)) {
|
||||
return messageError;
|
||||
} else {
|
||||
return parseInt(value).toString(16).toUpperCase();
|
||||
}
|
||||
}
|
||||
else if (option === 'HexadecimalToBinary') {
|
||||
value = parseInt(value, 16);
|
||||
if (isNaN(value)) {
|
||||
return messageError;
|
||||
} else {
|
||||
return parseInt(value).toString(2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return messageError;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
|
@ -14,14 +14,14 @@
|
||||
<div class="col-sm-12 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/weatherRequest.php">Météo</a></h2>
|
||||
<a href="./function-views/weatherRequest.php"><img class="function-list-image" src="/img/function-image/weatherRequest.png" alt=""></a>
|
||||
<a href="./function-views/weatherRequest.php"><img class="function-list-image" src="/img/function-image/weatherRequest.png" alt="Météo"></a>
|
||||
<p class="function-list-description">Affiche la météo et l'heure local selon la ville.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/randomNumber.php">Nombre aléatoire</a></h2>
|
||||
<a href="./function-views/randomNumber.php"><img class="function-list-image" src="/img/function-image/randomNumber.png" alt=""></a>
|
||||
<a href="./function-views/randomNumber.php"><img class="function-list-image" src="/img/function-image/randomNumber.png" alt="Nombre aléatoire"></a>
|
||||
<p class="function-list-description">Génère un nombre aléatoire entre un minimum inclus et un maximum inclus.</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -31,14 +31,14 @@
|
||||
<div class="col-sm-12 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/calculateAge.php">Quelle âge avez-vous ?</a></h2>
|
||||
<a href="./function-views/calculateAge.php"><img class="function-list-image" src="/img/function-image/calculateAge.png" alt=""></a>
|
||||
<a href="./function-views/calculateAge.php"><img class="function-list-image" src="/img/function-image/calculateAge.png" alt="Calendrier"></a>
|
||||
<p class="function-list-description">Calcule l'âge de quelqu'un selon la date de naissance.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/convertTemperature.php">Conversion de Température</a></h2>
|
||||
<a href="./function-views/convertTemperature.php"><img class="function-list-image" src="/img/function-image/convertTemperature.png" alt=""></a>
|
||||
<a href="./function-views/convertTemperature.php"><img class="function-list-image" src="/img/function-image/convertTemperature.png" alt="Thermomètre"></a>
|
||||
<p class="function-list-description">Convertit des Degré Celsius en Degré Fahrenheit et l'inverse aussi.</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -48,14 +48,14 @@
|
||||
<div class="col-sm-12 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/convertDistance.php">Conversion de Distance</a></h2>
|
||||
<a href="./function-views/convertDistance.php"><img class="function-list-image" src="/img/function-image/convertDistance.png" alt=""></a>
|
||||
<a href="./function-views/convertDistance.php"><img class="function-list-image" src="/img/function-image/convertDistance.png" alt="Règle"></a>
|
||||
<p class="function-list-description">Convertit la longueur (distance) avec les unités allant de picomètre au Téramètre.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/filterStudents.php">Trie les prénoms par leur première lettre</a></h2>
|
||||
<a href="./function-views/filterStudents.php"><img class="function-list-image" src="/img/function-image/filterStudents.png" alt=""></a>
|
||||
<a href="./function-views/filterStudents.php"><img class="function-list-image" src="/img/function-image/filterStudents.png" alt="Carte étudiant"></a>
|
||||
<p class="function-list-description">Affiche uniquement les prénoms (qui sont dans la liste) qui commence par la lettre souhaitée.</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -65,14 +65,14 @@
|
||||
<div class="col-sm-12 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/randomQuote.php">Générateur de citation</a></h2>
|
||||
<a href="./function-views/randomQuote.php"><img class="function-list-image" src="/img/function-image/randomQuote.png" alt=""></a>
|
||||
<a href="./function-views/randomQuote.php"><img class="function-list-image" src="/img/function-image/randomQuote.png" alt="Citation"></a>
|
||||
<p class="function-list-description">Génère aléatoirement une citation ou un proverbe.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/convertCurrency.php">Conversion de devise</a></h2>
|
||||
<a href="./function-views/convertCurrency.php"><img class="function-list-image" src="/img/function-image/convertCurrency.png" alt=""></a>
|
||||
<a href="./function-views/convertCurrency.php"><img class="function-list-image" src="/img/function-image/convertCurrency.png" alt="Sac de pièces"></a>
|
||||
<p class="function-list-description">Convertis une valeur dans une devise dans une autre devise.</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -82,14 +82,14 @@
|
||||
<div class="col-sm-12 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/convertEncoding.php">Conversion des Encodages de caractères</a></h2>
|
||||
<a href="./function-views/convertEncoding.php"><img class="function-list-image" src="/img/function-image/convertEncoding.png" alt=""></a>
|
||||
<a href="./function-views/convertEncoding.php"><img class="function-list-image" src="/img/function-image/convertEncoding.png" alt="Binaire"></a>
|
||||
<p class="function-list-description">Convertis des nombres de différentes bases et convertis en UTF-8.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/convertRomanArabicNumbers.php">Conversion d'un nombre arabe en nombre romain</a></h2>
|
||||
<a href="./function-views/convertRomanArabicNumbers.php"><img class="function-list-image" src="/img/function-image/convertRomanArabicNumbers.png" alt=""></a>
|
||||
<a href="./function-views/convertRomanArabicNumbers.php"><img class="function-list-image" src="/img/function-image/convertRomanArabicNumbers.png" alt="Chiffres Romains"></a>
|
||||
<p class="function-list-description">Convertis un nombre arabe en nombre romain (et l'inverse aussi).</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -99,14 +99,14 @@
|
||||
<div class="col-sm-12 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/armstrongNumber.php">Nombre d'Armstrong</a></h2>
|
||||
<a href="./function-views/armstrongNumber.php"><img class="function-list-image" src="/img/function-image/armstrongNumber.png" alt=""></a>
|
||||
<a href="./function-views/armstrongNumber.php"><img class="function-list-image" src="/img/function-image/armstrongNumber.png" alt="Nombre d'Armstrong"></a>
|
||||
<p class="function-list-description">Vérifie si un nombre fait partie des nombres d'Armstrong ou non.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 col-md-6 pb-4">
|
||||
<div class="text-center pb-5">
|
||||
<h2 class="function-list-title"><a href="./function-views/heapAlgorithm.php">Heap's algorithm</a></h2>
|
||||
<a href="./function-views/heapAlgorithm.php"><img class="function-list-image" src="/img/function-image/heapAlgorithm.png" alt=""></a>
|
||||
<a href="./function-views/heapAlgorithm.php"><img class="function-list-image" src="/img/function-image/heapAlgorithm.png" alt="Heap's algorithm"></a>
|
||||
<p class="function-list-description">Génère toutes les permutations unique possibles d'une châine de caractère (en changeant de place les lettres du mot, permet d’en créer un nouveau qui n'a pas forcément de sens).</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<h1><span class="important"><?php echo $title?></span></h1>
|
||||
<p class="pt-3 text-center"><?php echo $description?></p>
|
||||
<div class="text-center">
|
||||
<img class="function-image" src="/img/function-image/calculateAge.png" alt="Calculate Age">
|
||||
<img class="function-image" src="/img/function-image/calculateAge.png" alt="Calendrier">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="birthDateValue">Entrez la date de naissance au format (dd/mm/yyyy) :</label>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<h1><span class="important"><?php echo $title?></span> :</h1>
|
||||
<p class="pt-3 text-center"><?php echo $description?></p>
|
||||
<div class="text-center">
|
||||
<img class="function-image" src="/img/function-image/convertCurrency.png" alt="Convert Currency">
|
||||
<img class="function-image" src="/img/function-image/convertCurrency.png" alt="Sac de pièces">
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-group">
|
||||
|
@ -9,7 +9,7 @@
|
||||
<h1><span class="important"><?php echo $title?></span> :</h1>
|
||||
<p class="pt-3 text-center"><?php echo $description?></p>
|
||||
<div class="text-center">
|
||||
<img class="function-image" src="/img/function-image/convertDistance.png" alt="Convert Distance">
|
||||
<img class="function-image" src="/img/function-image/convertDistance.png" alt="Règle">
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-group">
|
||||
|
@ -9,7 +9,7 @@
|
||||
<h1><span class="important"><?php echo $title?></span> :</h1>
|
||||
<p class="pt-3 text-center"><?php echo $description?></p>
|
||||
<div class="text-center">
|
||||
<img class="function-image" src="/img/function-image/convertEncoding.png" alt="Convert Encoding">
|
||||
<img class="function-image" src="/img/function-image/convertEncoding.png" alt="Binaire">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="value">Entrez votre valeur :</label>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<h1><span class="important"><?php echo $title?></span> :</h1>
|
||||
<p class="pt-3 text-center"><?php echo $description?></p>
|
||||
<div class="text-center">
|
||||
<img class="function-image" src="/img/function-image/convertRomanArabicNumbers.png" alt="Roman Numerals">
|
||||
<img class="function-image" src="/img/function-image/convertRomanArabicNumbers.png" alt="Chiffres Romains">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="numbersArabic">Entrez votre nombre :</label>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<h1><span class="important"><?php echo $title?></span> :</h1>
|
||||
<p class="pt-3 text-center"><?php echo $description?></p>
|
||||
<div class="text-center">
|
||||
<img class="function-image" src="/img/function-image/convertTemperature.png" alt="Convert Temperature">
|
||||
<img class="function-image" src="/img/function-image/convertTemperature.png" alt="Thermomètre">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="temperatureValue">Entrez la température :</label>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<h1><span class="important"><?php echo $title?></span> :</h1>
|
||||
<p class="pt-3 text-center"><?php echo $description?></p>
|
||||
<div class="text-center">
|
||||
<img class="function-image" src="/img/function-image/filterStudents.png" alt="Filter Students">
|
||||
<img class="function-image" src="/img/function-image/filterStudents.png" alt="Carte étudiant">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nameEntered">Entrez les prénoms :</label>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<h1><span class="important"><?php echo $title?></span> :</h1>
|
||||
<p class="pt-3 text-center"><?php echo $description?></p>
|
||||
<div class="text-center">
|
||||
<img class="function-image" src="/img/function-image/randomNumber.png" alt="Random Number">
|
||||
<img class="function-image" src="/img/function-image/randomNumber.png" alt="Nombre aléatoire">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="minValue">Entrez la valeur minimale :</label>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<p class="pt-3 text-center">
|
||||
<?php echo $description?>
|
||||
<div class="text-center">
|
||||
<img class="function-image" src="/img/function-image/randomQuote.png" alt="Random Quote">
|
||||
<img class="function-image" src="/img/function-image/randomQuote.png" alt="Citation">
|
||||
</div>
|
||||
<br>
|
||||
<div class="text-center">
|
||||
|
@ -9,7 +9,7 @@
|
||||
<h1><span class="important"><?php echo $title?></span> :</h1>
|
||||
<p class="pt-3 text-center"><?php echo $description?></p>
|
||||
<div class="text-center">
|
||||
<img class="function-image" src="/img/function-image/weatherRequest.png" alt="Weather">
|
||||
<img class="function-image" src="/img/function-image/weatherRequest.png" alt="Météo">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="cityName">Entrez le nom d'une ville :</label>
|
||||
|
Reference in New Issue
Block a user