From 3faef956f89f51c67c25db382730800335325a45 Mon Sep 17 00:00:00 2001 From: Fatima Abdimalik Date: Sat, 22 Aug 2020 17:05:06 +0100 Subject: [PATCH 1/6] fetch exercise compeleted --- .../mandatory/2-fetch-exercise/exercise.js | 16 ++++--- .../mandatory/2-fetch-exercise/index.html | 48 +++++++++---------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/week-8/Homework/mandatory/2-fetch-exercise/exercise.js b/week-8/Homework/mandatory/2-fetch-exercise/exercise.js index fb3a39c2a..4869612d5 100644 --- a/week-8/Homework/mandatory/2-fetch-exercise/exercise.js +++ b/week-8/Homework/mandatory/2-fetch-exercise/exercise.js @@ -17,10 +17,12 @@ Open index.html in your browser. Every time you refresh the page, a different greeting should be displayed in the box. */ -fetch('*** Write the API address here ***') - .then(function(response) { - return response.text(); - }) - .then(function(greeting) { - // Write the code to display the greeting text here - }); \ No newline at end of file +fetch("https://codeyourfuture.herokuapp.com/api/greetings") + .then((response) => response.text()) + .then((data) => { + document.getElementById("greeting-text").innerHTML = data; + }) + .catch((error) => { + console.log(error); + }); +// Write the code to display the greeting text here; diff --git a/week-8/Homework/mandatory/2-fetch-exercise/index.html b/week-8/Homework/mandatory/2-fetch-exercise/index.html index e3c9aa43c..923296047 100644 --- a/week-8/Homework/mandatory/2-fetch-exercise/index.html +++ b/week-8/Homework/mandatory/2-fetch-exercise/index.html @@ -1,28 +1,28 @@ - + - - - CodeYourFuture - Fetch - - - - + + + CodeYourFuture - Fetch + + + + - -

A greeting in a random language...

-

+ +

A greeting in a random language...

+

- - - \ No newline at end of file + + + From ed96af16ef85d9047596b3c525dc220c71ce4684 Mon Sep 17 00:00:00 2001 From: Fatima Abdimalik Date: Sat, 22 Aug 2020 18:51:44 +0100 Subject: [PATCH 2/6] dog-photo done --- .../mandatory/3-dog-photo-gallery/index.html | 30 +++++++++++++++++++ .../mandatory/3-dog-photo-gallery/script.js | 18 +++++++++++ 2 files changed, 48 insertions(+) create mode 100644 week-8/Homework/mandatory/3-dog-photo-gallery/index.html create mode 100644 week-8/Homework/mandatory/3-dog-photo-gallery/script.js diff --git a/week-8/Homework/mandatory/3-dog-photo-gallery/index.html b/week-8/Homework/mandatory/3-dog-photo-gallery/index.html new file mode 100644 index 000000000..9373052bc --- /dev/null +++ b/week-8/Homework/mandatory/3-dog-photo-gallery/index.html @@ -0,0 +1,30 @@ + + + + + + Dog-photo + + + +
+
    +
  • + +
  • +
+
+
+ +
+ + + diff --git a/week-8/Homework/mandatory/3-dog-photo-gallery/script.js b/week-8/Homework/mandatory/3-dog-photo-gallery/script.js new file mode 100644 index 000000000..55d8d1016 --- /dev/null +++ b/week-8/Homework/mandatory/3-dog-photo-gallery/script.js @@ -0,0 +1,18 @@ +console.log("Hello"); + +const fetchPhoto = () => { + fetch("https://dog.ceo/api/breeds/image/random") + .then((response) => response.json()) + .then((data) => { + let img = (document.getElementById("img").src = data.message); + }) + .catch((error) => { + console.log(error); + }); +}; +let button = document.getElementById("button"); +console.log(button); + +button.addEventListener("click", fetchPhoto); + +window.onload = fetchPhoto(); /// calls the function as soon as it loads From e41e1acf32463b76a1d60ee707ef36020e2f4a3e Mon Sep 17 00:00:00 2001 From: Fatima Abdimalik Date: Sat, 22 Aug 2020 20:08:10 +0100 Subject: [PATCH 3/6] finished functionalities --- .../mandatory/4-programmer-humour/index.html | 15 +++++++++++++++ .../mandatory/4-programmer-humour/script.js | 16 ++++++++++++++++ .../mandatory/4-programmer-humour/style.css | 3 +++ 3 files changed, 34 insertions(+) create mode 100644 week-8/Homework/mandatory/4-programmer-humour/index.html create mode 100644 week-8/Homework/mandatory/4-programmer-humour/script.js create mode 100644 week-8/Homework/mandatory/4-programmer-humour/style.css diff --git a/week-8/Homework/mandatory/4-programmer-humour/index.html b/week-8/Homework/mandatory/4-programmer-humour/index.html new file mode 100644 index 000000000..2d6a14864 --- /dev/null +++ b/week-8/Homework/mandatory/4-programmer-humour/index.html @@ -0,0 +1,15 @@ + + + + + + + Programmer-Humor + + +

Humorous Programmers

+
+ + + + diff --git a/week-8/Homework/mandatory/4-programmer-humour/script.js b/week-8/Homework/mandatory/4-programmer-humour/script.js new file mode 100644 index 000000000..ae21fbb9c --- /dev/null +++ b/week-8/Homework/mandatory/4-programmer-humour/script.js @@ -0,0 +1,16 @@ +// +const fetchData = () => { + fetch("https://xkcd.now.sh/?comic=latest") + .then((response) => response.json()) + .then((data) => { + console.log(data.img); + let img = document.createElement("img"); + img.src = data.img; + document.getElementById("container").appendChild(img); + }) + .catch((error) => { + console.log(error); + }); +}; + +window.onload = fetchData(); diff --git a/week-8/Homework/mandatory/4-programmer-humour/style.css b/week-8/Homework/mandatory/4-programmer-humour/style.css new file mode 100644 index 000000000..c24969e8f --- /dev/null +++ b/week-8/Homework/mandatory/4-programmer-humour/style.css @@ -0,0 +1,3 @@ +/* #title { + color: blueviolet; +} */ From b246d0467fc2fbb0fe6c4a67699dd0bc8d54065d Mon Sep 17 00:00:00 2001 From: Fatima Abdimalik Date: Sat, 22 Aug 2020 20:55:15 +0100 Subject: [PATCH 4/6] style changed --- .../mandatory/4-programmer-humour/script.js | 3 +-- .../mandatory/4-programmer-humour/style.css | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/week-8/Homework/mandatory/4-programmer-humour/script.js b/week-8/Homework/mandatory/4-programmer-humour/script.js index ae21fbb9c..dd77ca405 100644 --- a/week-8/Homework/mandatory/4-programmer-humour/script.js +++ b/week-8/Homework/mandatory/4-programmer-humour/script.js @@ -1,9 +1,8 @@ -// const fetchData = () => { fetch("https://xkcd.now.sh/?comic=latest") .then((response) => response.json()) .then((data) => { - console.log(data.img); + // console.log(data.img); let img = document.createElement("img"); img.src = data.img; document.getElementById("container").appendChild(img); diff --git a/week-8/Homework/mandatory/4-programmer-humour/style.css b/week-8/Homework/mandatory/4-programmer-humour/style.css index c24969e8f..abe17174c 100644 --- a/week-8/Homework/mandatory/4-programmer-humour/style.css +++ b/week-8/Homework/mandatory/4-programmer-humour/style.css @@ -1,3 +1,16 @@ -/* #title { - color: blueviolet; -} */ +@media only screen and (max-width: 600px) { + body { + background-color: lightblue; + } + #container img { + width: 15rem; + height: 5rem; + } + #title { + font-size: medium; + } +} + +#container img { + border: 5px dotted black; +} From f940318a2433ab783686bf7ab7ed4d7d5521ae1e Mon Sep 17 00:00:00 2001 From: Fatima Abdimalik Date: Sat, 22 Aug 2020 22:02:48 +0100 Subject: [PATCH 5/6] completed --- week-8/Homework/mandatory/1-practice/1-practice.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/week-8/Homework/mandatory/1-practice/1-practice.md b/week-8/Homework/mandatory/1-practice/1-practice.md index 02aa34989..8d76d0186 100644 --- a/week-8/Homework/mandatory/1-practice/1-practice.md +++ b/week-8/Homework/mandatory/1-practice/1-practice.md @@ -26,6 +26,12 @@ The following endpoint is publicly available from Github +`${owner}` : name of the github account owner; +`${repo}` : name of the reposiory +`${pull_number}` : number of the pull request + 2. Describe in a sentence what this API endpoint returns when all of the fields are completed? + +A json that contain all comments made on the pull request. From 7cdb2ce4b0b285ac0d741fbf489c7324c38ecbc7 Mon Sep 17 00:00:00 2001 From: Fatima Abdimalik Date: Sat, 22 Aug 2020 22:03:32 +0100 Subject: [PATCH 6/6] saved changes --- week-8/Homework/mandatory/1-practice/1-practice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/week-8/Homework/mandatory/1-practice/1-practice.md b/week-8/Homework/mandatory/1-practice/1-practice.md index 8d76d0186..5dc172c3e 100644 --- a/week-8/Homework/mandatory/1-practice/1-practice.md +++ b/week-8/Homework/mandatory/1-practice/1-practice.md @@ -27,7 +27,7 @@ The following endpoint is publicly available from Github `${owner}` : name of the github account owner; -`${repo}` : name of the reposiory +`${repo}` : name of the repository `${pull_number}` : number of the pull request 2. Describe in a sentence what this API endpoint returns when all of the fields are completed?