From 7bf4869b660916d1ab922d4baa95f23a4f9adae0 Mon Sep 17 00:00:00 2001 From: mas Date: Sat, 19 Dec 2020 19:15:09 +0330 Subject: [PATCH 01/10] Ex1 --- .../homework/masoud/js-exercises/Ex1-johnWho.js | 17 +++++++++++++++++ .../masoud/js-exercises/Ex2-isItBiggerThan10.js | 0 .../masoud/js-exercises/Ex3-gottaCatchEmAll.js | 0 3 files changed, 17 insertions(+) create mode 100644 Week2/homework/masoud/js-exercises/Ex1-johnWho.js create mode 100644 Week2/homework/masoud/js-exercises/Ex2-isItBiggerThan10.js create mode 100644 Week2/homework/masoud/js-exercises/Ex3-gottaCatchEmAll.js diff --git a/Week2/homework/masoud/js-exercises/Ex1-johnWho.js b/Week2/homework/masoud/js-exercises/Ex1-johnWho.js new file mode 100644 index 000000000..6b9debd21 --- /dev/null +++ b/Week2/homework/masoud/js-exercises/Ex1-johnWho.js @@ -0,0 +1,17 @@ +function getAnonName(firstName) { + return new Promise((resolves, rejects) => { + if (firstName) { + resolves(`${firstName} Doe`); + } else { + rejects(new Error("You didn't pass in a first name!")); + } + }) +}; + +const firstName = 'Masoud'; +getAnonName(firstName).then(response => { + console.log(response); +}) + .catch(error => { + console.log(error); + }) \ No newline at end of file diff --git a/Week2/homework/masoud/js-exercises/Ex2-isItBiggerThan10.js b/Week2/homework/masoud/js-exercises/Ex2-isItBiggerThan10.js new file mode 100644 index 000000000..e69de29bb diff --git a/Week2/homework/masoud/js-exercises/Ex3-gottaCatchEmAll.js b/Week2/homework/masoud/js-exercises/Ex3-gottaCatchEmAll.js new file mode 100644 index 000000000..e69de29bb From 5c5c9935e7685f950db81d0d138120537321c3df Mon Sep 17 00:00:00 2001 From: mas Date: Sat, 19 Dec 2020 19:29:45 +0330 Subject: [PATCH 02/10] Ex2 --- .../masoud/js-exercises/Ex1-johnWho.js | 6 +++--- .../js-exercises/Ex2-isItBiggerThan10.js | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Week2/homework/masoud/js-exercises/Ex1-johnWho.js b/Week2/homework/masoud/js-exercises/Ex1-johnWho.js index 6b9debd21..fbf5e09c6 100644 --- a/Week2/homework/masoud/js-exercises/Ex1-johnWho.js +++ b/Week2/homework/masoud/js-exercises/Ex1-johnWho.js @@ -1,14 +1,14 @@ -function getAnonName(firstName) { +const getAnonName = firstName => { return new Promise((resolves, rejects) => { if (firstName) { - resolves(`${firstName} Doe`); + resolves(`${firstName} S`); } else { rejects(new Error("You didn't pass in a first name!")); } }) }; -const firstName = 'Masoud'; +const firstName = 'Mas'; getAnonName(firstName).then(response => { console.log(response); }) diff --git a/Week2/homework/masoud/js-exercises/Ex2-isItBiggerThan10.js b/Week2/homework/masoud/js-exercises/Ex2-isItBiggerThan10.js index e69de29bb..4767e1e12 100644 --- a/Week2/homework/masoud/js-exercises/Ex2-isItBiggerThan10.js +++ b/Week2/homework/masoud/js-exercises/Ex2-isItBiggerThan10.js @@ -0,0 +1,18 @@ +const checkDoubleDigits = number => { + return new Promise((resolves, rejects) => { + if (number >= 10) { + resolves('The number is bigger than or equal 10!'); + } else { + rejects(new Error('Error! The number is smaller than 10...')); + } + }) +}; + +const number = 10; + +checkDoubleDigits(number).then(response => { + console.log(response); +}) + .catch(error => { + console.log(error); + }) \ No newline at end of file From b8df8104984ae27d860d8affc82d26e37d99e38e Mon Sep 17 00:00:00 2001 From: mas Date: Sun, 20 Dec 2020 19:13:01 +0330 Subject: [PATCH 03/10] Ex3 --- .../js-exercises/Ex3-gottaCatchEmAll.js | 0 Week2/homework/masoud/pokemon-app/index.html | 15 +++++ Week2/homework/masoud/pokemon-app/script.js | 64 +++++++++++++++++++ 3 files changed, 79 insertions(+) delete mode 100644 Week2/homework/masoud/js-exercises/Ex3-gottaCatchEmAll.js create mode 100644 Week2/homework/masoud/pokemon-app/index.html create mode 100644 Week2/homework/masoud/pokemon-app/script.js diff --git a/Week2/homework/masoud/js-exercises/Ex3-gottaCatchEmAll.js b/Week2/homework/masoud/js-exercises/Ex3-gottaCatchEmAll.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/Week2/homework/masoud/pokemon-app/index.html b/Week2/homework/masoud/pokemon-app/index.html new file mode 100644 index 000000000..8ec3aff7a --- /dev/null +++ b/Week2/homework/masoud/pokemon-app/index.html @@ -0,0 +1,15 @@ + + + + + + + pokemon + + + + + + + + \ No newline at end of file diff --git a/Week2/homework/masoud/pokemon-app/script.js b/Week2/homework/masoud/pokemon-app/script.js new file mode 100644 index 000000000..c689b5396 --- /dev/null +++ b/Week2/homework/masoud/pokemon-app/script.js @@ -0,0 +1,64 @@ +//Calling main function after window load +window.onload = main; + +//Define main function +function main(data) { + // Define input element + const input = document.createElement('input'); + input.type = 'number'; + input.min = '1'; + input.max = '895'; + input.style.width = '110px'; + input.placeholder = 'Insert a number'; + document.body.appendChild(input); + + //Define button element + const btn = document.createElement('button'); + btn.textContent = 'start'; + btn.style.display = 'block'; + document.body.appendChild(btn); + + //When button is clicked + btn.addEventListener('click', () => { + if (input.value > 0 && input.value < 896) { //Check input + const url = `https://pokeapi.co/api/v2/pokemon/${input.value}`;//Define API URL + fetchData(url); // Get data from API and insert to DOM + } else { + alert('Your input number must be between 0 and 895!') + }; + }); +}; + +// Add data to DOM +function addPokemonToDOM(data) { + // Define img element + const imgSRC = data.sprites.back_default + const image = document.createElement('img'); + image.src = imgSRC; + document.body.appendChild(image); + //disapear img element after 1.5 second + window.setTimeout(() => { + document.body.removeChild(image); + }, 1500); +}; + +//Get data from API by using fetch API +function fetchData(url) { + fetch(url) // First getting data + .then(function (response) { + return response.json(); + }) + .then(function (myJson) { + addPokemonToDOM(myJson); // Add data to DOM + return fetch(url); //Second getting data + }) + .then((response => { + return response.json(); + })) + .then((myJson) => { + addPokemonToDOM(myJson);// Add data to DOM + }) + .catch(function (error) { + console.log('error:' + error); + }); +}; \ No newline at end of file From 7652c8dcfeaccf94d897c32ee234f0adb2f6378e Mon Sep 17 00:00:00 2001 From: mas Date: Mon, 21 Dec 2020 19:28:09 +0330 Subject: [PATCH 04/10] Start project week2 --- hackyourrepo-app/Masoud/css/style.css | 92 ++++++++++++++++++++++++ hackyourrepo-app/Masoud/img/favicon.ico | Bin 0 -> 1150 bytes hackyourrepo-app/Masoud/img/hyf.png | Bin 0 -> 7827 bytes hackyourrepo-app/Masoud/index.html | 67 +++++++++++++++++ hackyourrepo-app/Masoud/js/script.js | 1 + hackyourrepo-app/hyf.png | Bin 9116 -> 0 bytes hackyourrepo-app/index.html | 25 ------- hackyourrepo-app/script.js | 5 -- hackyourrepo-app/style.css | 3 - 9 files changed, 160 insertions(+), 33 deletions(-) create mode 100644 hackyourrepo-app/Masoud/css/style.css create mode 100644 hackyourrepo-app/Masoud/img/favicon.ico create mode 100644 hackyourrepo-app/Masoud/img/hyf.png create mode 100644 hackyourrepo-app/Masoud/index.html create mode 100644 hackyourrepo-app/Masoud/js/script.js delete mode 100755 hackyourrepo-app/hyf.png delete mode 100755 hackyourrepo-app/index.html delete mode 100755 hackyourrepo-app/script.js delete mode 100755 hackyourrepo-app/style.css diff --git a/hackyourrepo-app/Masoud/css/style.css b/hackyourrepo-app/Masoud/css/style.css new file mode 100644 index 000000000..be7c42c4a --- /dev/null +++ b/hackyourrepo-app/Masoud/css/style.css @@ -0,0 +1,92 @@ +* { + padding: 0; + margin: 0; + box-sizing: border-box; +} + +body{ + background-color: #313267; + font-size: 14px; + font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; + width: 100vw; + height: calc(100vh - 20px); + overflow: hidden; +} + +header{ + height: 15%; + background-color:#313267 ; +} + + +header a{ + height: 100%; + display: block; + text-align: center; +} + +img{ + height: inherit; + padding: 5px; +} + +.container{ + background-color: #6ed5e7; + width: calc(95% - 5px); + margin: auto; + height: 85%; +} + +.selector{ + padding: 10px; + font-size: 1.7em; + background-color: rgb(252, 103, 49); + color: white; +} + +#repo-items{ + font-size: 16px; + font-family: sans-serif; + font-weight: 700; + color: #444; + padding: .6em 1.4em .5em .8em; + max-width: 100%; /* useful when width is set to anything other than 100% */ + margin: 0px auto; + border: 1px solid #aaa; + -moz-appearance: none; + -webkit-appearance: none; + background-color: #fff; + font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; +} + +.des-con{ + display: flex; + padding: 10px; +} + +.description, .contributers{ + width: 50%; + border: 3px rgb(223, 152, 152) solid; + margin: 5px; + +} + +table{ + border-spacing: 10px; +} + +@media only screen and (max-width:550px){ + .des-con{ + flex-direction: column; + align-items: center; + } + .description, .contributers{ + width: 90%; + } + .selector{ + text-align: center; + } + #repo-items{ + margin-top: 10px; + } +} \ No newline at end of file diff --git a/hackyourrepo-app/Masoud/img/favicon.ico b/hackyourrepo-app/Masoud/img/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..08da91b2b27efa8b1edb66144eb58e89ada55f7f GIT binary patch literal 1150 zcmds1&rcIk5Pl|{4JXeWy~s}^MiI~p(Ss($A~h{iT4)IrT1qMjrnJ;m&+l^@W z5w>kgNFb$$iV{g^B8ib6df?zc^EvZ2i>pUYgluN#y_xsD`R1F=3UQ5|=4L_f7U5|U z;)W37CK-h&qQ}VzLAly>-Q=EL?#>QeHJj*Yhv#;e-d9(r^yho(m)GV!_s^K%zyLl5 zgLwPWiak|@GGfO&?=<4CMzE{qkdMbvTuDhQB$M#RadLvQ(^Glopisa}PtRXG)%W%FLJb6vne;%h+hlF#!yFX59Uo?A zq0a01_cLC2@882X)eT!L@=Vt6!}Q&5jJLJQc*^NSE-;5uI*s+EC1{F*g(r{UYP}`% zM&Fte!*RKc@~2fy5uW3G@8w2WG7#+n_ z_Z>Y)x`!>#k#sl^v)RCWnfu(Mhf-?;&pl-QetceBq=VV~n`}_OweP;)?N(Ht3ef+3aagfhrJCnihMgyx0uO-%uF|V0#6EOe) literal 0 HcmV?d00001 diff --git a/hackyourrepo-app/Masoud/img/hyf.png b/hackyourrepo-app/Masoud/img/hyf.png new file mode 100644 index 0000000000000000000000000000000000000000..e01f8716881a5a1c683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index.html b/hackyourrepo-app/Masoud/index.html new file mode 100644 index 000000000..34d6e57b6 --- /dev/null +++ b/hackyourrepo-app/Masoud/index.html @@ -0,0 +1,67 @@ + + + + + + + Hack Your Future + + + + + +
+ +
+ +
+
+
+ + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
RepositorySampleRepo1
DescriptionThis repository is meant to be a sample
Forks5
Updated2020-05-27 12:00:00
+
+ +
+

contributers

+
+
+ +
+ +
+ + + + + + \ No newline at end of file diff --git a/hackyourrepo-app/Masoud/js/script.js b/hackyourrepo-app/Masoud/js/script.js new file mode 100644 index 000000000..bb31a8bb4 --- /dev/null +++ b/hackyourrepo-app/Masoud/js/script.js @@ -0,0 +1 @@ +console.log('ssadfd'); diff --git a/hackyourrepo-app/hyf.png b/hackyourrepo-app/hyf.png deleted file mode 100755 index 76bc5a13b4a53ea97a6c09ca5fe399f40ab20e4e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9116 zcmeHtS2$eX+jc@C5+Oyj5&RNCq7y^(h!&k-MkhpPMDIidiJFKKjNa=IMmHp)j?Roa zMDL>;#*BIA_Z@ui>G!@z-@*U7);`$l+IwGX-}`yibKlRszvybK(%u5xx^m?Tt=em) zH&?D){rc}gO+lWygUQXfa)r}IO-aGP54wZ#H8TMJCLJIQqVsyAAuYgKvC)fZ9vsc(Kh zh-qq((#n)Fsxg9(js4V_#2OkmTA%@1?{8%HhGa^As-wMie0T`SA0^-eOIlk+aRI-Q z`I^3bVNqieT^=sr1--ajL|k6YI<&n-qdpnh)IP5mg22*utCnq^`!28{2l~PK_e<<< zhB5rzlMMNIsMCwC9HqUU63k}`1VSY=GbeM(&C|}0qegQvlpG=ZuWZK3RABRu_9}l&mgc)HmzSO5x5q0h87`Gq*O}T0 zsXD`1NMXZ#2R&+jdQTr8;iU?TwvVU>wYBgx`OxU>_TTjGC$FUN+S%e0PYjihT^4G- zdz`W*XiG7qS|>7&Qrt5tTG<%ktxyf*)Q$x_C^J&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--- a/hackyourrepo-app/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - HackYourRepo - - - - - - - diff --git a/hackyourrepo-app/script.js b/hackyourrepo-app/script.js deleted file mode 100755 index a2206d1ed..000000000 --- a/hackyourrepo-app/script.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -/* - Write here your JavaScript for HackYourRepo! -*/ diff --git a/hackyourrepo-app/style.css b/hackyourrepo-app/style.css deleted file mode 100755 index 5b3acae8a..000000000 --- a/hackyourrepo-app/style.css +++ /dev/null @@ -1,3 +0,0 @@ -/* - Write here your CSS rules for HackYourRepo! -*/ From a579b8685008f3a5692dedc5ddf043f7c80e327f Mon Sep 17 00:00:00 2001 From: mas Date: Mon, 21 Dec 2020 19:49:53 +0330 Subject: [PATCH 05/10] change folder --- hackyourrepo-app/Masoud/{ => week2}/css/style.css | 0 hackyourrepo-app/Masoud/{ => week2}/img/favicon.ico | Bin hackyourrepo-app/Masoud/{ => week2}/img/hyf.png | Bin hackyourrepo-app/Masoud/{ => week2}/index.html | 0 hackyourrepo-app/Masoud/{ => week2}/js/script.js | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename hackyourrepo-app/Masoud/{ => week2}/css/style.css (100%) rename hackyourrepo-app/Masoud/{ => week2}/img/favicon.ico (100%) rename hackyourrepo-app/Masoud/{ => week2}/img/hyf.png (100%) rename hackyourrepo-app/Masoud/{ => week2}/index.html (100%) rename hackyourrepo-app/Masoud/{ => week2}/js/script.js (100%) diff --git a/hackyourrepo-app/Masoud/css/style.css b/hackyourrepo-app/Masoud/week2/css/style.css similarity index 100% rename from hackyourrepo-app/Masoud/css/style.css rename to hackyourrepo-app/Masoud/week2/css/style.css diff --git a/hackyourrepo-app/Masoud/img/favicon.ico b/hackyourrepo-app/Masoud/week2/img/favicon.ico similarity index 100% rename from hackyourrepo-app/Masoud/img/favicon.ico rename to hackyourrepo-app/Masoud/week2/img/favicon.ico diff --git a/hackyourrepo-app/Masoud/img/hyf.png b/hackyourrepo-app/Masoud/week2/img/hyf.png similarity index 100% rename from hackyourrepo-app/Masoud/img/hyf.png rename to hackyourrepo-app/Masoud/week2/img/hyf.png diff --git a/hackyourrepo-app/Masoud/index.html b/hackyourrepo-app/Masoud/week2/index.html similarity index 100% rename from hackyourrepo-app/Masoud/index.html rename to hackyourrepo-app/Masoud/week2/index.html diff --git a/hackyourrepo-app/Masoud/js/script.js b/hackyourrepo-app/Masoud/week2/js/script.js similarity index 100% rename from hackyourrepo-app/Masoud/js/script.js rename to hackyourrepo-app/Masoud/week2/js/script.js From 39e4a5fa48cce11b3e38a6ae11eb7b32fb68e866 Mon Sep 17 00:00:00 2001 From: mas Date: Tue, 22 Dec 2020 23:33:54 +0330 Subject: [PATCH 06/10] Fixed Ex3 --- Week2/homework/masoud/pokemon-app/script.js | 79 +++++++++++---------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/Week2/homework/masoud/pokemon-app/script.js b/Week2/homework/masoud/pokemon-app/script.js index c689b5396..dd776673a 100644 --- a/Week2/homework/masoud/pokemon-app/script.js +++ b/Week2/homework/masoud/pokemon-app/script.js @@ -2,63 +2,68 @@ window.onload = main; //Define main function -function main(data) { - // Define input element - const input = document.createElement('input'); - input.type = 'number'; - input.min = '1'; - input.max = '895'; - input.style.width = '110px'; - input.placeholder = 'Insert a number'; - document.body.appendChild(input); - +function main() { //Define button element const btn = document.createElement('button'); btn.textContent = 'start'; btn.style.display = 'block'; document.body.appendChild(btn); + // Define select element + const select = document.createElement('select'); + document.body.appendChild(select); + //When button is clicked btn.addEventListener('click', () => { - if (input.value > 0 && input.value < 896) { //Check input - const url = `https://pokeapi.co/api/v2/pokemon/${input.value}`;//Define API URL - fetchData(url); // Get data from API and insert to DOM - } else { - alert('Your input number must be between 0 and 895!') - }; + const url = `https://pokeapi.co/api/v2/pokemon/?limit=20&offset=20`;//Define API URL + fetchData(url, select); // Get data from API and insert to DOM }); -}; +} // Add data to DOM -function addPokemonToDOM(data) { - // Define img element - const imgSRC = data.sprites.back_default - const image = document.createElement('img'); - image.src = imgSRC; - document.body.appendChild(image); - //disapear img element after 1.5 second - window.setTimeout(() => { - document.body.removeChild(image); - }, 1500); +function addPokemonToDOM(data, select) { + + //Add list to select tag + data.results.forEach(element => { + const option = document.createElement('option'); + option.value = element.name; + option.textContent = element.name; + select.appendChild(option); + }); + + //User selection + select.addEventListener('input', () => { + + data.results.forEach(element => { + if (select.value == element.name) { + const imgURL = element.url; + fetch(imgURL) // second API request to get image + .then(function (response) { + return response.json(); + }) + .then(function (myJson) { + const img = document.createElement('img'); + img.src = myJson.sprites.back_default; + document.body.appendChild(img); + }) + .catch(function (error) { + console.log(error); + }); + } + }) + }) }; //Get data from API by using fetch API -function fetchData(url) { +function fetchData(url, select) { fetch(url) // First getting data .then(function (response) { return response.json(); }) .then(function (myJson) { - addPokemonToDOM(myJson); // Add data to DOM - return fetch(url); //Second getting data - }) - .then((response => { - return response.json(); - })) - .then((myJson) => { - addPokemonToDOM(myJson);// Add data to DOM + addPokemonToDOM(myJson, select); // Add data to DOM }) .catch(function (error) { - console.log('error:' + error); + console.log(error); }); }; \ No newline at end of file From 30c5a238466edff481e30c849984402a111c27a2 Mon Sep 17 00:00:00 2001 From: mas Date: Wed, 23 Dec 2020 00:40:15 +0330 Subject: [PATCH 07/10] Fixed Ex3 again :D --- Week2/homework/masoud/pokemon-app/script.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Week2/homework/masoud/pokemon-app/script.js b/Week2/homework/masoud/pokemon-app/script.js index dd776673a..4bbff0829 100644 --- a/Week2/homework/masoud/pokemon-app/script.js +++ b/Week2/homework/masoud/pokemon-app/script.js @@ -11,17 +11,21 @@ function main() { // Define select element const select = document.createElement('select'); + select.style.display = 'block'; document.body.appendChild(select); + //Define image + const img = document.createElement('img'); + //When button is clicked btn.addEventListener('click', () => { const url = `https://pokeapi.co/api/v2/pokemon/?limit=20&offset=20`;//Define API URL - fetchData(url, select); // Get data from API and insert to DOM + fetchData(url, select, img); // Get data from API and insert to DOM }); } // Add data to DOM -function addPokemonToDOM(data, select) { +function addPokemonToDOM(data, select, img) { //Add list to select tag data.results.forEach(element => { @@ -33,7 +37,6 @@ function addPokemonToDOM(data, select) { //User selection select.addEventListener('input', () => { - data.results.forEach(element => { if (select.value == element.name) { const imgURL = element.url; @@ -42,7 +45,6 @@ function addPokemonToDOM(data, select) { return response.json(); }) .then(function (myJson) { - const img = document.createElement('img'); img.src = myJson.sprites.back_default; document.body.appendChild(img); }) @@ -55,13 +57,13 @@ function addPokemonToDOM(data, select) { }; //Get data from API by using fetch API -function fetchData(url, select) { +function fetchData(url, select, img) { fetch(url) // First getting data .then(function (response) { return response.json(); }) .then(function (myJson) { - addPokemonToDOM(myJson, select); // Add data to DOM + addPokemonToDOM(myJson, select, img); // Add data to DOM }) .catch(function (error) { console.log(error); From 5d733acdec4796e5def1debadd57dd96a0cf28c5 Mon Sep 17 00:00:00 2001 From: mas Date: Wed, 23 Dec 2020 22:28:15 +0330 Subject: [PATCH 08/10] Fnished project week2 --- hackyourrepo-app/Masoud/week2/css/style.css | 39 ++++- hackyourrepo-app/Masoud/week2/index.html | 50 ------ hackyourrepo-app/Masoud/week2/js/script.js | 166 +++++++++++++++++++- 3 files changed, 198 insertions(+), 57 deletions(-) diff --git a/hackyourrepo-app/Masoud/week2/css/style.css b/hackyourrepo-app/Masoud/week2/css/style.css index be7c42c4a..155319d68 100644 --- a/hackyourrepo-app/Masoud/week2/css/style.css +++ b/hackyourrepo-app/Masoud/week2/css/style.css @@ -10,7 +10,6 @@ body{ font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; width: 100vw; height: calc(100vh - 20px); - overflow: hidden; } header{ @@ -39,13 +38,13 @@ img{ .selector{ padding: 10px; - font-size: 1.7em; + font-size: 1.4em; background-color: rgb(252, 103, 49); color: white; } #repo-items{ - font-size: 16px; + font-size: 12px; font-family: sans-serif; font-weight: 700; color: #444; @@ -65,10 +64,31 @@ img{ } .description, .contributers{ - width: 50%; - border: 3px rgb(223, 152, 152) solid; + border: 2px rgb(223, 152, 152) solid; margin: 5px; - + height: 70vh; + overflow: auto; +} + +.description { + width: 40%; +} + +.contributers{ + width: 60%; +} + +.contributers img{ + width: 20%; + border-radius: 50%; +} + +.items { + display: flex; + justify-content: space-between; + padding: 5px 15px; + margin: 5px; + align-items: center; } table{ @@ -82,6 +102,8 @@ table{ } .description, .contributers{ width: 90%; + overflow:visible; + height: auto; } .selector{ text-align: center; @@ -89,4 +111,9 @@ table{ #repo-items{ margin-top: 10px; } + + body{ + width: 100%; + height: 100%; + } } \ No newline at end of file diff --git a/hackyourrepo-app/Masoud/week2/index.html b/hackyourrepo-app/Masoud/week2/index.html index 34d6e57b6..4b6489974 100644 --- a/hackyourrepo-app/Masoud/week2/index.html +++ b/hackyourrepo-app/Masoud/week2/index.html @@ -10,56 +10,6 @@ -
- -
- -
-
-
- - -
- -
-
- - - - - - - - - - - - - - - - - - - - - -
RepositorySampleRepo1
DescriptionThis repository is meant to be a sample
Forks5
Updated2020-05-27 12:00:00
-
- -
-

contributers

-
-
- -
- -
- diff --git a/hackyourrepo-app/Masoud/week2/js/script.js b/hackyourrepo-app/Masoud/week2/js/script.js index bb31a8bb4..772db5711 100644 --- a/hackyourrepo-app/Masoud/week2/js/script.js +++ b/hackyourrepo-app/Masoud/week2/js/script.js @@ -1 +1,165 @@ -console.log('ssadfd'); +//Calling main function after window load +window.onload = main; + +//Define main function +function main() { + //Create header element and its children + const header = document.createElement('header'); + const imgLink = document.createElement('a'); + const imgHeader = document.createElement('img'); + + imgLink.href = '#'; + imgHeader.src = '../img/hyf.png'; + imgHeader.alt = 'HYF logo'; + document.body.appendChild(header); + header.appendChild(imgLink); + imgLink.appendChild(imgHeader); + + //Create container and main tag + const container = document.createElement('div'); + const main = document.createElement('main'); + + container.classList.add('container'); + document.body.appendChild(container); + container.appendChild(main); + + //Create section for select repositories + const selectorSection = document.createElement('section'); + selectorSection.classList.add('selector'); + main.appendChild(selectorSection); + + const labelElement = document.createElement('label'); + labelElement.for = 'repo-items'; + labelElement.textContent = 'Hack Your Future Repositories:'; + selectorSection.appendChild(labelElement); + + const selectElement = document.createElement('select'); + selectElement.id = 'repo-items'; + selectorSection.appendChild(selectElement); + + + //Create description and contributers + //Description + const desconElement = document.createElement('div'); + desconElement.classList.add('des-con'); + main.appendChild(desconElement); + + const descriptionSection = document.createElement('section'); + descriptionSection.classList.add('description'); + desconElement.appendChild(descriptionSection); + + const desTable = document.createElement('table'); + descriptionSection.appendChild(desTable); + + const bodyTable = document.createElement('tbody'); + desTable.appendChild(bodyTable); + + //Contributers + const contributersSection = document.createElement('section'); + contributersSection.classList.add('contributers'); + desconElement.appendChild(contributersSection); + + fetchRepoList(selectElement, bodyTable, contributersSection); +}; + + +function fetchRepoList(selectElement, bodyTable, contributersSection) { + const url = 'https://api.github.com/orgs/HackYourFuture/repos?per_page=100'; + fetch(url) + .then(function (response) { + return response.json(); + }) + .then(function (myJson) { + myJson.forEach(element => { + const option = document.createElement('option'); + option.value = element.name; + option.textContent = element.name; + selectElement.appendChild(option); + }) + addDataToDOM(myJson, selectElement, bodyTable, contributersSection); + }) + .catch(function (error) { + const errElement = document.createElement('h3'); + errElement.style.backgroundColor = 'orange'; + errElement.style.color = 'white'; + errElement.style.display = 'block'; + errElement.style.padding = '10px'; + errElement.innerHTML = ` + network request failed +
+ ${error}`; + bodyTable.parentNode.insertBefore(errElement, bodyTable); + }); +}; + + +function addDataToDOM(data, selectElement, bodyTable, contributersSection) { + selectElement.addEventListener('input', () => { + contributersSection.innerHTML = ''; + data.forEach(element => { + if (element.name == selectElement.value) { + const table = ` + + Repository + ${element.name} + + + Description + ${element.description} + + + Forks + ${element.forks} + + + Updated + ${element.updated_at} + `; + bodyTable.innerHTML = table; + + const url = element.contributors_url; + fetchContributers(url, contributersSection); + } + }) + }) +}; + +function fetchContributers(url, contributersSection) { + fetch(url) + .then(function (response) { + return response.json(); + }) + .then(function (myJson) { + + myJson.forEach(element => { + const contItem = document.createElement('div'); + const image = document.createElement('img'); + const gitName = document.createElement('h3'); + const contributionsNum = document.createElement('h4'); + + contItem.appendChild(image); + contItem.appendChild(gitName); + contItem.appendChild(contributionsNum); + + contributersSection.appendChild(contItem); + + image.src = element.avatar_url; + gitName.textContent = element.login; + contributionsNum.textContent = element.contributions; + contItem.classList.add('items'); + }) + + }) + .catch(function (error) { + const errElement = document.createElement('h3'); + errElement.style.backgroundColor = 'orange'; + errElement.style.color = 'white'; + errElement.style.display = 'block'; + errElement.style.padding = '10px'; + errElement.innerHTML = ` + network request failed +
+ ${error}`; + contributersSection.parentNode.insertBefore(errElement, contributersSection); + }); +}; \ No newline at end of file From 335aa1a3c9ab368a1ac195fe10f35afeae7a2ea3 Mon Sep 17 00:00:00 2001 From: mas Date: Wed, 23 Dec 2020 22:33:23 +0330 Subject: [PATCH 09/10] Fixed image problem in project week 2 --- hackyourrepo-app/Masoud/week2/js/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackyourrepo-app/Masoud/week2/js/script.js b/hackyourrepo-app/Masoud/week2/js/script.js index 772db5711..69ecc1fc8 100644 --- a/hackyourrepo-app/Masoud/week2/js/script.js +++ b/hackyourrepo-app/Masoud/week2/js/script.js @@ -9,7 +9,7 @@ function main() { const imgHeader = document.createElement('img'); imgLink.href = '#'; - imgHeader.src = '../img/hyf.png'; + imgHeader.src = 'img/hyf.png'; imgHeader.alt = 'HYF logo'; document.body.appendChild(header); header.appendChild(imgLink); From 63a540454b0a45c675476c0beb839f94c4b541c5 Mon Sep 17 00:00:00 2001 From: mas Date: Tue, 29 Dec 2020 19:37:42 +0330 Subject: [PATCH 10/10] remove some comments and change input to change --- hackyourrepo-app/Masoud/week2/js/script.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hackyourrepo-app/Masoud/week2/js/script.js b/hackyourrepo-app/Masoud/week2/js/script.js index 69ecc1fc8..9a68646f5 100644 --- a/hackyourrepo-app/Masoud/week2/js/script.js +++ b/hackyourrepo-app/Masoud/week2/js/script.js @@ -1,7 +1,5 @@ -//Calling main function after window load window.onload = main; -//Define main function function main() { //Create header element and its children const header = document.createElement('header'); @@ -92,9 +90,8 @@ function fetchRepoList(selectElement, bodyTable, contributersSection) { }); }; - function addDataToDOM(data, selectElement, bodyTable, contributersSection) { - selectElement.addEventListener('input', () => { + selectElement.addEventListener('change', () => { contributersSection.innerHTML = ''; data.forEach(element => { if (element.name == selectElement.value) {