diff --git a/incl/footer.php b/incl/footer.php index b88f952..931bbe9 100644 --- a/incl/footer.php +++ b/incl/footer.php @@ -29,12 +29,12 @@ - + \ No newline at end of file diff --git a/php/config.php b/php/config.php index b832395..5e1fc3e 100644 --- a/php/config.php +++ b/php/config.php @@ -14,18 +14,21 @@ switch ($currentpage) { $description = 'FunctionProject est un projet créé par Divlo qui a pour but de rassembler plein de mini-programme permettant de faire plusieurs choses comme savoir la météo, générer un nombre aléatoire, etc.'; $image = 'https://function.divlo.fr/img/FunctionProject_icon.png'; $indexActive = 'active'; + $scripts = array(''); break; case '/views/function-list.php': $title = 'Liste des fonctions'; $description = 'La liste des mini-programmes.'; $image = 'https://function.divlo.fr/img/FunctionProject_icon.png'; $functionlistActive = 'active'; + $scripts = array(''); break; case '/views/feedback-form_view.php': $title = 'Feedback Formulaire'; $description = "Vous pouvez m'envoyer votre avis sur le projet grâce à ce formulaire 📝."; $image = 'https://function.divlo.fr/img/Feedback-Formulaire.png'; $feedbackActive = 'active'; + $scripts = array(''); break; case '/views/feedback-list.php': $title = 'Liste des feedback'; @@ -78,6 +81,7 @@ switch ($currentpage) { $title = 'Liste des citations'; $description = "La liste de toutes les citations ou proverbes (aimé par Divlo)."; $image = 'https://function.divlo.fr/img/function-image/randomQuote.png'; + $scripts = array(''); break; case '/views/function-views/convertCurrency.php': $title = 'Conversion de devise'; @@ -113,22 +117,26 @@ switch ($currentpage) { $title = "Markdown"; $description = "Convertis du Markdown en HTML."; $image = 'https://function.divlo.fr/img/function-image/convertMarkdown.png'; + $scripts = array(''); break; case '/views/function-views/linkShortener.php': $title = "Raccourcisseurs de liens"; $description = "Une URL trop longue ? Raccourcissez-là !"; $image = 'https://function.divlo.fr/img/function-image/linkShortener.png'; + $scripts = array(''); break; case '/views/short_links-list.php': $title = 'Liste des liens récemment raccourcit'; $description = "La liste de vos liens raccourcit les plus récents."; $image = 'https://function.divlo.fr/img/function-image/linkShortener.png'; + $scripts = array(''); break; case '/views/function-views/toDoList.php': $title = 'Liste de choses à faire'; $description = "La liste des choses à faire."; $image = 'https://function.divlo.fr/img/function-image/toDoList.png'; $toDoListCSS = true; + $scripts = array(''); break; default: $title = 'Erreur 404'; diff --git a/scripts/execute-function/calculateAge_DOM.js b/scripts/execute-function/calculateAge_DOM.js index 1e48bc3..da7d4e7 100644 --- a/scripts/execute-function/calculateAge_DOM.js +++ b/scripts/execute-function/calculateAge_DOM.js @@ -4,4 +4,23 @@ $(function () { $("#birthDateValue").bind("keyup change", () => { $('.results').html(calculateAge($('#birthDateValue').val())); }); + + /* Date Picker */ + $.fn.datepicker.dates['fr'] = { + days: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], + daysShort: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."], + daysMin: ["d", "l", "ma", "me", "j", "v", "s"], + months: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"], + monthsShort: ["janv.", "févr.", "mars", "avril", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."], + today: "Aujourd'hui", + monthsTitle: "Mois", + clear: "Effacer", + weekStart: 1, + format: "dd/mm/yyyy" + }; + $('.datepicker').datepicker({ + language: 'fr', + autoclose: false, + todayHighlight: true + }); }); \ No newline at end of file diff --git a/scripts/execute-function/convertMarkdown_DOM.js b/scripts/execute-function/convertMarkdown_DOM.js new file mode 100644 index 0000000..bb681ef --- /dev/null +++ b/scripts/execute-function/convertMarkdown_DOM.js @@ -0,0 +1,13 @@ +$(function () { + if (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); + }); +}); \ No newline at end of file diff --git a/scripts/execute-function/feedbackForm_DOM.js b/scripts/execute-function/feedbackForm_DOM.js new file mode 100644 index 0000000..fc6665a --- /dev/null +++ b/scripts/execute-function/feedbackForm_DOM.js @@ -0,0 +1,18 @@ +$(function () { + $('#formLinkShortener').submit((event) => { + event.preventDefault(); + const postdata = $('#formLinkShortener').serialize(); + $.ajax({ + type: 'POST', + url: '../../php/shortenLink.php', + data: postdata, + success: (text) => { + try { + $(".results").html(JSON.parse(text).message); + } catch (error) { + $(".results").html("URL invalide."); + } + } + }); + }); +}); \ No newline at end of file diff --git a/scripts/execute-function/linkShortener_DOM.js b/scripts/execute-function/linkShortener_DOM.js new file mode 100644 index 0000000..6a5e7f9 --- /dev/null +++ b/scripts/execute-function/linkShortener_DOM.js @@ -0,0 +1,28 @@ +$(function () { + $('#formLinkShortener').submit((event) => { + event.preventDefault(); + const postdata = $('#formLinkShortener').serialize(); + $.ajax({ + type: 'POST', + url: '../../php/shortenLink.php', + data: postdata, + success: (text) => { + try { + $(".results").html(JSON.parse(text).message); + } catch (error) { + $(".results").html("URL invalide."); + } + } + }); + + // Affiche l'input selon le choix de l'utilisateur sur la page linkShortener + $('.hideUserShortcut').hide(); + $("#option").bind("keyup change", () => { + if ($("#option").val() == "userShortcut") { + $('.hideUserShortcut').show(); + } else { + $('.hideUserShortcut').hide(); + } + }); + }); +}); \ No newline at end of file diff --git a/scripts/toDoList.js b/scripts/execute-function/toDoList_DOM.js similarity index 100% rename from scripts/toDoList.js rename to scripts/execute-function/toDoList_DOM.js diff --git a/scripts/executeFunction.js b/scripts/executeFunction.js deleted file mode 100644 index 7ec5b3f..0000000 --- a/scripts/executeFunction.js +++ /dev/null @@ -1,57 +0,0 @@ -$(function () { - /* ÉXECUTION DES FONCTONS */ - - // Touche entrer génère un clique sur les classes .btn à part sur la page convertEncoding - $("body").keydown(function(e){ - if(e.which === 13 && chemin !== '/views/function-views/convertEncoding.php'){ - $(".btn").click(); - } - }); - - 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); - }); - - $('#formLinkShortener').submit((e) => { - e.preventDefault(); - const postdata = $('#formLinkShortener').serialize(); - $.ajax({ - type: 'POST', - url: '../../php/shortenLink.php', - data: postdata, - success: (text) => { - try { - $(".results").html(JSON.parse(text).message); - } catch (error) { - $(".results").html("URL invalide."); - } - } - }); - }); - - $('#feedbackForm').submit((e) => { - e.preventDefault(); - const postdata = $('#feedbackForm').serialize(); - $.ajax({ - type: 'POST', - url: '../../php/feedbackForm.php', - data: postdata, - success: (response) => { - const result = JSON.parse(response); - $(".results").html(result.message); - if(result.isSuccess) { - $("#feedbackForm")[0].reset(); - } - } - }); - }); - -}); \ No newline at end of file diff --git a/scripts/main.js b/scripts/main.js index 35b6a3d..8bc5e09 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -1,33 +1,4 @@ $(function () { - - /* Apparition au défilement avec animation */ - function setWindowScrollAppear() { - var $animate = $('.animate-up, .animate-down, .animate-left, .animate-right'); - $animate.appear(); - $animate.on('appear', function (event, affected) { - for (var i = 0; i < affected.length; i++) { - $(affected[i]).addClass('animated'); - } - }); - $.force_appear(); - } - setWindowScrollAppear(); - - /* Changement du texte accueil (exemples de fonction) */ - if(chemin === "/" || chemin === '/index.php') { - let index=-1; - function change() { - if(index === texteFonctionChange.length-1) { - index = 0; - } - else { - index++; - } - document.getElementById("change").innerHTML = texteFonctionChange[index]; - } - setInterval(change,10000); - } - /* Changement du logo du header selon la largeur de la fenêtre */ function widthWindowChange() { const windowWidth = $(window).width(); @@ -48,64 +19,10 @@ $(function () { /* Permet d'afficher l'heure en temps réel sur le footer */ realDateTime('realDateTime'); - /* Permet d'afficher la liste des citations/proverbes */ - if(chemin === "/views/quote-list.php") { - $('.totalLengthQuote').html('Total de ' + quotes.length + ' citations.'); - let resultat = ""; - for (index in quotes) { - resultat = resultat + ` ${quotes[index]["source"]} ${quotes[index]["quote"]} `; - } - $(".quote-list").append(resultat); - } - - /* Permet d'afficher la liste des liens récemment raccourcit */ - if(chemin === "/views/short_links-list.php") { - try { - const shortcuts = JSON.parse(getCookieValue("shortcuts")); - window.onload = $('.totalLengthLinksList').html(`Total de ${shortcuts.length} lien(s) raccourcit récemment.`); - let resultat = ""; - for (element of shortcuts) { - resultat += ` ${element["url"]} ${element["shortcut"]} `; - } - $(".links-list").append(resultat); - } catch(error) {} - } - /* Window Scroll Top Button */ const $btnScrollTop = $('.scroll-top-arrow'); $btnScrollTop.on('click', function () { $('html, body').animate({scrollTop: 0}, 800); return false; }); - - // Affiche l'input selon le choix de l'utilisateur sur la page linkShortener - if(chemin === '/views/function-views/linkShortener.php') { - $('.hideUserShortcut').hide(); - $("#option").bind("keyup change", () => { - if ($("#option").val() == "userShortcut") { - $('.hideUserShortcut').show(); - } else { - $('.hideUserShortcut').hide(); - } - }); - } - - /* Date Picker */ - $.fn.datepicker.dates['fr'] = { - days: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], - daysShort: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."], - daysMin: ["d", "l", "ma", "me", "j", "v", "s"], - months: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"], - monthsShort: ["janv.", "févr.", "mars", "avril", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."], - today: "Aujourd'hui", - monthsTitle: "Mois", - clear: "Effacer", - weekStart: 1, - format: "dd/mm/yyyy" - }; - $('.datepicker').datepicker({ - language: 'fr', - autoclose: false, - todayHighlight: true - }); }); \ No newline at end of file diff --git a/scripts/pagesJS/functions-list.js b/scripts/pagesJS/functions-list.js new file mode 100644 index 0000000..01ba1da --- /dev/null +++ b/scripts/pagesJS/functions-list.js @@ -0,0 +1,14 @@ +$(function () { + /* Apparition au défilement avec animation */ + function setWindowScrollAppear() { + var $animate = $('.animate-up, .animate-down, .animate-left, .animate-right'); + $animate.appear(); + $animate.on('appear', function (event, affected) { + for (var i = 0; i < affected.length; i++) { + $(affected[i]).addClass('animated'); + } + }); + $.force_appear(); + } + setWindowScrollAppear(); +}); \ No newline at end of file diff --git a/scripts/pagesJS/home-page.js b/scripts/pagesJS/home-page.js new file mode 100644 index 0000000..59a63ef --- /dev/null +++ b/scripts/pagesJS/home-page.js @@ -0,0 +1,14 @@ +$(function () { + /* Changement du texte accueil (exemples de fonction) */ + let index=-1; + function change() { + if(index === texteFonctionChange.length-1) { + index = 0; + } + else { + index++; + } + document.getElementById("change").innerHTML = texteFonctionChange[index]; + } + setInterval(change, 10000); +}); \ No newline at end of file diff --git a/scripts/pagesJS/quote-list.js b/scripts/pagesJS/quote-list.js new file mode 100644 index 0000000..9303bd4 --- /dev/null +++ b/scripts/pagesJS/quote-list.js @@ -0,0 +1,9 @@ +$(function () { + /* Permet d'afficher la liste des citations/proverbes */ + $('.totalLengthQuote').html('Total de ' + quotes.length + ' citations.'); + let resultat = ""; + for (index in quotes) { + resultat = resultat + ` ${quotes[index]["source"]} ${quotes[index]["quote"]} `; + } + $(".quote-list").append(resultat); +}); \ No newline at end of file diff --git a/scripts/pagesJS/short_links-list.js b/scripts/pagesJS/short_links-list.js new file mode 100644 index 0000000..83d5b50 --- /dev/null +++ b/scripts/pagesJS/short_links-list.js @@ -0,0 +1,12 @@ +$(function () { + /* Permet d'afficher la liste des liens récemment raccourcit */ + try { + const shortcuts = JSON.parse(getCookieValue("shortcuts")); + window.onload = $('.totalLengthLinksList').html(`Total de ${shortcuts.length} lien(s) raccourcit récemment.`); + let resultat = ""; + for (element of shortcuts) { + resultat += ` ${element["url"]} ${element["shortcut"]} `; + } + $(".links-list").append(resultat); + } catch(error) {} +}); \ No newline at end of file diff --git a/views/function-views/toDoList.php b/views/function-views/toDoList.php index baf5c13..33c86d8 100644 --- a/views/function-views/toDoList.php +++ b/views/function-views/toDoList.php @@ -40,7 +40,5 @@ - - \ No newline at end of file