summaryrefslogtreecommitdiff
path: root/Statics/Js
diff options
context:
space:
mode:
authorDebulois <quentin@debulois.fr>2022-04-04 22:58:43 +0200
committerDebulois <quentin@debulois.fr>2022-04-04 22:58:43 +0200
commit5582d242d03692a7e1b2c631e1b4ff3f52e8b72c (patch)
treec1e0242053a46d7b4145111a78a3e86e3cfd2f0d /Statics/Js
parentb637d625216e50602d0bde8a544c281ca00af5fa (diff)
Révision complète du css et modification du js principalement
Diffstat (limited to 'Statics/Js')
-rw-r--r--Statics/Js/index.js33
-rw-r--r--Statics/Js/main.js23
-rw-r--r--Statics/Js/message.js26
-rw-r--r--Statics/Js/userinfo.js106
4 files changed, 0 insertions, 188 deletions
diff --git a/Statics/Js/index.js b/Statics/Js/index.js
deleted file mode 100644
index b468417..0000000
--- a/Statics/Js/index.js
+++ /dev/null
@@ -1,33 +0,0 @@
-
-// ****************************************************************************
-// INDEX
-// ****************************************************************************
-
-// Slideshow
-// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters
-function slideshow_start(slideNumber = 1) {
- let images = [
- "/Medias/Images/slide0.jpg",
- "/Medias/Images/slide1.jpg",
- "/Medias/Images/slide2.jpg"
- ];
-
- setInterval(() => {
- // Changement del'image de fond de de la div
- document.getElementById("slides").style.backgroundImage = `url("${images[slideNumber]}")`;
- // Untoggle les précedents
- // Utilisation de ternary, utilisation: condition ? Sivrai : Sifaux
- document.getElementById(`slide_${slideNumber !== 0 ? slideNumber - 1 : images.length - 1}`).classList.toggle("show_block");
- document.getElementById(`slideDot_${slideNumber !== 0 ? slideNumber - 1 : images.length - 1}`).classList.toggle("slideSelected");
- // Toggle le nouveau texte & selecteur
- document.getElementById(`slide_${slideNumber}`).classList.toggle("show_block");
- document.getElementById(`slideDot_${slideNumber}`).classList.toggle("slideSelected")
- // +1 sauf si fin
- if (slideNumber < images.length - 1) {
- slideNumber++;
- } else {
- slideNumber = 0;
- }
- }
- , 3000);
-}
diff --git a/Statics/Js/main.js b/Statics/Js/main.js
deleted file mode 100644
index 6fe6dec..0000000
--- a/Statics/Js/main.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// ****************************************************************************
-// Main
-// ****************************************************************************
-
-// Site web utilisés pour JS:
-// https://www.w3schools.com/js/default.asp
-// https://stackoverflow.com/
-
-// Changement de langue
-document.getElementById("navSelLang").addEventListener("change", () => {
- document.getElementById("navFormLang").submit();
-});
-
-// TODO: A commenter
-function show(parentId, element, id, className) {
- let elements = document.getElementById(parentId).getElementsByTagName(element);
- elements[id].classList.add(className);
- for (i = 0; i < elements.length; i++) {
- if (elements[i].id !== id) {
- elements[i].classList.remove(className);
- }
- }
-} \ No newline at end of file
diff --git a/Statics/Js/message.js b/Statics/Js/message.js
deleted file mode 100644
index fa8e675..0000000
--- a/Statics/Js/message.js
+++ /dev/null
@@ -1,26 +0,0 @@
-
-// ****************************************************************************
-// MESSAGES
-// ****************************************************************************
-
-// Redirection
-function redirect(page) {
- window.location.href = `/${page}.php`;
-}
-
-// Timer pour message
-function start_timer(page) {
- // var -> global, let -> local{}
- let seconds = 1;
- let text = document.getElementById("redirect").innerHTML;
- setInterval(() => {
- if (seconds > 0) {
- document.getElementById("redirect").innerHTML = `${text} ${seconds} .`;
- seconds --;
- } else {
- document.getElementById("redirect").innerHTML = `${text} ${seconds} .`;
- redirect(page);
- }
- },
- 1000);
-}
diff --git a/Statics/Js/userinfo.js b/Statics/Js/userinfo.js
deleted file mode 100644
index 6b4c1d9..0000000
--- a/Statics/Js/userinfo.js
+++ /dev/null
@@ -1,106 +0,0 @@
-
-// ****************************************************************************
-// USERINFO
-// ****************************************************************************
-// Mes sources pour créer cette partie:
-// https://stackoverflow.com/questions/1085801/get-selected-value-in-dropdown-list-using-javascript
-// https://stackoverflow.com/questions/47951287/dynamically-add-li-to-ul-javascript
-// https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode
-// https://www.encodedna.com/javascript/how-to-get-all-li-elements-in-ul-using-javascript.htm
-// https://www.geeksforgeeks.org/javascript-convert-an-array-to-json/
-// https://stackoverflow.com/questions/17785592/difference-between-json-stringify-and-json-parse
-// https://www.w3docs.com/snippets/javascript/how-to-remove-an-element-from-an-array-in-javascript.html
-// On passe par du JSON pour passer la liste des emplois du pro
-
-// ****************************************************************************
-// GLOBAL
-// ****************************************************************************
-var payload = [];
-var dictJobs = {};
-
-// ****************************************************************************
-// FONCTIONS ANNEXES
-// ****************************************************************************
-// Récupération des possibles emplois et stockage dans une variable
-function init_dict_jobs() {
- // Récupération des emplois disponibles
- let selJob = document.getElementById("jobsSel");
-
- // Pour chaque emploi disponible
- for (i = 0; i < selJob.length; i ++) {
- if (selJob[i].value !== "") {
- // Création d'un dictionnaire -> "Nom Emploi": "ID"
- dictJobs[selJob[i].text] = selJob[i].value;
- }
- }
-}
-
-// Création et ajout d'un bouton "supprimmer"
-function add_bouton_rm(li, jobsId) {
- // Création et configuration du bouton
- let buttonDel = document.createElement("button");
- buttonDel.type = "button";
- buttonDel.innerHTML = "<i class=\"fas fa-ban\"></i>";
- buttonDel.onclick = () => {remove(li, jobsId);};
-
- // Ajout du boutton au "li" passé en argument
- li.appendChild(buttonDel);
-}
-
-// ****************************************************************************
-// FONCTIONS PRINCIPALES
-// ****************************************************************************
-// Initiation
-function init() {
- // Peuplement du dictionnaire des emploies "Nom Emploi": "ID"
- init_dict_jobs();
-
- // Récupération des emplois déja présent
- let jobs = document.getElementById("jobsList").getElementsByTagName("li");
-
- // Pour chaque emploi déja enregistré
- for (i = 0; i < jobs.length; i ++) {
- // Ajout de chaques choix à la liste final "payload"
- payload.push(dictJobs[jobs[i].innerHTML]);
- // Ajout d'un id et d'un bouton remove à chaque "li".
- jobs[i].id = "jobId_" + dictJobs[jobs[i].innerHTML];
- add_bouton_rm(jobs[i], dictJobs[jobs[i].innerHTML]);
- }
-
- // Transformation de la liste des emplois choisis en JSON
- // et inscription de ce dernier dans la "value" de l'input "jobs".
- document.getElementById("jobs").value = JSON.stringify(payload);
-}
-
-// Ajout d'un emploi
-function add() {
- // Récupération du nom du choix dans le "select" des emplois
- let jobName = document.getElementById("jobsSel").options[jobsSel.selectedIndex].text;
-
- // Si l'emploi n'est pas deja dans "payload"
- // et si il fait bien partie du dictionnaire de tous les emplois
- if (jobName in dictJobs && !payload.includes(dictJobs[jobName])) {
- // Ajout à payload
- payload.push(dictJobs[jobName]);
- // Création, configuration et ajout du nouveau "li"
- let li = document.createElement("li");
- li.id = "jobId_" + dictJobs[jobName];
- li.appendChild(document.createTextNode(jobName));
- add_bouton_rm(li, dictJobs[jobName]);
- document.getElementById("jobsList").appendChild(li);
- // Transformation de la liste des emplois choisis en JSON
- // et inscription de ce dernier dans la "value" de l'input "jobs".
- document.getElementById("jobs").value = JSON.stringify(payload);
- }
-}
-
-// Suppression d'un emploi
-function remove(li, jobsId) {
- // Suppression de l'emploi dans "payload"
- payload.splice(payload.indexOf(jobsId), 1);
- // Suppression du "li" de l'emploi
- document.getElementById("jobsList").removeChild(li);
- // Transformation de la liste des emplois choisis en JSON
- // et inscription de ce dernier dans la "value" de l'input "jobs".
- document.getElementById("jobs").value = JSON.stringify(payload);
-}