From 2c201bdc2becb98c11e94acd5f732939fdcb2831 Mon Sep 17 00:00:00 2001
From: Leandro Vilches Luppo <40528449+LVilchesLuppo@users.noreply.github.com>
Date: Mon, 9 Jul 2018 15:33:00 -0300
Subject: [PATCH] Add files via upload
---
Topic 1/GitHub.html | 17 ++
Topic 1/Index.html | 26 +++
Topic 1/JokePromise.html | 26 +++
Topic 1/css/normalize.css | 341 ++++++++++++++++++++++++++++++++
Topic 1/css/style.css | 13 ++
Topic 1/matrixData.html | 19 ++
Topic 1/scripts/callGit.js | 53 +++++
Topic 1/scripts/createMatrix.js | 61 ++++++
Topic 1/scripts/index.js | 81 ++++++++
Topic 1/scripts/jokePromise.js | 49 +++++
Topic 1/scripts/loadJoke.js | 29 +++
Topic 1/scripts/searchRepo.js | 56 ++++++
Topic 1/searchRepositories.html | 21 ++
13 files changed, 792 insertions(+)
create mode 100644 Topic 1/GitHub.html
create mode 100644 Topic 1/Index.html
create mode 100644 Topic 1/JokePromise.html
create mode 100644 Topic 1/css/normalize.css
create mode 100644 Topic 1/css/style.css
create mode 100644 Topic 1/matrixData.html
create mode 100644 Topic 1/scripts/callGit.js
create mode 100644 Topic 1/scripts/createMatrix.js
create mode 100644 Topic 1/scripts/index.js
create mode 100644 Topic 1/scripts/jokePromise.js
create mode 100644 Topic 1/scripts/loadJoke.js
create mode 100644 Topic 1/scripts/searchRepo.js
create mode 100644 Topic 1/searchRepositories.html
diff --git a/Topic 1/GitHub.html b/Topic 1/GitHub.html
new file mode 100644
index 000000000..6f6b658c3
--- /dev/null
+++ b/Topic 1/GitHub.html
@@ -0,0 +1,17 @@
+
+
+
+
+ GitHub Repositories
+
+
+
+
+
+
+
+
diff --git a/Topic 1/Index.html b/Topic 1/Index.html
new file mode 100644
index 000000000..2711c1161
--- /dev/null
+++ b/Topic 1/Index.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+ Fade In
+
+
+
+
+
+
+
+
+
diff --git a/Topic 1/JokePromise.html b/Topic 1/JokePromise.html
new file mode 100644
index 000000000..a5ae9c2a5
--- /dev/null
+++ b/Topic 1/JokePromise.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+ Joke w/Promise
+
+
+
+
+
+
+
+
+
diff --git a/Topic 1/css/normalize.css b/Topic 1/css/normalize.css
new file mode 100644
index 000000000..0fa32d0bd
--- /dev/null
+++ b/Topic 1/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;
+}
diff --git a/Topic 1/css/style.css b/Topic 1/css/style.css
new file mode 100644
index 000000000..d664e9d74
--- /dev/null
+++ b/Topic 1/css/style.css
@@ -0,0 +1,13 @@
+#hidden {
+ text-align: center;
+ opacity: 0;
+ visibility: hidden;
+}
+
+body{
+ font-family: Verdana;
+}
+
+.section{
+ text-align: center;
+}
diff --git a/Topic 1/matrixData.html b/Topic 1/matrixData.html
new file mode 100644
index 000000000..bb98a2c8e
--- /dev/null
+++ b/Topic 1/matrixData.html
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+ Create matrix
+
+
+
+
+
+
diff --git a/Topic 1/scripts/callGit.js b/Topic 1/scripts/callGit.js
new file mode 100644
index 000000000..175d65261
--- /dev/null
+++ b/Topic 1/scripts/callGit.js
@@ -0,0 +1,53 @@
+function callGit(){
+ let config = {
+
+ method: "GET",
+ url:"https://api.github.com/search/repositories?q=javascript",
+ async:true,
+ };
+
+ callAjax(config).then(promiseFulfilled,promiseFailed);
+ }
+
+
+function callAjax(config){
+ let promise = new Promise (function (resolve, reject){
+ let request;
+ if (window.XMLHttpRequest) {
+ request = new XMLHttpRequest();
+ }
+ request.open(config.method,config.url,config.async);
+ request.send(null);
+ request.onreadystatechange = function(){
+ if (request.readyState == 4) {
+ if (request.status == 200) {
+ let response = JSON.parse(request.responseText);
+ resolve(response);
+ } else {
+ reject(request.status);
+ }
+ } else {
+ console.log("processing request");
+ }
+ }
+ });
+ return promise;
+}
+
+function promiseFulfilled(config){
+ let data = config.items;
+ console.log(data);
+ for(let repo of config.items){
+ let list = document.getElementById("list");
+ list.style.alignItems ="right";
+ let newRepo = document.createElement("li");
+ newRepo.innerHTML = repo.full_name;
+ list.appendChild(newRepo);
+ }
+}
+
+function promiseFailed(){
+ let list = document.getElementById("list");
+ list.style.background = "red";
+ console.log("error");
+}
diff --git a/Topic 1/scripts/createMatrix.js b/Topic 1/scripts/createMatrix.js
new file mode 100644
index 000000000..76e048b12
--- /dev/null
+++ b/Topic 1/scripts/createMatrix.js
@@ -0,0 +1,61 @@
+function createMatrix(){
+ let link="https://api.github.com/search/repositories?q=javascript";
+ let config = {
+ method:"GET",
+ url: link,
+ async: "true",
+ }
+ callAjax(config).then(promiseFulfilled,promiseFailed);
+}
+
+function callAjax(config){
+ let promise = new Promise (function (resolve, reject){
+ let request;
+ if (window.XMLHttpRequest) {
+ request = new XMLHttpRequest();
+ }
+ request.open(config.method,config.url,config.async);
+ request.send(null);
+ request.onreadystatechange = function(){
+ if (request.readyState == 4) {
+ if (request.status == 200) {
+ let response = JSON.parse(request.responseText);
+ resolve(response);
+ } else {
+ reject(request.status);
+ }
+ } else {
+ console.log("processing request");
+ }
+ }
+ });
+ return promise;
+}
+
+function promiseFulfilled(config){
+ let table = document.getElementById("table");
+ table.setAttribute("border", "1");
+ let data = config.items;
+ console.log(data);
+ for(let i=0; i < data.length; i++){
+ let row = document.createElement("tr");
+ let text = document.createElement("td");
+ let textContent = document.createTextNode(data[i].full_name);
+ text.appendChild(textContent);
+ let url = document.createElement("a");
+ let urlText = document.createTextNode(data[i].html_url);
+ url.appendChild(urlText);
+ url.href = data[i].html_url;
+ row.appendChild(text);
+ row.appendChild(url);
+ table.appendChild(row);
+ }
+}
+
+
+
+function promiseFailed(){
+ let list = document.getElementById("list");
+ list.style.background = "red";
+ console.log("error");
+}
diff --git a/Topic 1/scripts/index.js b/Topic 1/scripts/index.js
new file mode 100644
index 000000000..17829aa86
--- /dev/null
+++ b/Topic 1/scripts/index.js
@@ -0,0 +1,81 @@
+ function fadeIn() {
+ var elementFade = document.getElementById("hidden");
+ var opac = 0.1;
+ elementFade.style.visibility=("visible");
+ var timer = setInterval(function () {
+ if (opac >= 1){
+ clearInterval(timer);
+ }
+ elementFade.style.opacity = opac;
+ opac += opac * 0.05;
+ }, 15);
+ }
+
+ function getRandomJoke(){
+
+ let url= "http://api.icndb.com/jokes/random";
+ let request = new XMLHttpRequest();
+ request.addEventListener("load", getJoke, true);
+ request.open("GET", url, true);
+ request.send(null);
+
+ }
+
+ function getJoke(e){
+
+ let joke = document.getElementById("jokeHere");
+ joke.innerHTML = e.target.response;
+
+ }
+
+ function getJokePromise(){
+ let config = {
+
+ method: "GET",
+ url:"http://api.icndb.com/jokes/random",
+ async:true,
+ };
+ callJoke(config).then(promiseFulfilled,promiseFailed);
+ }
+
+
+ function callJoke(config){
+ let promise = new Promise (function (resolve, reject){
+ let request;
+ if (window.XMLHttpRequest) {
+ request = new XMLHttpRequest();
+ }
+ if(config.method == "GET"){
+ request.open(config.method,config.url,config.async);
+ request.send();
+ request.onreadystatechange = function(){
+ if (request.readyState == 4) {
+ if (request.status == 200) {
+ let response = JSON.parse(request.responseText);
+ resolve(response);
+ } else {
+ reject(request.status);
+ }
+ } else {
+ console.log("Still processing the request");
+ }
+ }
+ })
+ return promiseObj;
+ }
+
+
+
+
+
+ function promiseFulfilled(config){
+ let joke = document.getElementById("joke");
+ joke.innerHTML = config.value.joke;
+
+ }
+
+
+ function promiseFailed(){
+ let joke = document.getElementById("joke");
+ console.log("error");
+ }
diff --git a/Topic 1/scripts/jokePromise.js b/Topic 1/scripts/jokePromise.js
new file mode 100644
index 000000000..26442cd00
--- /dev/null
+++ b/Topic 1/scripts/jokePromise.js
@@ -0,0 +1,49 @@
+ function getJokePromise(){
+ let config = {
+
+ method: "GET",
+ url:"http://api.icndb.com/jokes/random",
+ async:true,
+ };
+ callAjax(config).then(promiseFulfilled,promiseFailed);
+ }
+
+
+
+ function callAjax(config){
+ let promise = new Promise (function (resolve, reject){
+ let request;
+ if (window.XMLHttpRequest) {
+ request = new XMLHttpRequest();
+ }
+ request.open(config.method,config.url,config.async);
+ request.send();
+ request.onreadystatechange = function(){
+ if (request.readyState == 4) {
+ if (request.status == 200) {
+ let response = JSON.parse(request.responseText);
+ resolve(response);
+ } else {
+ reject(request.status);
+ }
+ } else {
+ console.log("processing request");
+ }
+ }
+ });
+ return promise;
+ }
+
+ function promiseFulfilled(config){
+ let joke = document.getElementById("joke");
+ joke.innerHTML = config.value.joke;
+
+ }
+
+
+ function promiseFailed(){
+ let joke = document.getElementById("joke");
+ joke.style.background = "red";
+ console.log("error");
+
+ }
diff --git a/Topic 1/scripts/loadJoke.js b/Topic 1/scripts/loadJoke.js
new file mode 100644
index 000000000..998c58bd8
--- /dev/null
+++ b/Topic 1/scripts/loadJoke.js
@@ -0,0 +1,29 @@
+function fadeIn() {
+ var elementFade = document.getElementById("hidden");
+ var opac = 0.1;
+ elementFade.style.visibility=("visible");
+ var timer = setInterval(function () {
+ if (opac >= 1){
+ clearInterval(timer);
+ }
+ elementFade.style.opacity = opac;
+ opac += opac * 0.05;
+ }, 15);
+}
+
+function getRandomJoke(){
+
+ let url= "http://api.icndb.com/jokes/random";
+ let request = new XMLHttpRequest();
+ request.addEventListener("load", getJoke, true);
+ request.open("GET", url, true);
+ request.send(null);
+
+}
+
+function getJoke(e){
+
+ let joke = document.getElementById("jokeHere");
+ joke.innerHTML = e.target.response;
+
+}
diff --git a/Topic 1/scripts/searchRepo.js b/Topic 1/scripts/searchRepo.js
new file mode 100644
index 000000000..f15a1b0ce
--- /dev/null
+++ b/Topic 1/scripts/searchRepo.js
@@ -0,0 +1,56 @@
+function searchRepo(){
+ let searchGH = document.getElementById("searchRepo").value;
+ let link="https://api.github.com/search/repositories?q=" + searchGH;
+ let config = {
+ method:"GET",
+ url: link,
+ async: "true",
+ }
+ callAjax(config).then(promiseFulfilled,promiseFailed);
+}
+
+function callAjax(config){
+ let promise = new Promise (function (resolve, reject){
+ let request;
+ if (window.XMLHttpRequest) {
+ request = new XMLHttpRequest();
+ }
+ request.open(config.method,config.url,config.async);
+ request.send(null);
+ request.onreadystatechange = function(){
+ if (request.readyState == 4) {
+ if (request.status == 200) {
+ let response = JSON.parse(request.responseText);
+ resolve(response);
+ } else {
+ reject(request.status);
+ }
+ } else {
+ console.log("processing request");
+ }
+ }
+ });
+ return promise;
+}
+function promiseFulfilled(config){
+ let data = config.items;
+ console.log(data);
+ if(data.length == 0){
+ let list = document.getElementById("list");
+ list.innerHTML="No matches found!";
+ list.style.background="#EE7777";
+ }else{
+ for(let repo of config.items) {
+ let list = document.getElementById("list");
+ let newRepo = document.createElement("li");
+ newRepo.innerHTML = repo.full_name;
+ list.appendChild(newRepo);
+ }
+ }
+}
+
+function promiseFailed(){
+ let list = document.getElementById("list");
+ list.style.background = "red";
+ console.log("error");
+}
diff --git a/Topic 1/searchRepositories.html b/Topic 1/searchRepositories.html
new file mode 100644
index 000000000..010f6e59b
--- /dev/null
+++ b/Topic 1/searchRepositories.html
@@ -0,0 +1,21 @@
+
+
+
+
+ Search for Repositories
+
+
+
+
+
+
+
+
+