Ajout de devise à convertir - convertCurrency
This commit is contained in:
		| @@ -184,12 +184,33 @@ function convertCurrency(urlFixerIO, currency, euroValue) { | ||||
|         dataType : "jsonp", | ||||
|         success: function (jsonFixer) {  | ||||
|             switch(currency) { | ||||
|                 case '$': | ||||
|                     $('.results').html(formatNumberResult(euroValue) + ' € = ' + (formatNumberResult(parseFloat(jsonFixer.rates.USD) * euroValue)).toFixed(2) + ' ' + currency); | ||||
|                     break; | ||||
|                 case '£': | ||||
|                     $('.results').html(formatNumberResult(euroValue) + ' € = ' + (formatNumberResult(parseFloat(jsonFixer.rates.GBP) * euroValue)).toFixed(2) + ' ' + currency); | ||||
|                     $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.GBP) * euroValue)).toFixed(2) + ' ' + currency); | ||||
|                     break; | ||||
|                 case '$ Américain': | ||||
|                     $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.USD) * euroValue)).toFixed(2) + ' ' + currency); | ||||
|                     break; | ||||
|                 case '$ Canadien': | ||||
|                             $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.CAD) * euroValue)).toFixed(2) + ' ' + currency); | ||||
|                             break; | ||||
|                 case '$ Australien': | ||||
|                         $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.AUD) * euroValue)).toFixed(2) + ' ' + currency); | ||||
|                         break; | ||||
|                 case '$ Mexicain': | ||||
|                         $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.MXN) * euroValue)).toFixed(2) + ' ' + currency); | ||||
|                         break; | ||||
|                 case 'Fr': | ||||
|                         $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.CHF) * euroValue)).toFixed(2) + ' ' + currency); | ||||
|                         break; | ||||
|                 case '₽': | ||||
|                         $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.RUB) * euroValue)).toFixed(2) + ' ' + currency); | ||||
|                         break; | ||||
|                 case 'R$': | ||||
|                         $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.BRL) * euroValue)).toFixed(2) + ' ' + currency); | ||||
|                         break; | ||||
|                 case '¥': | ||||
|                         $('.results').html(formatNumberResult(euroValue) + ' € = ' + ((parseFloat(jsonFixer.rates.JPY) * euroValue)).toFixed(2) + ' ' + currency); | ||||
|                         break; | ||||
|                 default: | ||||
|                     $('.results').html(formatNumberResult(euroValue) + ' €'); | ||||
|                     break; | ||||
| @@ -203,6 +224,7 @@ function convertCurrency(urlFixerIO, currency, euroValue) { | ||||
|     }); | ||||
| } | ||||
|  | ||||
|  | ||||
| ///////////////////////////////////////////////////////////////// | ||||
| /* Fonctions Annexes */ | ||||
|  | ||||
|   | ||||
| @@ -16,8 +16,15 @@ | ||||
|         <br> <br> | ||||
| 		<label for="euroToCurrency">Choisissez la devise que voulez avoir après conversion :</label> <br> | ||||
|         <select id="euroToCurrency"> | ||||
|             <option value="$">$ - USD - Dollar Américain</option> | ||||
|             <option value="£">£ - GBP - Livre sterling</option> | ||||
|             <option value="£">Livre sterling (£) - GBP</option> | ||||
|             <option value="$ Américain">Dollar Américain ($) - USD</option> | ||||
|             <option value="$ Canadien">Dollar Canadien ($) - CAD</option> | ||||
|             <option value="$ Australien">Dollar Australien ($) - AUD</option> | ||||
|             <option value="$ Mexicain">Peso Mexicain ($) - MXN</option> | ||||
|             <option value="Fr">Franc Suisse (Fr) - CHF</option> | ||||
|             <option value="₽">Rouble Russe (₽) - RUB</option> | ||||
|             <option value="R$">Réal brésilien (R$) - BRL</option> | ||||
|             <option value="¥">Yen (¥) - JPY</option> | ||||
|         </select> | ||||
|         <br> | ||||
|         <div class="form-row text-center"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user