This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertDateInFrench(datetime) { | |
if (!datetime) { | |
return "-"; | |
} | |
const date = new Date(datetime); | |
return date.toLocaleDateString("fr-FR", { | |
year: "numeric", | |
month: "long", | |
day: "numeric", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const options = { | |
data() { | |
return { | |
taskInput: "", | |
tasks: [], | |
error: false, | |
}; | |
}, | |
methods: { | |
addTask() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const form = document.querySelector("form"); | |
form.addEventListener("submit", async (e) => { | |
e.preventDefault(); | |
document.querySelector("#results").textContent = ""; | |
const q = form.q.value; | |
if (!q) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h1 { | |
margin-bottom: 1em !important; | |
font-size: 2em !important; | |
} | |
h2 { | |
padding-bottom: 0.5em; | |
border-bottom: 1px solid #999; | |
margin: 1em 0 !important; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://openweathermap.org/ | |
const apiKey = ""; // Insert your OpenWeatherMap API Key | |
const form = document.querySelector("form"); | |
function displayErrorMessage(message) { | |
document.querySelector("article").style.display = "none"; | |
const notice = document.querySelector(".notice"); | |
notice.textContent = message; | |
notice.style.display = "block"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async () => { | |
const response = await fetch( | |
"https://calendrier.api.gouv.fr/jours-feries/metropole/2025.json" | |
); | |
const data = await response.json(); | |
for (const day in data) { | |
const date = new Date(day); | |
console.log( | |
date.toLocaleDateString("fr-FR", { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector("form").addEventListener("submit", async (e) => { | |
e.preventDefault(); | |
document.querySelector(".loading").style.display = "block"; | |
const results = document.querySelector("#results"); | |
results.innerHTML = ""; | |
let response; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
<link rel="stylesheet" href="style.css" /> | |
<script src="scripts.js" defer></script> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let recipes = []; | |
const form = document.querySelector("form"); | |
form.addEventListener("submit", function (e) { | |
e.preventDefault(); | |
if ( | |
!form.name.value || | |
form.time.value < 1 || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addTaskInDom(task) { | |
const taskElement = document.createElement("div"); | |
const taskCheckbox = document.createElement("input"); | |
taskCheckbox.type = "checkbox"; | |
const id = `checkbox-${task.id}`; // const id = "checkbox-" + task.id; | |
taskCheckbox.id = id; | |
const taskLabelElement = document.createElement("label"); | |
taskLabelElement.textContent = task.text; |