From 9ddb55b60754df9ed0e190ba1da80b28beaa8be8 Mon Sep 17 00:00:00 2001 From: Divlo Date: Sat, 16 Nov 2019 15:21:21 +0100 Subject: [PATCH] New function : convertMarkdown --- README.md | 1 + css/style.css | 3 +++ img/function-image/convertMarkdown.png | Bin 0 -> 5171 bytes incl/footer.php | 1 + php/config.php | 5 +++++ scripts/main.js | 13 ++++++++++++ scripts/variables.js | 1 + views/function-list.php | 10 +++++++++ views/function-views/convertMarkdown.php | 25 +++++++++++++++++++++++ 9 files changed, 59 insertions(+) create mode 100644 img/function-image/convertMarkdown.png create mode 100644 views/function-views/convertMarkdown.php diff --git a/README.md b/README.md index da1b871..5a8ba68 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Enjoy! =D * [jQuery](https://jquery.com/) * [jQuery UI](https://jqueryui.com/) * [Moment.js](https://momentjs.com/) +* [Marked.js](https://github.com/markedjs/marked) ## Documentation La documentation est disponible sur [function.divlo.fr/documentation](https://function.divlo.fr/documentation). diff --git a/css/style.css b/css/style.css index 832d9b6..f9c6895 100644 --- a/css/style.css +++ b/css/style.css @@ -80,6 +80,9 @@ header { width: 80px !important; height: 40px !important; } +pre code { + color: #e83c8c !important; +} #currencyOfTheValue, #currencyAfter, #convertNumberType { width: 270px !important; } diff --git a/img/function-image/convertMarkdown.png b/img/function-image/convertMarkdown.png new file mode 100644 index 0000000000000000000000000000000000000000..eb37faf8c3b574bc1f0ab0535f29f9b28b5753f2 GIT binary patch literal 5171 zcmeHLYgAKL7CyN*kQ*K$AWumofOM+zh)a=x#NHrPtdBCaKEMZwPB9h+V~r#Af%igM zu(qge$5LwB;J7R^MT`}v%3vEFQtFB{wo{DOp#iPL!YDI32&1*L&$+S7)n7AfX4b4( zt3TvspZ)swclO!$9(Uy~nj7dh-VY%ZI4>vrDTHVbLex>l7gol0ePe-#)RdFA2_gS+ z_@4;X9*BfR)!Lk=79zAY0U@peOuvWcb%Zvn5&Bk-P(}?x5gT4DI5P*Kai`{G>z*#X z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?q1v{=I2+l32)r<~_bByD>{&{tp0m>*4?a literal 0 HcmV?d00001 diff --git a/incl/footer.php b/incl/footer.php index e3d89d7..0144e62 100644 --- a/incl/footer.php +++ b/incl/footer.php @@ -10,6 +10,7 @@ + diff --git a/php/config.php b/php/config.php index 165ecca..f552463 100644 --- a/php/config.php +++ b/php/config.php @@ -83,6 +83,11 @@ switch ($currentpage) { $description = "Heap's algorithm est un algorithme qui génère toutes les permutations uniques possibles d'une chaîne de caractère, ce sont en quelque sorte toutes les possibilités d'anagramme d'un mot (en changeant de place, les lettres d’un mot, permettent d’en créer un nouveau), par contre les mots n'ont pas besoin d'être de vrais mots qui ont du sens."; $image = 'https://function.divlo.fr/img/function-image/heapAlgorithm.png'; break; + case '/views/function-views/convertMarkdown.php': + $title = "Markdown"; + $description = "Convertis du Markdown en HTML."; + $image = 'https://function.divlo.fr/img/function-image/convertMarkdown.png'; + break; default: $title = 'Erreur 404'; $description = "Cette page n'existe pas!"; diff --git a/scripts/main.js b/scripts/main.js index 5edba85..4bff626 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -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; diff --git a/scripts/variables.js b/scripts/variables.js index 4d64bb7..4c8ba22 100644 --- a/scripts/variables.js +++ b/scripts/variables.js @@ -19,6 +19,7 @@ texteFonctionChange = [ 'convertir des nombres arabes en nombres romains', `vérifier si un nombre fait partie des nombres d'Armstrong`, `génèrer toutes les permutations uniques possibles d'une chaîne de caractère`, + 'convertir du Markdown en HTML', 'connaître la météo' ]; diff --git a/views/function-list.php b/views/function-list.php index b68a643..5b55302 100644 --- a/views/function-list.php +++ b/views/function-list.php @@ -111,6 +111,16 @@ + +
+
+
+

Markdown

+ Markdown +

Convertis du Markdown en HTML.

+
+
+
diff --git a/views/function-views/convertMarkdown.php b/views/function-views/convertMarkdown.php new file mode 100644 index 0000000..b04300c --- /dev/null +++ b/views/function-views/convertMarkdown.php @@ -0,0 +1,25 @@ + + + + + + + +
+

:

+

+
+ Markdown +
+
+
+ +
+
+

Votre texte...

+
+
+
+ + + \ No newline at end of file