Small Hotfix documentation + convertArabicToRoman
No files matched your search
@@ -34,8 +34,8 @@ Enjoy! =D
|
|||||||
* [Moment.js](https://momentjs.com/)
|
* [Moment.js](https://momentjs.com/)
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
Pour le moment dans le dossier ```/__documentation```, bientôt un README.md pour bien comprendre comment fonctionne la doc.
|
La documentation est disponible sur [function.divlo.fr/documentation](https://function.divlo.fr/documentation).
|
||||||
La documentation est disponible sur [function.divlo.fr/__documentation](https://function.divlo.fr/__documentation).
|
Dans la documentation, il y a la toutes les fonctions, ce qu'elles return, etc.
|
||||||
|
|
||||||
## Licence
|
## Licence
|
||||||
Ce projet est sous licence MIT - voir le fichier [LICENSE](./LICENSE) pour plus de détails.
|
Ce projet est sous licence MIT - voir le fichier [LICENSE](./LICENSE) pour plus de détails.
|
||||||
@@ -202,7 +202,7 @@ function createSessionCookie(name, value) {
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon Nov 11 2019 17:45:44 GMT+0100 (GMT+01:00)
|
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sat Nov 16 2019 10:11:50 GMT+0100 (GMT+01:00)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
@@ -548,9 +548,9 @@ function convertRomanToArabic(str) {
|
|||||||
let result = 0;
|
let result = 0;
|
||||||
for (let i = 0;i < correspondancesRomainArabe.length; i++) {
|
for (let i = 0;i < correspondancesRomainArabe.length; i++) {
|
||||||
while (str.indexOf(correspondancesRomainArabe[i][1]) === 0){
|
while (str.indexOf(correspondancesRomainArabe[i][1]) === 0){
|
||||||
// Adding the decimal value to our result counter
|
// Ajout de la valeur décimale au résultat
|
||||||
result += correspondancesRomainArabe[i][0];
|
result += correspondancesRomainArabe[i][0];
|
||||||
// Remove the matched Roman letter from the beginning
|
// Supprimer la lettre romaine correspondante du début
|
||||||
str = str.replace(correspondancesRomainArabe[i][1],'');
|
str = str.replace(correspondancesRomainArabe[i][1],'');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -626,7 +626,7 @@ function stringPermutations(string) {
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon Nov 11 2019 17:45:44 GMT+0100 (GMT+01:00)
|
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sat Nov 16 2019 10:11:50 GMT+0100 (GMT+01:00)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 117 KiB |
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<div id="main">
|
<div id="main">
|
||||||
|
|
||||||
<h1 class="page-title">Functions</h1>
|
<h1 class="page-title">Global</h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -81,7 +81,22 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3 class="subsection-title">Methods</h3>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1442,10 +1457,7 @@
|
|||||||
|
|
||||||
<h5>Example</h5>
|
<h5>Example</h5>
|
||||||
|
|
||||||
<pre class="prettyprint"><code>convertCurrency(50, "$ Américain", "https://api.exchangeratesapi.io/latest?base=EUR")
|
<pre class="prettyprint"><code>convertCurrency(50, "$ Américain", "https://api.exchangeratesapi.io/latest?base=EUR") ␍Ajoute au DOM de la page dans la div .results et .rateDate :␍50 EUR = 55.17 $ Américain␍Dernier rafraîchissement du taux d'échange : 08/11/2019</code></pre>
|
||||||
Ajoute au DOM de la page dans la div .results et .rateDate :
|
|
||||||
50 EUR = 55.17 $ Américain
|
|
||||||
Dernier rafraîchissement du taux d'échange : 08/11/2019</code></pre>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -4141,8 +4153,7 @@ Dernier rafraîchissement du taux d'échange : 08/11/2019</code></pre>
|
|||||||
|
|
||||||
<h5>Example</h5>
|
<h5>Example</h5>
|
||||||
|
|
||||||
<pre class="prettyprint"><code>isValidDate('10/11/2019', '11/11/2019') → false → Comparaison entre le 10 décembre 2019 et le 11 novembre 2019
|
<pre class="prettyprint"><code>isValidDate('10/11/2019', '11/11/2019') → false → Comparaison entre le 10 décembre 2019 et le 11 novembre 2019␍isValidDate('10/10/2019', '11/11/2019') → true → Comparison entre le 10 novembre 2019 et le 11 novembre 2019</code></pre>
|
||||||
isValidDate('10/10/2019', '11/11/2019') → true → Comparison entre le 10 novembre 2019 et le 11 novembre 2019</code></pre>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -5480,10 +5491,7 @@ isValidDate('10/10/2019', '11/11/2019') → true → Comparison entre le 10 nove
|
|||||||
|
|
||||||
|
|
||||||
<div class="description">
|
<div class="description">
|
||||||
Affiche la météo et l'heure locale grâce à l'API : openweathermap.org.
|
Affiche la météo et l'heure locale grâce à l'API : openweathermap.org.␍Le nom de la ville se récupère en Javascript qui créé un cookie pour récupérer cette variable en php. ␍Ainsi PHP va récupérer le JSON de l'api openweathermap.org puis ajax va se charger d'afficher le résultat.␍Plus d'informations : /scripts/main.js et /php/getWeatherJson.php
|
||||||
Le nom de la ville se récupère en Javascript qui créé un cookie pour récupérer cette variable en php.
|
|
||||||
Ainsi PHP va récupérer le JSON de l'api openweathermap.org puis ajax va se charger d'afficher le résultat.
|
|
||||||
Plus d'informations : /scripts/main.js et /php/getWeatherJson.php
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -5598,7 +5606,7 @@ Plus d'informations : /scripts/main.js et /php/getWeatherJson.php
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon Nov 11 2019 17:45:44 GMT+0100 (GMT+01:00)
|
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sat Nov 16 2019 10:11:50 GMT+0100 (GMT+01:00)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>JSDoc: Home</title>
|
<title>FunctionProject Documentation</title>
|
||||||
|
|
||||||
<script src="scripts/prettify/prettify.js"> </script>
|
<script src="scripts/prettify/prettify.js"> </script>
|
||||||
<script src="scripts/prettify/lang-css.js"> </script>
|
<script src="scripts/prettify/lang-css.js"> </script>
|
||||||
@@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
<h1 class="page-title">FunctionProject</h1>
|
<h1 class="page-title">FunctionProject</h1>
|
||||||
|
|
||||||
<h3> </h3>
|
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<article>
|
<article>
|
||||||
<p><img src="https://cloud.divlo.fr/public_files/others/Trash/under_dev.svg" alt="Badge Status"></p>
|
<p><img src="https://cloud.divlo.fr/public_files/others/Trash/under_dev.svg" alt="Badge Status"></p>
|
||||||
@@ -48,7 +46,8 @@ $apiWeather = 'votre clé api pour openweathermap.org';
|
|||||||
<li><a href="https://momentjs.com/">Moment.js</a></li>
|
<li><a href="https://momentjs.com/">Moment.js</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<h2>Documentation</h2>
|
<h2>Documentation</h2>
|
||||||
<p>Pour le moment dans le dossier <code>/__documentation</code>, bientôt un README.md pour bien comprendre comment fonctionne la doc.</p>
|
<p>La documentation est disponible sur <a href="https://function.divlo.fr/documentation">function.divlo.fr/documentation</a>.
|
||||||
|
Dans la documentation, il y a la toutes les fonctions, ce qu'elles return, etc.</p>
|
||||||
<h2>Licence</h2>
|
<h2>Licence</h2>
|
||||||
<p>Ce projet est sous licence MIT - voir le fichier <a href="./LICENSE">LICENSE</a> pour plus de détails.</p></article>
|
<p>Ce projet est sous licence MIT - voir le fichier <a href="./LICENSE">LICENSE</a> pour plus de détails.</p></article>
|
||||||
</section>
|
</section>
|
||||||
@@ -61,13 +60,13 @@ $apiWeather = 'votre clé api pour openweathermap.org';
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<h2><a href="index.html">Home</a></h2><h3><a href="./global.html">Global</a></h3><ul><li><a href="global.html#armstrongNumber">armstrongNumber</a></li><li><a href="global.html#binaryToDecimal">binaryToDecimal</a></li><li><a href="global.html#binaryToHexadecimal">binaryToHexadecimal</a></li><li><a href="global.html#binaryToText">binaryToText</a></li><li><a href="global.html#calculateAge">calculateAge</a></li><li><a href="global.html#capitalize">capitalize</a></li><li><a href="global.html#convertArabicToRoman">convertArabicToRoman</a></li><li><a href="global.html#convertCurrency">convertCurrency</a></li><li><a href="global.html#convertDistance">convertDistance</a></li><li><a href="global.html#convertRomanToArabic">convertRomanToArabic</a></li><li><a href="global.html#convertTemperature">convertTemperature</a></li><li><a href="global.html#createSessionCookie">createSessionCookie</a></li><li><a href="global.html#dateTimeUTC">dateTimeUTC</a></li><li><a href="global.html#decimalToBinary">decimalToBinary</a></li><li><a href="global.html#decimalToHexadecimal">decimalToHexadecimal</a></li><li><a href="global.html#filterStudents">filterStudents</a></li><li><a href="global.html#formatNumberResult">formatNumberResult</a></li><li><a href="global.html#getRandomQuote">getRandomQuote</a></li><li><a href="global.html#hexadecimalToBinary">hexadecimalToBinary</a></li><li><a href="global.html#hexadecimalToDecimal">hexadecimalToDecimal</a></li><li><a href="global.html#hexadecimalToText">hexadecimalToText</a></li><li><a href="global.html#isEmptyValue">isEmptyValue</a></li><li><a href="global.html#isFloat">isFloat</a></li><li><a href="global.html#isValidDate">isValidDate</a></li><li><a href="global.html#numberUnicodeToText">numberUnicodeToText</a></li><li><a href="global.html#randomNumber">randomNumber</a></li><li><a href="global.html#realDateTime">realDateTime</a></li><li><a href="global.html#showDateTime">showDateTime</a></li><li><a href="global.html#stringPermutations">stringPermutations</a></li><li><a href="global.html#textToBinary">textToBinary</a></li><li><a href="global.html#textToHexadecimal">textToHexadecimal</a></li><li><a href="global.html#textToNumberUnicode">textToNumberUnicode</a></li><li><a href="global.html#weatherRequest">weatherRequest</a></li></ul>
|
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#armstrongNumber">armstrongNumber</a></li><li><a href="global.html#binaryToDecimal">binaryToDecimal</a></li><li><a href="global.html#binaryToHexadecimal">binaryToHexadecimal</a></li><li><a href="global.html#binaryToText">binaryToText</a></li><li><a href="global.html#calculateAge">calculateAge</a></li><li><a href="global.html#capitalize">capitalize</a></li><li><a href="global.html#convertArabicToRoman">convertArabicToRoman</a></li><li><a href="global.html#convertCurrency">convertCurrency</a></li><li><a href="global.html#convertDistance">convertDistance</a></li><li><a href="global.html#convertRomanToArabic">convertRomanToArabic</a></li><li><a href="global.html#convertTemperature">convertTemperature</a></li><li><a href="global.html#createSessionCookie">createSessionCookie</a></li><li><a href="global.html#dateTimeUTC">dateTimeUTC</a></li><li><a href="global.html#decimalToBinary">decimalToBinary</a></li><li><a href="global.html#decimalToHexadecimal">decimalToHexadecimal</a></li><li><a href="global.html#filterStudents">filterStudents</a></li><li><a href="global.html#formatNumberResult">formatNumberResult</a></li><li><a href="global.html#getRandomQuote">getRandomQuote</a></li><li><a href="global.html#hexadecimalToBinary">hexadecimalToBinary</a></li><li><a href="global.html#hexadecimalToDecimal">hexadecimalToDecimal</a></li><li><a href="global.html#hexadecimalToText">hexadecimalToText</a></li><li><a href="global.html#isEmptyValue">isEmptyValue</a></li><li><a href="global.html#isFloat">isFloat</a></li><li><a href="global.html#isValidDate">isValidDate</a></li><li><a href="global.html#numberUnicodeToText">numberUnicodeToText</a></li><li><a href="global.html#randomNumber">randomNumber</a></li><li><a href="global.html#realDateTime">realDateTime</a></li><li><a href="global.html#showDateTime">showDateTime</a></li><li><a href="global.html#stringPermutations">stringPermutations</a></li><li><a href="global.html#textToBinary">textToBinary</a></li><li><a href="global.html#textToHexadecimal">textToHexadecimal</a></li><li><a href="global.html#textToNumberUnicode">textToNumberUnicode</a></li><li><a href="global.html#weatherRequest">weatherRequest</a></li></ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon Nov 11 2019 17:45:44 GMT+0100 (GMT+01:00)
|
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sat Nov 16 2019 10:11:50 GMT+0100 (GMT+01:00)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
@@ -520,9 +520,9 @@ function convertRomanToArabic(str) {
|
|||||||
let result = 0;
|
let result = 0;
|
||||||
for (let i = 0;i < correspondancesRomainArabe.length; i++) {
|
for (let i = 0;i < correspondancesRomainArabe.length; i++) {
|
||||||
while (str.indexOf(correspondancesRomainArabe[i][1]) === 0){
|
while (str.indexOf(correspondancesRomainArabe[i][1]) === 0){
|
||||||
// Adding the decimal value to our result counter
|
// Ajout de la valeur décimale au résultat
|
||||||
result += correspondancesRomainArabe[i][0];
|
result += correspondancesRomainArabe[i][0];
|
||||||
// Remove the matched Roman letter from the beginning
|
// Supprimer la lettre romaine correspondante du début
|
||||||
str = str.replace(correspondancesRomainArabe[i][1],'');
|
str = str.replace(correspondancesRomainArabe[i][1],'');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,27 +147,27 @@ $(function () {
|
|||||||
if(isEmptyValue(numbersValue)) {
|
if(isEmptyValue(numbersValue)) {
|
||||||
$('.results').html(emptyMessageError);
|
$('.results').html(emptyMessageError);
|
||||||
}
|
}
|
||||||
else if (!isNaN(Number(numbersValue)) && convertNumberType === "Nombre Romain") {
|
else if (!isNaN(Number(numbersValue))) {
|
||||||
const result = convertArabicToRoman(parseInt(numbersValue));
|
if (convertNumberType === "Nombre Romain") {
|
||||||
let numbersValueFormat = formatNumberResult(numbersValue);
|
const result = convertArabicToRoman(parseInt(numbersValue));
|
||||||
if (result === messageError || isFloat(numbersValue)) {
|
let numbersValueFormat = formatNumberResult(numbersValue);
|
||||||
$('.results').html(messageError);
|
if (result === messageError || isFloat(numbersValue)) {
|
||||||
|
$('.results').html(messageError);
|
||||||
|
} else {
|
||||||
|
$('.results').html(`<b>${numbersValueFormat}</b> s'écrit <b>${result}</b> en chiffres romains.`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('.results').html(`<b>${numbersValueFormat}</b> s'écrit <b>${result}</b> en chiffres romains.`);
|
$('.results').html(`<b>${numbersValue}</b> est déjà en chiffres arabes.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (convertNumberType === "Nombre Arabe") {
|
else if (convertNumberType === "Nombre Arabe") {
|
||||||
if (!isNaN(Number(numbersValue))) {
|
const result = convertRomanToArabic(numbersValue.toUpperCase());
|
||||||
$('.results').html(`<b>${numbersValue}</b> est déjà en chiffres arabes.`);
|
|
||||||
} else {
|
|
||||||
numbersValue = numbersValue.toUpperCase();
|
|
||||||
const result = convertRomanToArabic(numbersValue);
|
|
||||||
if (result === 0) {
|
if (result === 0) {
|
||||||
$('.results').html(messageError);
|
$('.results').html(messageError);
|
||||||
} else {
|
} else {
|
||||||
$('.results').html(`<b>${numbersValue}</b> s'écrit <b>${formatNumberResult(result)}</b> en chiffres arabes.`);
|
$('.results').html(`<b>${numbersValue}</b> s'écrit <b>${formatNumberResult(result)}</b> en chiffres arabes.`);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('.results').html(messageError);
|
$('.results').html(messageError);
|
||||||
@@ -191,12 +191,14 @@ $(function () {
|
|||||||
$('.results').html(emptyMessageError);
|
$('.results').html(emptyMessageError);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
const start = new Date();
|
||||||
const stringPermutationsResult = stringPermutations(value);
|
const stringPermutationsResult = stringPermutations(value);
|
||||||
let result = "";
|
let result = "";
|
||||||
for (element in stringPermutationsResult) {
|
for (element in stringPermutationsResult) {
|
||||||
result = result + stringPermutationsResult[element] + "<br>";
|
result = result + stringPermutationsResult[element] + "<br>";
|
||||||
}
|
}
|
||||||
$('.results').html(`Il y a ${formatNumberResult(stringPermutationsResult.length)} possibilités d'anagramme pour le mot "${value}" qui contient ${value.length} caractères, la liste : <br><br> ${result}`);
|
const end = new Date();
|
||||||
|
$('.results').html(`Temps d'éxecution du script : ${end - start} ms. <br>Il y a ${formatNumberResult(stringPermutationsResult.length)} possibilités d'anagramme pour le mot "${value}" qui contient ${value.length} caractères, la liste : <br><br> ${result}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||