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 loadButton = document.querySelector("#load"); | |
const loadingElement = document.querySelector("#loading"); | |
const errorElement = document.querySelector(".error"); | |
const usersListElement = document.querySelector("#users"); | |
loadButton.addEventListener("click", async function (event) { | |
event.preventDefault(); | |
loadingElement.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
<!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="https://unpkg.com/mvp.css"> | |
<script src="dog.js" defer></script> | |
<style> | |
.error { |
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
// getElement(s)By* | |
//const title = document.getElementById("title"); | |
const title = document.getElementsByTagName("h1"); | |
console.log(title[0]); | |
const subsubtitles = document.getElementsByTagName("h3"); | |
console.log(subsubtitles); | |
const subsubtitle2 = document.getElementById("subsubtitle2") |
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 max(a, b) { | |
if (a > b) { | |
return a; | |
} | |
return b; | |
} | |
console.log(max(1, 5)); | |
console.log(max(2, 2)); |
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).ready(function () { | |
$("form").on("submit", function (e) { | |
e.preventDefault(); | |
$(".error").hide(); | |
$(".no-results").hide(); | |
$("#results").hide(); | |
//const name = $("#name").val(); | |
let name = $("input[name='name']").val(); |
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 apiKey = "7DM9xWMcFqBNGWzapWk6d7e5FdsBkwe9"; | |
const limit = 10; | |
// Get results (gifs, stickers) from Giphy API | |
function getGiphyResults(url) { | |
$.get(url) | |
.done((response) => { | |
$.each(response.data, (index, value) => { | |
$( | |
`<img src="${value.images.fixed_height.webp}" alt="${value.title}" loading="lazy">` |
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 Search = { | |
data() { | |
return { | |
q: "", | |
}; | |
}, | |
methods: { | |
async search() { | |
if (!this.q) { | |
this.$emit("updateError", "Veuillez entrer une série"); |
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
Vue.createApp({ | |
data() { | |
return { | |
q: "", | |
error: "", | |
shows: [], | |
}; | |
}, | |
methods: { | |
async search() { |
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
[ | |
{ | |
"name": "Persimmon", | |
"id": 52, | |
"family": "Ebenaceae", | |
"order": "Rosales", | |
"genus": "Diospyros", | |
"nutritions": { | |
"calories": 81, | |
"fat": 0.0, |
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", |
NewerOlder