From 517dca06fd652441989be60e2125bb20aa6df216 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 5 May 2023 16:42:51 -0400 Subject: [PATCH] Retirer references/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Peuvent être consultées ailleurs --- references/date.js | 80 ------------------------------------------ references/index.html | 35 ------------------ references/messages.js | 50 -------------------------- 3 files changed, 165 deletions(-) delete mode 100644 references/date.js delete mode 100644 references/index.html delete mode 100644 references/messages.js diff --git a/references/date.js b/references/date.js deleted file mode 100644 index 20be30c..0000000 --- a/references/date.js +++ /dev/null @@ -1,80 +0,0 @@ -document.addEventListener('DOMContentLoaded', (event) => { - startDateTime() -}); - -function startDateTime() { - setDateTime(); - setInterval(function () { - setDateTime() - }, 60000); -} - -function setDateTime() { - document.getElementById("time").innerHTML = currentTime(); - document.getElementById("date").innerHTML = currentDate(); -} - -function currentTime() { - const date = new Date(); - const hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(); - const minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); - - return hours + ":" + minutes; -} - -function currentDate() { - const d = new Date(); - const day = getDayOfWeek(d.getDay()); - const date = d.getDate(); - const month = getMonth(d.getMonth()); - - return day + " " + date + " " + month; -} - -function getDayOfWeek(day) { - switch (day) { - case 0: - return "Dim"; - case 1: - return "Lun"; - case 2: - return "Mar"; - case 3: - return "Mer"; - case 4: - return "Jeu"; - case 5: - return "Ven"; - case 6: - return "Sam"; - } -} - -function getMonth(month) { - switch (month) { - case 0: - return "Jan"; - case 1: - return "Fév"; - case 2: - return "Mar"; - case 3: - return "Avr"; - case 4: - return "Mai"; - case 5: - return "Juin"; - case 6: - return "Juil"; - case 7: - return "Août"; - case 8: - return "Sep"; - case 9: - return "Oct"; - case 10: - return "Nov"; - case 11: - return "Déc"; - } -} diff --git a/references/index.html b/references/index.html deleted file mode 100644 index 1d88010..0000000 --- a/references/index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - CMS Signage - - - - - - - - - - - -
- -
- -
- -
-
-
-
- -
-
-
- -
- - - diff --git a/references/messages.js b/references/messages.js deleted file mode 100644 index 4e00eec..0000000 --- a/references/messages.js +++ /dev/null @@ -1,50 +0,0 @@ -const VITESSE_DEFILEMENT = 20; -let elems = []; - -document.addEventListener('DOMContentLoaded', () => { - startMessages() -}); - -function startMessages() { - - fetchMessages(); - - const parent = document.getElementById("text-content"); - - setInterval(() => { - for (const child of parent.children) { - child.style.left = child.getBoundingClientRect().x - 1 + 'px'; - if (child.getBoundingClientRect().right < 0) { - parent.removeChild(child); - if (parent.childElementCount < 10) { - fetchMessages(); - } - } - } - }, VITESSE_DEFILEMENT); -} - -function fetchMessages() { - return new Promise((resolve) => { - fetch('getMessages.php') - .then(response => response.json()) - .then(json => { - Object.values(json).forEach((value) => { - addDiv(value) - }); - resolve() - }); - }); -} - -function addDiv(content) { - const parent = document.getElementById("text-content"); - const lastChild = parent.lastChild; - const elem = document.createElement("div"); - elem.appendChild(document.createTextNode(content)); - parent.appendChild(elem); - if (lastChild != null) { - elem.style.left = lastChild.getBoundingClientRect().right + 50 + "px"; - } - return elem; -}