New function : convertMarkdown

This commit is contained in:
Divlo
2019-11-16 15:21:21 +01:00
parent 2226c02601
commit 9ddb55b607
9 changed files with 59 additions and 0 deletions

View File

@ -202,6 +202,19 @@ $(function () {
}
});
if (chemin === "/views/function-views/convertMarkdown.php" && localStorage.getItem('convertedHTML') && localStorage.getItem('texteMarkdown')) {
$('.results').html(localStorage.getItem('convertedHTML'));
$('#texteMarkdown').val(localStorage.getItem('texteMarkdown'));
}
$("#texteMarkdown").bind("keyup change", () => {
const textMarkdown = $('#texteMarkdown').val();
const convertedHTML = marked(textMarkdown);
localStorage.setItem("convertedHTML", convertedHTML);
localStorage.setItem("texteMarkdown", textMarkdown);
$('.results').html(convertedHTML);
});
/* Changement du texte accueil (exemples de fonction) */
if(chemin === "/" || chemin === '/index.php') {
let index=-1;

View File

@ -19,6 +19,7 @@ texteFonctionChange = [
'<a href="/views/function-views/convertRomanArabicNumbers.php">convertir des nombres arabes en nombres romains</a>',
`<a href="/views/function-views/armstrongNumber.php">vérifier si un nombre fait partie des nombres d'Armstrong</a>`,
`<a href="/views/function-views/heapAlgorithm.php">génèrer toutes les permutations uniques possibles d'une chaîne de caractère</a>`,
'<a href="/views/function-views/convertMarkdown.php">convertir du Markdown en HTML</a>',
'<a href="/views/function-views/weatherRequest.php">connaître la météo</a>'
];