From 0324314777029c3c08a0871527c3c5e5607b44c1 Mon Sep 17 00:00:00 2001 From: Rodry Date: Sun, 24 Jun 2018 00:22:01 -0300 Subject: [PATCH 1/7] First commit Basic structure --- 01-JS-DOM-APIs/.empty | 0 01-JS-DOM-APIs/css/normalize.css | 341 +++++++++++++++++++++++++++++++ 01-JS-DOM-APIs/css/style.css | 58 ++++++ 01-JS-DOM-APIs/index.html | 39 ++++ 01-JS-DOM-APIs/js/jst1.js | 27 +++ 5 files changed, 465 insertions(+) delete mode 100644 01-JS-DOM-APIs/.empty create mode 100644 01-JS-DOM-APIs/css/normalize.css create mode 100644 01-JS-DOM-APIs/css/style.css create mode 100644 01-JS-DOM-APIs/index.html create mode 100644 01-JS-DOM-APIs/js/jst1.js diff --git a/01-JS-DOM-APIs/.empty b/01-JS-DOM-APIs/.empty deleted file mode 100644 index e69de29bb..000000000 diff --git a/01-JS-DOM-APIs/css/normalize.css b/01-JS-DOM-APIs/css/normalize.css new file mode 100644 index 000000000..bcdf77b45 --- /dev/null +++ b/01-JS-DOM-APIs/css/normalize.css @@ -0,0 +1,341 @@ +/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + +html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type="button"], +[type="reset"], +[type="submit"] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} \ No newline at end of file diff --git a/01-JS-DOM-APIs/css/style.css b/01-JS-DOM-APIs/css/style.css new file mode 100644 index 000000000..210fa64e2 --- /dev/null +++ b/01-JS-DOM-APIs/css/style.css @@ -0,0 +1,58 @@ +.header{ + box-shadow: 0px 10px 5px grey; + box-sizing: content-box; + margin-left: 10%; + width: 80%; + height: 50px; + background-color: orange; + text-align: center; +} + +body{ + text-align: center; +} + +.content{ + box-sizing: content-box; + padding-right: 10%; + padding-left: 10%; +} + +/*--------------Phone----------------*/ +@media screen and (max-width: 500px){ + .header{ + width: 100%; + margin-left: 0%; + } +} + +@keyframes fadeInOpacity { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +.fade-in { + opacity: 1; + text-shadow: 2px 2px 2px grey; + animation-name: fadeInOpacity; + animation-iteration-count: 1; + animation-timing-function: ease-in; + animation-duration: 2s; +} + +.footer{ + width: 100%; + box-sizing: content-box; + position: absolute; + bottom: 0; + height: 100px; + text-align: center; +} + +.song{ + vertical-align: middle; +} \ No newline at end of file diff --git a/01-JS-DOM-APIs/index.html b/01-JS-DOM-APIs/index.html new file mode 100644 index 000000000..8f1f6c8cf --- /dev/null +++ b/01-JS-DOM-APIs/index.html @@ -0,0 +1,39 @@ + + + + + + + + + Resolution + + +
+

Topic 1

+
+
+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." +

+

+ + Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? + +

+
+ +
+ +

+
+ + + \ No newline at end of file diff --git a/01-JS-DOM-APIs/js/jst1.js b/01-JS-DOM-APIs/js/jst1.js new file mode 100644 index 000000000..a213e7eab --- /dev/null +++ b/01-JS-DOM-APIs/js/jst1.js @@ -0,0 +1,27 @@ +function changeMe(){ + let text = document.getElementById("hi"); + text.hidden = false; +} +function getJoke(){ + let url = "http://api.icndb.com/jokes/random"; + let joke = "Hola"; + // We do a try-catch block to + try{ + let response; + // We create a new Request + let request = new XMLHttpRequest(); + /*Open the request with the Method and the url, + last boolean is for asynchronous operation*/ + request.open('Get',url,false); + //No parameters needed + request.send(null); + //Number 200 means OK + if (request.status == 200) { + response = request.response; + joke = response['type']; + } + }catch (e){ + + } + document.getElementById("jokeResponse").innerHTML = joke; +} \ No newline at end of file From 91d55fe3467ef406e4c1cd6c18760d05777a7461 Mon Sep 17 00:00:00 2001 From: rodrysauco <32721337+rodrysauco@users.noreply.github.com> Date: Sun, 24 Jun 2018 14:33:20 -0300 Subject: [PATCH 2/7] Second Comit Missing half of ex 4 and 12 --- 01-JS-DOM-APIs/css/style.css | 61 ++++++++++++++--- 01-JS-DOM-APIs/index.html | 20 ++++-- 01-JS-DOM-APIs/js/jst1.js | 129 ++++++++++++++++++++++++++++++++--- 3 files changed, 185 insertions(+), 25 deletions(-) diff --git a/01-JS-DOM-APIs/css/style.css b/01-JS-DOM-APIs/css/style.css index 210fa64e2..78b64278e 100644 --- a/01-JS-DOM-APIs/css/style.css +++ b/01-JS-DOM-APIs/css/style.css @@ -8,14 +8,20 @@ text-align: center; } -body{ +.content{ + display: inline-block; text-align: center; + width: 70%; + box-sizing: border-box; + margin-left: 15%; } -.content{ - box-sizing: content-box; - padding-right: 10%; - padding-left: 10%; +.hidden-list{ + overflow-y: auto; + max-height: 300px; + width: 15%; + margin-top: 15%; + float: right; } /*--------------Phone----------------*/ @@ -24,6 +30,22 @@ body{ width: 100%; margin-left: 0%; } + + .hidden-list{ + overflow-y: auto; + max-height: 300px; + float: none; + width: 80%; + margin-top: 15px; + margin-left: 20%; + } + + .content{ + text-align: center; + width: 80%; + box-sizing: border-box; + margin-left: 10%; + } } @keyframes fadeInOpacity { @@ -35,9 +57,31 @@ body{ } } +button{ + box-shadow: 0 3px 8px grey; +} + +.hidden{ + box-sizing: border-box; + width: 80%; + margin-left: 10%; +} + +#hi{ + box-sizing: border-box; + width: 70%; + margin-left: 15%; +} + +.topic7{ + box-sizing: border-box; + width: 80%; + margin-left: 10%; + margin-top: 25px; +} + .fade-in { opacity: 1; - text-shadow: 2px 2px 2px grey; animation-name: fadeInOpacity; animation-iteration-count: 1; animation-timing-function: ease-in; @@ -46,8 +90,9 @@ body{ .footer{ width: 100%; - box-sizing: content-box; - position: absolute; + box-sizing: border-box; + padding-top: 20px; + position: relative; bottom: 0; height: 100px; text-align: center; diff --git a/01-JS-DOM-APIs/index.html b/01-JS-DOM-APIs/index.html index 8f1f6c8cf..4d3807724 100644 --- a/01-JS-DOM-APIs/index.html +++ b/01-JS-DOM-APIs/index.html @@ -21,13 +21,21 @@

Topic 1

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?

+ +
+ +
+
+ + +
- -
- -

+
+
- - \ No newline at end of file + \ No newline at end of file diff --git a/01-JS-DOM-APIs/js/jst1.js b/01-JS-DOM-APIs/js/jst1.js index b36644c56..08b7ea7ce 100644 --- a/01-JS-DOM-APIs/js/jst1.js +++ b/01-JS-DOM-APIs/js/jst1.js @@ -49,12 +49,13 @@ function getJoke(){ function errorHandler(statusCode){ let text = document.getElementById('hi').parentElement; text.style.backgroundColor = "red"; - console.log("Failed with status: ", statusCode); + console.log("Failed with status: ", statusCode); } //Ex. 7 function jokeWithPromise(){ - testingMatrix(); + /*Uncomment the next line to test matrixFunc and receive the joke*/ + //testingMatrix(); let data = { method: "GET", url:"http://api.icndb.com/jokes/random", @@ -79,8 +80,14 @@ function ajaxCall(config){ // code for old IE browsers request = new ActiveXObject("Microsoft.XMLHTTP"); } - request.open(config.method,config.url,config.async); - request.send(); + if(config.method == "GET"){ + request.open(config.method,config.url,config.async); + request.send(); + }else{ + request.open(config.method,config.url,config.async); + request.setRequestHeader("Content-type","application/x-ww-form-urlencoded"); + request.send(config.data); + } request.onreadystatechange = function(){ if (request.readyState == 4) { if (request.status == 200) { @@ -96,18 +103,34 @@ function ajaxCall(config){ }); return promiseObj; } +//Variaton to ex 7 +function ajaxCallUsingFetch(config){ + let header = new Headers(); + let init = { + method: config.method, + headers: header, + mode: "cors", + cache: "default", + }; + let request = new Request(config.url,init) + fetch(request).then(promiseToList); +} // Ex. 9 - 10 function gitSearch(){ + let param = document.getElementById("search"); let data = { - url:"https://api.github.com/search/repositories", - param:, - method:, - async:true, + url : "https://api.github.com/search/repositories", + param : "", + method : "GET", + async : true, } - let param = document.getElementById("search"); if (param.value.length > 0) { - url += "?q=" + param.value; - ajaxCall(url).then(promiseToList,errorHandler); + if(data.method == "GET"){ + data.url += "?q="+ param.value; + }else{ + data.param = data.value; + } + ajaxCallUsingFetch(data).then(promiseToList,errorHandler); }else{ param.placeholder = "Empty search"; console.log("Empty param"); From c1b83d0990f8204ed9a4f0e78351e09b4a6d4655 Mon Sep 17 00:00:00 2001 From: Rodry Date: Tue, 26 Jun 2018 17:04:40 -0300 Subject: [PATCH 5/7] Last commit All items working --- 01-JS-DOM-APIs/index.html | 3 +-- 01-JS-DOM-APIs/js/jst1.js | 18 ++++-------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/01-JS-DOM-APIs/index.html b/01-JS-DOM-APIs/index.html index 1553df00b..3a068225b 100644 --- a/01-JS-DOM-APIs/index.html +++ b/01-JS-DOM-APIs/index.html @@ -44,8 +44,7 @@
Hidden list
\ No newline at end of file diff --git a/01-JS-DOM-APIs/js/jst1.js b/01-JS-DOM-APIs/js/jst1.js index 08b7ea7ce..ac0ce68e5 100644 --- a/01-JS-DOM-APIs/js/jst1.js +++ b/01-JS-DOM-APIs/js/jst1.js @@ -103,18 +103,8 @@ function ajaxCall(config){ }); return promiseObj; } -//Variaton to ex 7 -function ajaxCallUsingFetch(config){ - let header = new Headers(); - let init = { - method: config.method, - headers: header, - mode: "cors", - cache: "default", - }; - let request = new Request(config.url,init) - fetch(request).then(promiseToList); -} +/*Another way to do ex 7 is using fetch + but this functionality isnt supported by all browsers*/ // Ex. 9 - 10 function gitSearch(){ let param = document.getElementById("search"); @@ -130,7 +120,7 @@ function gitSearch(){ }else{ data.param = data.value; } - ajaxCallUsingFetch(data).then(promiseToList,errorHandler); + ajaxCall(data).then(promiseToList,errorHandler); }else{ param.placeholder = "Empty search"; console.log("Empty param"); @@ -174,7 +164,7 @@ function matrixToTable(matrix){ } let body = document.getElementsByTagName("body"); let ifExists = document.getElementsByClassName("generatedTable"); - //We create if the table wasnt created before + //We create the table if wasnt created before if(ifExists.length < 1){ /*Both funcs return an array with all elements that match with the parameter*/ From 90c5171d082abe7a77a457e58dbf4099c67a8703 Mon Sep 17 00:00:00 2001 From: rodrysauco <32721337+rodrysauco@users.noreply.github.com> Date: Thu, 28 Jun 2018 18:49:15 -0300 Subject: [PATCH 6/7] Update jst1.js Checking identation --- 01-JS-DOM-APIs/js/jst1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/01-JS-DOM-APIs/js/jst1.js b/01-JS-DOM-APIs/js/jst1.js index ac0ce68e5..5029e5f8d 100644 --- a/01-JS-DOM-APIs/js/jst1.js +++ b/01-JS-DOM-APIs/js/jst1.js @@ -19,7 +19,7 @@ function getJoke(){ } else { // code for old IE browsers request = new ActiveXObject("Microsoft.XMLHTTP"); -} /*Open the request with the Method and the url, + }/*Open the request with the Method and the url, last boolean is for asynchronous operation*/ request.open('Get',url,true); //No parameters needed @@ -186,4 +186,4 @@ function testingMatrix(){ } } matrixToTable(matrix); -} \ No newline at end of file +} From eaa13efe733a5ce1cd26a67be3be56dc043532f9 Mon Sep 17 00:00:00 2001 From: rodrysauco <32721337+rodrysauco@users.noreply.github.com> Date: Thu, 28 Jun 2018 18:51:01 -0300 Subject: [PATCH 7/7] Update style.css Checking identation --- 01-JS-DOM-APIs/css/style.css | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/01-JS-DOM-APIs/css/style.css b/01-JS-DOM-APIs/css/style.css index e1cdfa2ec..b6b37e238 100644 --- a/01-JS-DOM-APIs/css/style.css +++ b/01-JS-DOM-APIs/css/style.css @@ -18,11 +18,11 @@ .hidden-list{ box-sizing: border-box; - overflow-y: auto; - max-height: 300px; - width: 15%; - margin-top: 15%; - float: right; + overflow-y: auto; + max-height: 300px; + width: 15%; + margin-top: 15%; + float: right; } /*--------------Phone----------------*/ @@ -33,7 +33,7 @@ } .hidden-list{ -padding-right: 20%; + padding-right: 20%; box-sizing: border-box; overflow-y: auto; max-height: 300px; @@ -103,4 +103,4 @@ button{ .song{ vertical-align: middle; -} \ No newline at end of file +}