diff --git a/.history/js/index_20191118154848.js b/.history/js/index_20191118154848.js new file mode 100644 index 0000000..e43c80e --- /dev/null +++ b/.history/js/index_20191118154848.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + console.log(eligible); + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i].id); + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201095551.js b/.history/js/index_20191201095551.js new file mode 100644 index 0000000..66c7515 --- /dev/null +++ b/.history/js/index_20191201095551.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + console; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i].id); + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201095552.js b/.history/js/index_20191201095552.js new file mode 100644 index 0000000..1c801e7 --- /dev/null +++ b/.history/js/index_20191201095552.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + conso; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i].id); + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201095553.js b/.history/js/index_20191201095553.js new file mode 100644 index 0000000..8d157e6 --- /dev/null +++ b/.history/js/index_20191201095553.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + cons; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i].id); + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201095554.js b/.history/js/index_20191201095554.js new file mode 100644 index 0000000..3c8b9e5 --- /dev/null +++ b/.history/js/index_20191201095554.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + co; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i].id); + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201095555.js b/.history/js/index_20191201095555.js new file mode 100644 index 0000000..5d47ce1 --- /dev/null +++ b/.history/js/index_20191201095555.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + ; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i].id); + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201095557.js b/.history/js/index_20191201095557.js new file mode 100644 index 0000000..be8f0f7 --- /dev/null +++ b/.history/js/index_20191201095557.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i].id); + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201095558.js b/.history/js/index_20191201095558.js new file mode 100644 index 0000000..0eb9788 --- /dev/null +++ b/.history/js/index_20191201095558.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i].id); + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201095559.js b/.history/js/index_20191201095559.js new file mode 100644 index 0000000..0eb9788 --- /dev/null +++ b/.history/js/index_20191201095559.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i].id); + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201095600.js b/.history/js/index_20191201095600.js new file mode 100644 index 0000000..0eb9788 --- /dev/null +++ b/.history/js/index_20191201095600.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i].id); + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141633.js b/.history/js/index_20191201141633.js new file mode 100644 index 0000000..9ed6c2e --- /dev/null +++ b/.history/js/index_20191201141633.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i].id) + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141637.js b/.history/js/index_20191201141637.js new file mode 100644 index 0000000..0c85f07 --- /dev/null +++ b/.history/js/index_20191201141637.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i]. + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141638.js b/.history/js/index_20191201141638.js new file mode 100644 index 0000000..b510037 --- /dev/null +++ b/.history/js/index_20191201141638.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[i + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141639.js b/.history/js/index_20191201141639.js new file mode 100644 index 0000000..f9d8b01 --- /dev/null +++ b/.history/js/index_20191201141639.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(books[ + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141640.js b/.history/js/index_20191201141640.js new file mode 100644 index 0000000..a782340 --- /dev/null +++ b/.history/js/index_20191201141640.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.log(b + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141641.js b/.history/js/index_20191201141641.js new file mode 100644 index 0000000..1568999 --- /dev/null +++ b/.history/js/index_20191201141641.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + console.l + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141642.js b/.history/js/index_20191201141642.js new file mode 100644 index 0000000..b4fe419 --- /dev/null +++ b/.history/js/index_20191201141642.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + con + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141643.js b/.history/js/index_20191201141643.js new file mode 100644 index 0000000..3ee508c --- /dev/null +++ b/.history/js/index_20191201141643.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + co + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141644.js b/.history/js/index_20191201141644.js new file mode 100644 index 0000000..a0c3b45 --- /dev/null +++ b/.history/js/index_20191201141644.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + c + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141645.js b/.history/js/index_20191201141645.js new file mode 100644 index 0000000..d967bed --- /dev/null +++ b/.history/js/index_20191201141645.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141646.js b/.history/js/index_20191201141646.js new file mode 100644 index 0000000..4243749 --- /dev/null +++ b/.history/js/index_20191201141646.js @@ -0,0 +1,85 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191201141647.js b/.history/js/index_20191201141647.js new file mode 100644 index 0000000..4243749 --- /dev/null +++ b/.history/js/index_20191201141647.js @@ -0,0 +1,85 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ cover +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191226191711.js b/.history/js/index_20191226191711.js new file mode 100644 index 0000000..1ebf07b --- /dev/null +++ b/.history/js/index_20191226191711.js @@ -0,0 +1,85 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191226191712.js b/.history/js/index_20191226191712.js new file mode 100644 index 0000000..fb4314e --- /dev/null +++ b/.history/js/index_20191226191712.js @@ -0,0 +1,104 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = `
+
+
+ ${ +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join( + ", " + )}
  • +
  • Published: ${ + info.publishedDate + }
  • +
  • Publisher: ${ + info.publisher + }
  • +
  • ${ + info.industryIdentifiers[0].type + }: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${ + info.categories + }
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191226191717.js b/.history/js/index_20191226191717.js new file mode 100644 index 0000000..1ebf07b --- /dev/null +++ b/.history/js/index_20191226191717.js @@ -0,0 +1,85 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191226191720.js b/.history/js/index_20191226191720.js new file mode 100644 index 0000000..36d7f57 --- /dev/null +++ b/.history/js/index_20191226191720.js @@ -0,0 +1,85 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191226191734.js b/.history/js/index_20191226191734.js new file mode 100644 index 0000000..36d7f57 --- /dev/null +++ b/.history/js/index_20191226191734.js @@ -0,0 +1,85 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228082307.js b/.history/js/index_20191228082307.js new file mode 100644 index 0000000..d747d18 --- /dev/null +++ b/.history/js/index_20191228082307.js @@ -0,0 +1,86 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228082325.js b/.history/js/index_20191228082325.js new file mode 100644 index 0000000..49101f7 --- /dev/null +++ b/.history/js/index_20191228082325.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228082346.js b/.history/js/index_20191228082346.js new file mode 100644 index 0000000..7a47a41 --- /dev/null +++ b/.history/js/index_20191228082346.js @@ -0,0 +1,88 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) + { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228082354.js b/.history/js/index_20191228082354.js new file mode 100644 index 0000000..49101f7 --- /dev/null +++ b/.history/js/index_20191228082354.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228082432.js b/.history/js/index_20191228082432.js new file mode 100644 index 0000000..49101f7 --- /dev/null +++ b/.history/js/index_20191228082432.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228082433.js b/.history/js/index_20191228082433.js new file mode 100644 index 0000000..49101f7 --- /dev/null +++ b/.history/js/index_20191228082433.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228082449.js b/.history/js/index_20191228082449.js new file mode 100644 index 0000000..49101f7 --- /dev/null +++ b/.history/js/index_20191228082449.js @@ -0,0 +1,87 @@ +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083750.js b/.history/js/index_20191228083750.js new file mode 100644 index 0000000..151c0a2 --- /dev/null +++ b/.history/js/index_20191228083750.js @@ -0,0 +1,88 @@ + +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083752.js b/.history/js/index_20191228083752.js new file mode 100644 index 0000000..201e0fd --- /dev/null +++ b/.history/js/index_20191228083752.js @@ -0,0 +1,88 @@ +v +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083753.js b/.history/js/index_20191228083753.js new file mode 100644 index 0000000..56c476f --- /dev/null +++ b/.history/js/index_20191228083753.js @@ -0,0 +1,88 @@ +var +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083754.js b/.history/js/index_20191228083754.js new file mode 100644 index 0000000..8168c27 --- /dev/null +++ b/.history/js/index_20191228083754.js @@ -0,0 +1,88 @@ +var searc +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083755.js b/.history/js/index_20191228083755.js new file mode 100644 index 0000000..0958776 --- /dev/null +++ b/.history/js/index_20191228083755.js @@ -0,0 +1,88 @@ +var search +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083800.js b/.history/js/index_20191228083800.js new file mode 100644 index 0000000..4407ff3 --- /dev/null +++ b/.history/js/index_20191228083800.js @@ -0,0 +1,88 @@ +var searchText +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083802.js b/.history/js/index_20191228083802.js new file mode 100644 index 0000000..2ace1a2 --- /dev/null +++ b/.history/js/index_20191228083802.js @@ -0,0 +1,88 @@ +var searchText = +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083808.js b/.history/js/index_20191228083808.js new file mode 100644 index 0000000..87330eb --- /dev/null +++ b/.history/js/index_20191228083808.js @@ -0,0 +1,88 @@ +var searchText = +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083809.js b/.history/js/index_20191228083809.js new file mode 100644 index 0000000..060631c --- /dev/null +++ b/.history/js/index_20191228083809.js @@ -0,0 +1,88 @@ +var searchText = "" +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083811.js b/.history/js/index_20191228083811.js new file mode 100644 index 0000000..e54a969 --- /dev/null +++ b/.history/js/index_20191228083811.js @@ -0,0 +1,88 @@ +var searchText = ""; +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083815.js b/.history/js/index_20191228083815.js new file mode 100644 index 0000000..413ec10 --- /dev/null +++ b/.history/js/index_20191228083815.js @@ -0,0 +1,88 @@ +var searchText = ""; +var url; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083916.js b/.history/js/index_20191228083916.js new file mode 100644 index 0000000..e54a969 --- /dev/null +++ b/.history/js/index_20191228083916.js @@ -0,0 +1,88 @@ +var searchText = ""; +var url +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083918.js b/.history/js/index_20191228083918.js new file mode 100644 index 0000000..bee1fd9 --- /dev/null +++ b/.history/js/index_20191228083918.js @@ -0,0 +1,88 @@ +var searchText = ""; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083919.js b/.history/js/index_20191228083919.js new file mode 100644 index 0000000..7ac0e78 --- /dev/null +++ b/.history/js/index_20191228083919.js @@ -0,0 +1,88 @@ +var searchText = ""; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083930.js b/.history/js/index_20191228083930.js new file mode 100644 index 0000000..93e7938 --- /dev/null +++ b/.history/js/index_20191228083930.js @@ -0,0 +1,88 @@ +var searchText = ""; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40` +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083936.js b/.history/js/index_20191228083936.js new file mode 100644 index 0000000..c14e672 --- /dev/null +++ b/.history/js/index_20191228083936.js @@ -0,0 +1,88 @@ +var searchText = ""; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`, +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083938.js b/.history/js/index_20191228083938.js new file mode 100644 index 0000000..f17219b --- /dev/null +++ b/.history/js/index_20191228083938.js @@ -0,0 +1,88 @@ +var searchText = ""; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083940.js b/.history/js/index_20191228083940.js new file mode 100644 index 0000000..f17219b --- /dev/null +++ b/.history/js/index_20191228083940.js @@ -0,0 +1,88 @@ +var searchText = ""; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083947.js b/.history/js/index_20191228083947.js new file mode 100644 index 0000000..f6b2796 --- /dev/null +++ b/.history/js/index_20191228083947.js @@ -0,0 +1,88 @@ +var searchText = "H"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083948.js b/.history/js/index_20191228083948.js new file mode 100644 index 0000000..95cb592 --- /dev/null +++ b/.history/js/index_20191228083948.js @@ -0,0 +1,88 @@ +var searchText = "Happ"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083949.js b/.history/js/index_20191228083949.js new file mode 100644 index 0000000..a6ed4f4 --- /dev/null +++ b/.history/js/index_20191228083949.js @@ -0,0 +1,88 @@ +var searchText = "Happy"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083950.js b/.history/js/index_20191228083950.js new file mode 100644 index 0000000..8b5e766 --- /dev/null +++ b/.history/js/index_20191228083950.js @@ -0,0 +1,88 @@ +var searchText = "Happy "; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083951.js b/.history/js/index_20191228083951.js new file mode 100644 index 0000000..b0fa583 --- /dev/null +++ b/.history/js/index_20191228083951.js @@ -0,0 +1,88 @@ +var searchText = "Happy p"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083952.js b/.history/js/index_20191228083952.js new file mode 100644 index 0000000..caf273b --- /dev/null +++ b/.history/js/index_20191228083952.js @@ -0,0 +1,88 @@ +var searchText = "Happy peopl"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228083953.js b/.history/js/index_20191228083953.js new file mode 100644 index 0000000..5b00f02 --- /dev/null +++ b/.history/js/index_20191228083953.js @@ -0,0 +1,88 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228084018.js b/.history/js/index_20191228084018.js new file mode 100644 index 0000000..13755c5 --- /dev/null +++ b/.history/js/index_20191228084018.js @@ -0,0 +1,88 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + vasearchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228084019.js b/.history/js/index_20191228084019.js new file mode 100644 index 0000000..e214164 --- /dev/null +++ b/.history/js/index_20191228084019.js @@ -0,0 +1,88 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228084022.js b/.history/js/index_20191228084022.js new file mode 100644 index 0000000..e214164 --- /dev/null +++ b/.history/js/index_20191228084022.js @@ -0,0 +1,88 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228084045.js b/.history/js/index_20191228084045.js new file mode 100644 index 0000000..075f5ff --- /dev/null +++ b/.history/js/index_20191228084045.js @@ -0,0 +1,88 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228084047.js b/.history/js/index_20191228084047.js new file mode 100644 index 0000000..075f5ff --- /dev/null +++ b/.history/js/index_20191228084047.js @@ -0,0 +1,88 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228084107.js b/.history/js/index_20191228084107.js new file mode 100644 index 0000000..075f5ff --- /dev/null +++ b/.history/js/index_20191228084107.js @@ -0,0 +1,88 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228084108.js b/.history/js/index_20191228084108.js new file mode 100644 index 0000000..075f5ff --- /dev/null +++ b/.history/js/index_20191228084108.js @@ -0,0 +1,88 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228084123.js b/.history/js/index_20191228084123.js new file mode 100644 index 0000000..375e5ab --- /dev/null +++ b/.history/js/index_20191228084123.js @@ -0,0 +1,88 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + ur + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228084124.js b/.history/js/index_20191228084124.js new file mode 100644 index 0000000..fe8f32a --- /dev/null +++ b/.history/js/index_20191228084124.js @@ -0,0 +1,88 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228084125.js b/.history/js/index_20191228084125.js new file mode 100644 index 0000000..0cdf9b9 --- /dev/null +++ b/.history/js/index_20191228084125.js @@ -0,0 +1,87 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228084126.js b/.history/js/index_20191228084126.js new file mode 100644 index 0000000..0cdf9b9 --- /dev/null +++ b/.history/js/index_20191228084126.js @@ -0,0 +1,87 @@ +var searchText = "Happy people"; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228085530.js b/.history/js/index_20191228085530.js new file mode 100644 index 0000000..3efb6b4 --- /dev/null +++ b/.history/js/index_20191228085530.js @@ -0,0 +1,87 @@ +var searchText = "Happy people; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228085531.js b/.history/js/index_20191228085531.js new file mode 100644 index 0000000..4e74e2e --- /dev/null +++ b/.history/js/index_20191228085531.js @@ -0,0 +1,87 @@ +var searchText = "Hap; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228085532.js b/.history/js/index_20191228085532.js new file mode 100644 index 0000000..029f55d --- /dev/null +++ b/.history/js/index_20191228085532.js @@ -0,0 +1,87 @@ +var searchText =; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228085533.js b/.history/js/index_20191228085533.js new file mode 100644 index 0000000..4a5e4f3 --- /dev/null +++ b/.history/js/index_20191228085533.js @@ -0,0 +1,87 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228085535.js b/.history/js/index_20191228085535.js new file mode 100644 index 0000000..4a5e4f3 --- /dev/null +++ b/.history/js/index_20191228085535.js @@ -0,0 +1,87 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228085844.js b/.history/js/index_20191228085844.js new file mode 100644 index 0000000..4a5e4f3 --- /dev/null +++ b/.history/js/index_20191228085844.js @@ -0,0 +1,87 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228085931.js b/.history/js/index_20191228085931.js new file mode 100644 index 0000000..4a5e4f3 --- /dev/null +++ b/.history/js/index_20191228085931.js @@ -0,0 +1,87 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228085932.js b/.history/js/index_20191228085932.js new file mode 100644 index 0000000..4a5e4f3 --- /dev/null +++ b/.history/js/index_20191228085932.js @@ -0,0 +1,87 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090439.js b/.history/js/index_20191228090439.js new file mode 100644 index 0000000..03131df --- /dev/null +++ b/.history/js/index_20191228090439.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + + + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090440.js b/.history/js/index_20191228090440.js new file mode 100644 index 0000000..cee4cf6 --- /dev/null +++ b/.history/js/index_20191228090440.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +co + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090441.js b/.history/js/index_20191228090441.js new file mode 100644 index 0000000..3330f3d --- /dev/null +++ b/.history/js/index_20191228090441.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090442.js b/.history/js/index_20191228090442.js new file mode 100644 index 0000000..32369fc --- /dev/null +++ b/.history/js/index_20191228090442.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090443.js b/.history/js/index_20191228090443.js new file mode 100644 index 0000000..435e6da --- /dev/null +++ b/.history/js/index_20191228090443.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const get + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090444.js b/.history/js/index_20191228090444.js new file mode 100644 index 0000000..d86db9f --- /dev/null +++ b/.history/js/index_20191228090444.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getU + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090445.js b/.history/js/index_20191228090445.js new file mode 100644 index 0000000..37007fb --- /dev/null +++ b/.history/js/index_20191228090445.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090448.js b/.history/js/index_20191228090448.js new file mode 100644 index 0000000..2e2f5a8 --- /dev/null +++ b/.history/js/index_20191228090448.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090449.js b/.history/js/index_20191228090449.js new file mode 100644 index 0000000..d9583a9 --- /dev/null +++ b/.history/js/index_20191228090449.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090451.js b/.history/js/index_20191228090451.js new file mode 100644 index 0000000..abb128e --- /dev/null +++ b/.history/js/index_20191228090451.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = () + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090455.js b/.history/js/index_20191228090455.js new file mode 100644 index 0000000..ac32837 --- /dev/null +++ b/.history/js/index_20191228090455.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (s) + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090456.js b/.history/js/index_20191228090456.js new file mode 100644 index 0000000..3465f69 --- /dev/null +++ b/.history/js/index_20191228090456.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searc) + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090457.js b/.history/js/index_20191228090457.js new file mode 100644 index 0000000..687359f --- /dev/null +++ b/.history/js/index_20191228090457.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (search) + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090503.js b/.history/js/index_20191228090503.js new file mode 100644 index 0000000..1168e48 --- /dev/null +++ b/.history/js/index_20191228090503.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090506.js b/.history/js/index_20191228090506.js new file mode 100644 index 0000000..bdb474e --- /dev/null +++ b/.history/js/index_20191228090506.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090507.js b/.history/js/index_20191228090507.js new file mode 100644 index 0000000..01eec22 --- /dev/null +++ b/.history/js/index_20191228090507.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090508.js b/.history/js/index_20191228090508.js new file mode 100644 index 0000000..4ee99b3 --- /dev/null +++ b/.history/js/index_20191228090508.js @@ -0,0 +1,89 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => {} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090509.js b/.history/js/index_20191228090509.js new file mode 100644 index 0000000..8dd91e4 --- /dev/null +++ b/.history/js/index_20191228090509.js @@ -0,0 +1,91 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090514.js b/.history/js/index_20191228090514.js new file mode 100644 index 0000000..5a5e8d5 --- /dev/null +++ b/.history/js/index_20191228090514.js @@ -0,0 +1,91 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + url +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090517.js b/.history/js/index_20191228090517.js new file mode 100644 index 0000000..8dd91e4 --- /dev/null +++ b/.history/js/index_20191228090517.js @@ -0,0 +1,91 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090519.js b/.history/js/index_20191228090519.js new file mode 100644 index 0000000..199733c --- /dev/null +++ b/.history/js/index_20191228090519.js @@ -0,0 +1,91 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090520.js b/.history/js/index_20191228090520.js new file mode 100644 index 0000000..323e084 --- /dev/null +++ b/.history/js/index_20191228090520.js @@ -0,0 +1,91 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var u +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090521.js b/.history/js/index_20191228090521.js new file mode 100644 index 0000000..f73f529 --- /dev/null +++ b/.history/js/index_20191228090521.js @@ -0,0 +1,91 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090523.js b/.history/js/index_20191228090523.js new file mode 100644 index 0000000..fb2052c --- /dev/null +++ b/.history/js/index_20191228090523.js @@ -0,0 +1,91 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090525.js b/.history/js/index_20191228090525.js new file mode 100644 index 0000000..92feb02 --- /dev/null +++ b/.history/js/index_20191228090525.js @@ -0,0 +1,91 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090526.js b/.history/js/index_20191228090526.js new file mode 100644 index 0000000..b5f7c2d --- /dev/null +++ b/.history/js/index_20191228090526.js @@ -0,0 +1,91 @@ +var searchText; +var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090539.js b/.history/js/index_20191228090539.js new file mode 100644 index 0000000..3252503 --- /dev/null +++ b/.history/js/index_20191228090539.js @@ -0,0 +1,91 @@ +var searchText; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090547.js b/.history/js/index_20191228090547.js new file mode 100644 index 0000000..3f65734 --- /dev/null +++ b/.history/js/index_20191228090547.js @@ -0,0 +1,91 @@ +var searchText; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090550.js b/.history/js/index_20191228090550.js new file mode 100644 index 0000000..7d6f681 --- /dev/null +++ b/.history/js/index_20191228090550.js @@ -0,0 +1,92 @@ +var searchText; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090551.js b/.history/js/index_20191228090551.js new file mode 100644 index 0000000..13b704c --- /dev/null +++ b/.history/js/index_20191228090551.js @@ -0,0 +1,92 @@ +var searchText; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + ret +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090552.js b/.history/js/index_20191228090552.js new file mode 100644 index 0000000..6069c88 --- /dev/null +++ b/.history/js/index_20191228090552.js @@ -0,0 +1,92 @@ +var searchText; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090553.js b/.history/js/index_20191228090553.js new file mode 100644 index 0000000..9e7fec0 --- /dev/null +++ b/.history/js/index_20191228090553.js @@ -0,0 +1,92 @@ +var searchText; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090554.js b/.history/js/index_20191228090554.js new file mode 100644 index 0000000..f127aa6 --- /dev/null +++ b/.history/js/index_20191228090554.js @@ -0,0 +1,92 @@ +var searchText; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return u +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090555.js b/.history/js/index_20191228090555.js new file mode 100644 index 0000000..1035c73 --- /dev/null +++ b/.history/js/index_20191228090555.js @@ -0,0 +1,92 @@ +var searchText; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090557.js b/.history/js/index_20191228090557.js new file mode 100644 index 0000000..b123748 --- /dev/null +++ b/.history/js/index_20191228090557.js @@ -0,0 +1,92 @@ +var searchText; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090600.js b/.history/js/index_20191228090600.js new file mode 100644 index 0000000..b123748 --- /dev/null +++ b/.history/js/index_20191228090600.js @@ -0,0 +1,92 @@ +var searchText; +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090607.js b/.history/js/index_20191228090607.js new file mode 100644 index 0000000..9d97ab7 --- /dev/null +++ b/.history/js/index_20191228090607.js @@ -0,0 +1,92 @@ +var searchText +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090608.js b/.history/js/index_20191228090608.js new file mode 100644 index 0000000..31c0f41 --- /dev/null +++ b/.history/js/index_20191228090608.js @@ -0,0 +1,92 @@ +va +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090609.js b/.history/js/index_20191228090609.js new file mode 100644 index 0000000..c576345 --- /dev/null +++ b/.history/js/index_20191228090609.js @@ -0,0 +1,92 @@ + +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090613.js b/.history/js/index_20191228090613.js new file mode 100644 index 0000000..165f48f --- /dev/null +++ b/.history/js/index_20191228090613.js @@ -0,0 +1,92 @@ + +var url = +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090614.js b/.history/js/index_20191228090614.js new file mode 100644 index 0000000..401e66c --- /dev/null +++ b/.history/js/index_20191228090614.js @@ -0,0 +1,92 @@ + +v +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090615.js b/.history/js/index_20191228090615.js new file mode 100644 index 0000000..c657a59 --- /dev/null +++ b/.history/js/index_20191228090615.js @@ -0,0 +1,91 @@ + +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090617.js b/.history/js/index_20191228090617.js new file mode 100644 index 0000000..d68579d --- /dev/null +++ b/.history/js/index_20191228090617.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090645.js b/.history/js/index_20191228090645.js new file mode 100644 index 0000000..0286d50 --- /dev/null +++ b/.history/js/index_20191228090645.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + vsearchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090646.js b/.history/js/index_20191228090646.js new file mode 100644 index 0000000..eb682c6 --- /dev/null +++ b/.history/js/index_20191228090646.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090647.js b/.history/js/index_20191228090647.js new file mode 100644 index 0000000..5a42af4 --- /dev/null +++ b/.history/js/index_20191228090647.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var ursearchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090648.js b/.history/js/index_20191228090648.js new file mode 100644 index 0000000..67b1c4b --- /dev/null +++ b/.history/js/index_20191228090648.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090649.js b/.history/js/index_20191228090649.js new file mode 100644 index 0000000..509ccb1 --- /dev/null +++ b/.history/js/index_20191228090649.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url ==searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090650.js b/.history/js/index_20191228090650.js new file mode 100644 index 0000000..e8f2391 --- /dev/null +++ b/.history/js/index_20191228090650.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url =searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090651.js b/.history/js/index_20191228090651.js new file mode 100644 index 0000000..114e40b --- /dev/null +++ b/.history/js/index_20191228090651.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090654.js b/.history/js/index_20191228090654.js new file mode 100644 index 0000000..3edc948 --- /dev/null +++ b/.history/js/index_20191228090654.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getsearchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090656.js b/.history/js/index_20191228090656.js new file mode 100644 index 0000000..a4c39e6 --- /dev/null +++ b/.history/js/index_20191228090656.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = get searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090659.js b/.history/js/index_20191228090659.js new file mode 100644 index 0000000..1399663 --- /dev/null +++ b/.history/js/index_20191228090659.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = gets searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090701.js b/.history/js/index_20191228090701.js new file mode 100644 index 0000000..a4c39e6 --- /dev/null +++ b/.history/js/index_20191228090701.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = get searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090708.js b/.history/js/index_20191228090708.js new file mode 100644 index 0000000..e464f95 --- /dev/null +++ b/.history/js/index_20191228090708.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getU searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090709.js b/.history/js/index_20191228090709.js new file mode 100644 index 0000000..649cc0c --- /dev/null +++ b/.history/js/index_20191228090709.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getUrl searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090711.js b/.history/js/index_20191228090711.js new file mode 100644 index 0000000..697ebdf --- /dev/null +++ b/.history/js/index_20191228090711.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getUrl searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090712.js b/.history/js/index_20191228090712.js new file mode 100644 index 0000000..a625809 --- /dev/null +++ b/.history/js/index_20191228090712.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getUrl () searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090722.js b/.history/js/index_20191228090722.js new file mode 100644 index 0000000..d03da3a --- /dev/null +++ b/.history/js/index_20191228090722.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getUrl (document.getElementById("searchText").value) searchText = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090726.js b/.history/js/index_20191228090726.js new file mode 100644 index 0000000..d4d605f --- /dev/null +++ b/.history/js/index_20191228090726.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getUrl (document.getElementById("searchText").value) searchText =; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090727.js b/.history/js/index_20191228090727.js new file mode 100644 index 0000000..abcf30e --- /dev/null +++ b/.history/js/index_20191228090727.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getUrl (document.getElementById("searchText").value) search; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090728.js b/.history/js/index_20191228090728.js new file mode 100644 index 0000000..e1d90ea --- /dev/null +++ b/.history/js/index_20191228090728.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getUrl (document.getElementById("searchText").value) ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090729.js b/.history/js/index_20191228090729.js new file mode 100644 index 0000000..f520d20 --- /dev/null +++ b/.history/js/index_20191228090729.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090731.js b/.history/js/index_20191228090731.js new file mode 100644 index 0000000..f520d20 --- /dev/null +++ b/.history/js/index_20191228090731.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090732.js b/.history/js/index_20191228090732.js new file mode 100644 index 0000000..f520d20 --- /dev/null +++ b/.history/js/index_20191228090732.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090802.js b/.history/js/index_20191228090802.js new file mode 100644 index 0000000..0ef07ff --- /dev/null +++ b/.history/js/index_20191228090802.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090806.js b/.history/js/index_20191228090806.js new file mode 100644 index 0000000..c7f0401 --- /dev/null +++ b/.history/js/index_20191228090806.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + se + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090811.js b/.history/js/index_20191228090811.js new file mode 100644 index 0000000..3a8146b --- /dev/null +++ b/.history/js/index_20191228090811.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => se + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090812.js b/.history/js/index_20191228090812.js new file mode 100644 index 0000000..c4e45d0 --- /dev/null +++ b/.history/js/index_20191228090812.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => {se + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090813.js b/.history/js/index_20191228090813.js new file mode 100644 index 0000000..c7f0401 --- /dev/null +++ b/.history/js/index_20191228090813.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + se + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090815.js b/.history/js/index_20191228090815.js new file mode 100644 index 0000000..ede4979 --- /dev/null +++ b/.history/js/index_20191228090815.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + e + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090816.js b/.history/js/index_20191228090816.js new file mode 100644 index 0000000..0ef07ff --- /dev/null +++ b/.history/js/index_20191228090816.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090824.js b/.history/js/index_20191228090824.js new file mode 100644 index 0000000..8003761 --- /dev/null +++ b/.history/js/index_20191228090824.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + s + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090825.js b/.history/js/index_20191228090825.js new file mode 100644 index 0000000..b607fb3 --- /dev/null +++ b/.history/js/index_20191228090825.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + search + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090827.js b/.history/js/index_20191228090827.js new file mode 100644 index 0000000..854cd59 --- /dev/null +++ b/.history/js/index_20191228090827.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchTex + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090828.js b/.history/js/index_20191228090828.js new file mode 100644 index 0000000..13cb942 --- /dev/null +++ b/.history/js/index_20191228090828.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + searchText + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090831.js b/.history/js/index_20191228090831.js new file mode 100644 index 0000000..b6f89a2 --- /dev/null +++ b/.history/js/index_20191228090831.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + vsearchText + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090832.js b/.history/js/index_20191228090832.js new file mode 100644 index 0000000..c236102 --- /dev/null +++ b/.history/js/index_20191228090832.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + varsearchText + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090833.js b/.history/js/index_20191228090833.js new file mode 100644 index 0000000..ef01600 --- /dev/null +++ b/.history/js/index_20191228090833.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090931.js b/.history/js/index_20191228090931.js new file mode 100644 index 0000000..c91b018 --- /dev/null +++ b/.history/js/index_20191228090931.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090934.js b/.history/js/index_20191228090934.js new file mode 100644 index 0000000..fee13d3 --- /dev/null +++ b/.history/js/index_20191228090934.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090935.js b/.history/js/index_20191228090935.js new file mode 100644 index 0000000..32881b4 --- /dev/null +++ b/.history/js/index_20191228090935.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090945.js b/.history/js/index_20191228090945.js new file mode 100644 index 0000000..8200dba --- /dev/null +++ b/.history/js/index_20191228090945.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = "" + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090951.js b/.history/js/index_20191228090951.js new file mode 100644 index 0000000..32881b4 --- /dev/null +++ b/.history/js/index_20191228090951.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228090952.js b/.history/js/index_20191228090952.js new file mode 100644 index 0000000..32881b4 --- /dev/null +++ b/.history/js/index_20191228090952.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = + var url = getUrl (document.getElementById("searchText").value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091000.js b/.history/js/index_20191228091000.js new file mode 100644 index 0000000..2cbef71 --- /dev/null +++ b/.history/js/index_20191228091000.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText") + var url = getUrl (.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091002.js b/.history/js/index_20191228091002.js new file mode 100644 index 0000000..8e92cf1 --- /dev/null +++ b/.history/js/index_20191228091002.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = ; + var url = getUrl (.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091005.js b/.history/js/index_20191228091005.js new file mode 100644 index 0000000..2cbef71 --- /dev/null +++ b/.history/js/index_20191228091005.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText") + var url = getUrl (.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091007.js b/.history/js/index_20191228091007.js new file mode 100644 index 0000000..142ff9b --- /dev/null +++ b/.history/js/index_20191228091007.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091012.js b/.history/js/index_20191228091012.js new file mode 100644 index 0000000..6a7ed68 --- /dev/null +++ b/.history/js/index_20191228091012.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (s.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091013.js b/.history/js/index_20191228091013.js new file mode 100644 index 0000000..07263ea --- /dev/null +++ b/.history/js/index_20191228091013.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (sea.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091015.js b/.history/js/index_20191228091015.js new file mode 100644 index 0000000..6c5145e --- /dev/null +++ b/.history/js/index_20191228091015.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091018.js b/.history/js/index_20191228091018.js new file mode 100644 index 0000000..6c5145e --- /dev/null +++ b/.history/js/index_20191228091018.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091028.js b/.history/js/index_20191228091028.js new file mode 100644 index 0000000..6c5145e --- /dev/null +++ b/.history/js/index_20191228091028.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + // url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091032.js b/.history/js/index_20191228091032.js new file mode 100644 index 0000000..599a25e --- /dev/null +++ b/.history/js/index_20191228091032.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults=40" + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091037.js b/.history/js/index_20191228091037.js new file mode 100644 index 0000000..6539c29 --- /dev/null +++ b/.history/js/index_20191228091037.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&maxResults + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091038.js b/.history/js/index_20191228091038.js new file mode 100644 index 0000000..071e601 --- /dev/null +++ b/.history/js/index_20191228091038.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&max + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091039.js b/.history/js/index_20191228091039.js new file mode 100644 index 0000000..955845f --- /dev/null +++ b/.history/js/index_20191228091039.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&downloa + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091040.js b/.history/js/index_20191228091040.js new file mode 100644 index 0000000..6362b95 --- /dev/null +++ b/.history/js/index_20191228091040.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pride+p + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091041.js b/.history/js/index_20191228091041.js new file mode 100644 index 0000000..b9a3a5d --- /dev/null +++ b/.history/js/index_20191228091041.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1/volumes?q=pr + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091042.js b/.history/js/index_20191228091042.js new file mode 100644 index 0000000..e05f579 --- /dev/null +++ b/.history/js/index_20191228091042.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis.com/books/v1 + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091043.js b/.history/js/index_20191228091043.js new file mode 100644 index 0000000..8e0ed4d --- /dev/null +++ b/.history/js/index_20191228091043.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www.googleapis. + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091044.js b/.history/js/index_20191228091044.js new file mode 100644 index 0000000..c1a8f99 --- /dev/null +++ b/.history/js/index_20191228091044.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "https://www. + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091045.js b/.history/js/index_20191228091045.js new file mode 100644 index 0000000..0cbcdbb --- /dev/null +++ b/.history/js/index_20191228091045.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = "ht + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091046.js b/.history/js/index_20191228091046.js new file mode 100644 index 0000000..adfb1fd --- /dev/null +++ b/.history/js/index_20191228091046.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = " + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091047.js b/.history/js/index_20191228091047.js new file mode 100644 index 0000000..e4bd2c9 --- /dev/null +++ b/.history/js/index_20191228091047.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091052.js b/.history/js/index_20191228091052.js new file mode 100644 index 0000000..e10da72 --- /dev/null +++ b/.history/js/index_20191228091052.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = get + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091055.js b/.history/js/index_20191228091055.js new file mode 100644 index 0000000..813e484 --- /dev/null +++ b/.history/js/index_20191228091055.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091057.js b/.history/js/index_20191228091057.js new file mode 100644 index 0000000..c8df828 --- /dev/null +++ b/.history/js/index_20191228091057.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl() + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091059.js b/.history/js/index_20191228091059.js new file mode 100644 index 0000000..5a84444 --- /dev/null +++ b/.history/js/index_20191228091059.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("") + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091101.js b/.history/js/index_20191228091101.js new file mode 100644 index 0000000..a324c07 --- /dev/null +++ b/.history/js/index_20191228091101.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Ha") + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091102.js b/.history/js/index_20191228091102.js new file mode 100644 index 0000000..9f70c00 --- /dev/null +++ b/.history/js/index_20191228091102.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy") + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091103.js b/.history/js/index_20191228091103.js new file mode 100644 index 0000000..217844d --- /dev/null +++ b/.history/js/index_20191228091103.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy ") + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091104.js b/.history/js/index_20191228091104.js new file mode 100644 index 0000000..7347b3c --- /dev/null +++ b/.history/js/index_20191228091104.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy peop") + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091105.js b/.history/js/index_20191228091105.js new file mode 100644 index 0000000..618309d --- /dev/null +++ b/.history/js/index_20191228091105.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people") + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091107.js b/.history/js/index_20191228091107.js new file mode 100644 index 0000000..833e21b --- /dev/null +++ b/.history/js/index_20191228091107.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people";) + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091109.js b/.history/js/index_20191228091109.js new file mode 100644 index 0000000..618309d --- /dev/null +++ b/.history/js/index_20191228091109.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people") + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091110.js b/.history/js/index_20191228091110.js new file mode 100644 index 0000000..fe67d4b --- /dev/null +++ b/.history/js/index_20191228091110.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091111.js b/.history/js/index_20191228091111.js new file mode 100644 index 0000000..fe67d4b --- /dev/null +++ b/.history/js/index_20191228091111.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl (searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091134.js b/.history/js/index_20191228091134.js new file mode 100644 index 0000000..4419240 --- /dev/null +++ b/.history/js/index_20191228091134.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl(searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091136.js b/.history/js/index_20191228091136.js new file mode 100644 index 0000000..4419240 --- /dev/null +++ b/.history/js/index_20191228091136.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText"); + var url = getUrl(searchText.value); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091224.js b/.history/js/index_20191228091224.js new file mode 100644 index 0000000..4a2b45e --- /dev/null +++ b/.history/js/index_20191228091224.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091226.js b/.history/js/index_20191228091226.js new file mode 100644 index 0000000..4a2b45e --- /dev/null +++ b/.history/js/index_20191228091226.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091227.js b/.history/js/index_20191228091227.js new file mode 100644 index 0000000..4a2b45e --- /dev/null +++ b/.history/js/index_20191228091227.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091228.js b/.history/js/index_20191228091228.js new file mode 100644 index 0000000..4a2b45e --- /dev/null +++ b/.history/js/index_20191228091228.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091343.js b/.history/js/index_20191228091343.js new file mode 100644 index 0000000..4a2b45e --- /dev/null +++ b/.history/js/index_20191228091343.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091344.js b/.history/js/index_20191228091344.js new file mode 100644 index 0000000..4a2b45e --- /dev/null +++ b/.history/js/index_20191228091344.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091357.js b/.history/js/index_20191228091357.js new file mode 100644 index 0000000..a8cc5e0 --- /dev/null +++ b/.history/js/index_20191228091357.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + vurl = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091358.js b/.history/js/index_20191228091358.js new file mode 100644 index 0000000..e1296f5 --- /dev/null +++ b/.history/js/index_20191228091358.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091359.js b/.history/js/index_20191228091359.js new file mode 100644 index 0000000..e1296f5 --- /dev/null +++ b/.history/js/index_20191228091359.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}) + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091508.js b/.history/js/index_20191228091508.js new file mode 100644 index 0000000..6dadd05 --- /dev/null +++ b/.history/js/index_20191228091508.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +} + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091511.js b/.history/js/index_20191228091511.js new file mode 100644 index 0000000..b4d8379 --- /dev/null +++ b/.history/js/index_20191228091511.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091523.js b/.history/js/index_20191228091523.js new file mode 100644 index 0000000..0cf2eca --- /dev/null +++ b/.history/js/index_20191228091523.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091543.js b/.history/js/index_20191228091543.js new file mode 100644 index 0000000..643b2e2 --- /dev/null +++ b/.history/js/index_20191228091543.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +} + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091552.js b/.history/js/index_20191228091552.js new file mode 100644 index 0000000..fe6d29d --- /dev/null +++ b/.history/js/index_20191228091552.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +} \ No newline at end of file diff --git a/.history/js/index_20191228091607.js b/.history/js/index_20191228091607.js new file mode 100644 index 0000000..f6c9646 --- /dev/null +++ b/.history/js/index_20191228091607.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091609.js b/.history/js/index_20191228091609.js new file mode 100644 index 0000000..f6c9646 --- /dev/null +++ b/.history/js/index_20191228091609.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091610.js b/.history/js/index_20191228091610.js new file mode 100644 index 0000000..f6c9646 --- /dev/null +++ b/.history/js/index_20191228091610.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +} + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091635.js b/.history/js/index_20191228091635.js new file mode 100644 index 0000000..674fa47 --- /dev/null +++ b/.history/js/index_20191228091635.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091636.js b/.history/js/index_20191228091636.js new file mode 100644 index 0000000..674fa47 --- /dev/null +++ b/.history/js/index_20191228091636.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091731.js b/.history/js/index_20191228091731.js new file mode 100644 index 0000000..674fa47 --- /dev/null +++ b/.history/js/index_20191228091731.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(url); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091751.js b/.history/js/index_20191228091751.js new file mode 100644 index 0000000..8fbf602 --- /dev/null +++ b/.history/js/index_20191228091751.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(ur); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091752.js b/.history/js/index_20191228091752.js new file mode 100644 index 0000000..1956759 --- /dev/null +++ b/.history/js/index_20191228091752.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = getUrl("Happy people"); + getData(); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091759.js b/.history/js/index_20191228091759.js new file mode 100644 index 0000000..d8d6c1d --- /dev/null +++ b/.history/js/index_20191228091759.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url = ; + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091803.js b/.history/js/index_20191228091803.js new file mode 100644 index 0000000..17a8a95 --- /dev/null +++ b/.history/js/index_20191228091803.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var url + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091804.js b/.history/js/index_20191228091804.js new file mode 100644 index 0000000..e8d1108 --- /dev/null +++ b/.history/js/index_20191228091804.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + var + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091805.js b/.history/js/index_20191228091805.js new file mode 100644 index 0000000..f07a652 --- /dev/null +++ b/.history/js/index_20191228091805.js @@ -0,0 +1,91 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + v + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091806.js b/.history/js/index_20191228091806.js new file mode 100644 index 0000000..551c176 --- /dev/null +++ b/.history/js/index_20191228091806.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091810.js b/.history/js/index_20191228091810.js new file mode 100644 index 0000000..551c176 --- /dev/null +++ b/.history/js/index_20191228091810.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(url); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091821.js b/.history/js/index_20191228091821.js new file mode 100644 index 0000000..72ec948 --- /dev/null +++ b/.history/js/index_20191228091821.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(ur); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091822.js b/.history/js/index_20191228091822.js new file mode 100644 index 0000000..6b95121 --- /dev/null +++ b/.history/js/index_20191228091822.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = getUrl(searchText); + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091831.js b/.history/js/index_20191228091831.js new file mode 100644 index 0000000..5c126a5 --- /dev/null +++ b/.history/js/index_20191228091831.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = ; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091836.js b/.history/js/index_20191228091836.js new file mode 100644 index 0000000..96d7db8 --- /dev/null +++ b/.history/js/index_20191228091836.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var url = + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091837.js b/.history/js/index_20191228091837.js new file mode 100644 index 0000000..504340a --- /dev/null +++ b/.history/js/index_20191228091837.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + var ur + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091838.js b/.history/js/index_20191228091838.js new file mode 100644 index 0000000..4fc226e --- /dev/null +++ b/.history/js/index_20191228091838.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + va + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091839.js b/.history/js/index_20191228091839.js new file mode 100644 index 0000000..70a45f4 --- /dev/null +++ b/.history/js/index_20191228091839.js @@ -0,0 +1,90 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091841.js b/.history/js/index_20191228091841.js new file mode 100644 index 0000000..e5a991f --- /dev/null +++ b/.history/js/index_20191228091841.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091846.js b/.history/js/index_20191228091846.js new file mode 100644 index 0000000..df05e2d --- /dev/null +++ b/.history/js/index_20191228091846.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091852.js b/.history/js/index_20191228091852.js new file mode 100644 index 0000000..df05e2d --- /dev/null +++ b/.history/js/index_20191228091852.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091853.js b/.history/js/index_20191228091853.js new file mode 100644 index 0000000..df05e2d --- /dev/null +++ b/.history/js/index_20191228091853.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091905.js b/.history/js/index_20191228091905.js new file mode 100644 index 0000000..df05e2d --- /dev/null +++ b/.history/js/index_20191228091905.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091906.js b/.history/js/index_20191228091906.js new file mode 100644 index 0000000..df05e2d --- /dev/null +++ b/.history/js/index_20191228091906.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091907.js b/.history/js/index_20191228091907.js new file mode 100644 index 0000000..df05e2d --- /dev/null +++ b/.history/js/index_20191228091907.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228091931.js b/.history/js/index_20191228091931.js new file mode 100644 index 0000000..df05e2d --- /dev/null +++ b/.history/js/index_20191228091931.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228092110.js b/.history/js/index_20191228092110.js new file mode 100644 index 0000000..df05e2d --- /dev/null +++ b/.history/js/index_20191228092110.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228092111.js b/.history/js/index_20191228092111.js new file mode 100644 index 0000000..df05e2d --- /dev/null +++ b/.history/js/index_20191228092111.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
` + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228092152.js b/.history/js/index_20191228092152.js new file mode 100644 index 0000000..7e9a7c2 --- /dev/null +++ b/.history/js/index_20191228092152.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228092153.js b/.history/js/index_20191228092153.js new file mode 100644 index 0000000..7e9a7c2 --- /dev/null +++ b/.history/js/index_20191228092153.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093415.js b/.history/js/index_20191228093415.js new file mode 100644 index 0000000..2471334 --- /dev/null +++ b/.history/js/index_20191228093415.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093416.js b/.history/js/index_20191228093416.js new file mode 100644 index 0000000..145fcd2 --- /dev/null +++ b/.history/js/index_20191228093416.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + e3 + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093417.js b/.history/js/index_20191228093417.js new file mode 100644 index 0000000..b8da7ae --- /dev/null +++ b/.history/js/index_20191228093417.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + e3ligi + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093418.js b/.history/js/index_20191228093418.js new file mode 100644 index 0000000..6b82bf9 --- /dev/null +++ b/.history/js/index_20191228093418.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + e3ligibl + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093419.js b/.history/js/index_20191228093419.js new file mode 100644 index 0000000..705e37e --- /dev/null +++ b/.history/js/index_20191228093419.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + e3ligible. + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093420.js b/.history/js/index_20191228093420.js new file mode 100644 index 0000000..e81d393 --- /dev/null +++ b/.history/js/index_20191228093420.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + e3ligible.m + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093422.js b/.history/js/index_20191228093422.js new file mode 100644 index 0000000..9b29d80 --- /dev/null +++ b/.history/js/index_20191228093422.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + e3ligible.ma + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093423.js b/.history/js/index_20191228093423.js new file mode 100644 index 0000000..9bd83b3 --- /dev/null +++ b/.history/js/index_20191228093423.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + e3ligible.map + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093425.js b/.history/js/index_20191228093425.js new file mode 100644 index 0000000..e81d393 --- /dev/null +++ b/.history/js/index_20191228093425.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + e3ligible.m + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093426.js b/.history/js/index_20191228093426.js new file mode 100644 index 0000000..3e202db --- /dev/null +++ b/.history/js/index_20191228093426.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + e3ligible + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093430.js b/.history/js/index_20191228093430.js new file mode 100644 index 0000000..56dae94 --- /dev/null +++ b/.history/js/index_20191228093430.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093433.js b/.history/js/index_20191228093433.js new file mode 100644 index 0000000..bc4498a --- /dev/null +++ b/.history/js/index_20191228093433.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible. + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093435.js b/.history/js/index_20191228093435.js new file mode 100644 index 0000000..72e4ccd --- /dev/null +++ b/.history/js/index_20191228093435.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.m + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093436.js b/.history/js/index_20191228093436.js new file mode 100644 index 0000000..669611f --- /dev/null +++ b/.history/js/index_20191228093436.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093437.js b/.history/js/index_20191228093437.js new file mode 100644 index 0000000..d6632c6 --- /dev/null +++ b/.history/js/index_20191228093437.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map() + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093444.js b/.history/js/index_20191228093444.js new file mode 100644 index 0000000..ea9c350 --- /dev/null +++ b/.history/js/index_20191228093444.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(b) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093445.js b/.history/js/index_20191228093445.js new file mode 100644 index 0000000..e98b7c4 --- /dev/null +++ b/.history/js/index_20191228093445.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093451.js b/.history/js/index_20191228093451.js new file mode 100644 index 0000000..2895e7c --- /dev/null +++ b/.history/js/index_20191228093451.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book =) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093456.js b/.history/js/index_20191228093456.js new file mode 100644 index 0000000..8649e4e --- /dev/null +++ b/.history/js/index_20191228093456.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book =>) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093457.js b/.history/js/index_20191228093457.js new file mode 100644 index 0000000..3fcf8f4 --- /dev/null +++ b/.history/js/index_20191228093457.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => ) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093504.js b/.history/js/index_20191228093504.js new file mode 100644 index 0000000..c25fb2e --- /dev/null +++ b/.history/js/index_20191228093504.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {}) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093509.js b/.history/js/index_20191228093509.js new file mode 100644 index 0000000..8f2d453 --- /dev/null +++ b/.history/js/index_20191228093509.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {dis}) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093510.js b/.history/js/index_20191228093510.js new file mode 100644 index 0000000..b24b9df --- /dev/null +++ b/.history/js/index_20191228093510.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displ}) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093511.js b/.history/js/index_20191228093511.js new file mode 100644 index 0000000..07f388b --- /dev/null +++ b/.history/js/index_20191228093511.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {display}) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093512.js b/.history/js/index_20191228093512.js new file mode 100644 index 0000000..63a7074 --- /dev/null +++ b/.history/js/index_20191228093512.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards}) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093515.js b/.history/js/index_20191228093515.js new file mode 100644 index 0000000..886d806 --- /dev/null +++ b/.history/js/index_20191228093515.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards()}) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093517.js b/.history/js/index_20191228093517.js new file mode 100644 index 0000000..a4e60c9 --- /dev/null +++ b/.history/js/index_20191228093517.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093519.js b/.history/js/index_20191228093519.js new file mode 100644 index 0000000..a4e60c9 --- /dev/null +++ b/.history/js/index_20191228093519.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}) + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093524.js b/.history/js/index_20191228093524.js new file mode 100644 index 0000000..67d0582 --- /dev/null +++ b/.history/js/index_20191228093524.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + for (var i = 0; i < eligible.length; i++) { + displayCards(eligible, i); + } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093530.js b/.history/js/index_20191228093530.js new file mode 100644 index 0000000..ae55578 --- /dev/null +++ b/.history/js/index_20191228093530.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093532.js b/.history/js/index_20191228093532.js new file mode 100644 index 0000000..ae55578 --- /dev/null +++ b/.history/js/index_20191228093532.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093537.js b/.history/js/index_20191228093537.js new file mode 100644 index 0000000..ae55578 --- /dev/null +++ b/.history/js/index_20191228093537.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, i) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093606.js b/.history/js/index_20191228093606.js new file mode 100644 index 0000000..5a0962a --- /dev/null +++ b/.history/js/index_20191228093606.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books, ) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093607.js b/.history/js/index_20191228093607.js new file mode 100644 index 0000000..751a011 --- /dev/null +++ b/.history/js/index_20191228093607.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (books) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093609.js b/.history/js/index_20191228093609.js new file mode 100644 index 0000000..b23d601 --- /dev/null +++ b/.history/js/index_20191228093609.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = books[i].volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093614.js b/.history/js/index_20191228093614.js new file mode 100644 index 0000000..0dfb33f --- /dev/null +++ b/.history/js/index_20191228093614.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = books[i.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093615.js b/.history/js/index_20191228093615.js new file mode 100644 index 0000000..eb3f8eb --- /dev/null +++ b/.history/js/index_20191228093615.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = books.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093616.js b/.history/js/index_20191228093616.js new file mode 100644 index 0000000..31e9a79 --- /dev/null +++ b/.history/js/index_20191228093616.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093618.js b/.history/js/index_20191228093618.js new file mode 100644 index 0000000..31e9a79 --- /dev/null +++ b/.history/js/index_20191228093618.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093625.js b/.history/js/index_20191228093625.js new file mode 100644 index 0000000..31e9a79 --- /dev/null +++ b/.history/js/index_20191228093625.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093743.js b/.history/js/index_20191228093743.js new file mode 100644 index 0000000..d94665f --- /dev/null +++ b/.history/js/index_20191228093743.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093744.js b/.history/js/index_20191228093744.js new file mode 100644 index 0000000..f17ee99 --- /dev/null +++ b/.history/js/index_20191228093744.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093746.js b/.history/js/index_20191228093746.js new file mode 100644 index 0000000..f17ee99 --- /dev/null +++ b/.history/js/index_20191228093746.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093747.js b/.history/js/index_20191228093747.js new file mode 100644 index 0000000..f17ee99 --- /dev/null +++ b/.history/js/index_20191228093747.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093839.js b/.history/js/index_20191228093839.js new file mode 100644 index 0000000..f17ee99 --- /dev/null +++ b/.history/js/index_20191228093839.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093840.js b/.history/js/index_20191228093840.js new file mode 100644 index 0000000..f17ee99 --- /dev/null +++ b/.history/js/index_20191228093840.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // } + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093848.js b/.history/js/index_20191228093848.js new file mode 100644 index 0000000..8118a79 --- /dev/null +++ b/.history/js/index_20191228093848.js @@ -0,0 +1,89 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + // + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093849.js b/.history/js/index_20191228093849.js new file mode 100644 index 0000000..24d09f1 --- /dev/null +++ b/.history/js/index_20191228093849.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i); + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093850.js b/.history/js/index_20191228093850.js new file mode 100644 index 0000000..9bf780c --- /dev/null +++ b/.history/js/index_20191228093850.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible, i + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093851.js b/.history/js/index_20191228093851.js new file mode 100644 index 0000000..1d60427 --- /dev/null +++ b/.history/js/index_20191228093851.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCards(eligible + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093852.js b/.history/js/index_20191228093852.js new file mode 100644 index 0000000..715cc2b --- /dev/null +++ b/.history/js/index_20191228093852.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // displayCard + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093853.js b/.history/js/index_20191228093853.js new file mode 100644 index 0000000..e8e51b0 --- /dev/null +++ b/.history/js/index_20191228093853.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + // display + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093854.js b/.history/js/index_20191228093854.js new file mode 100644 index 0000000..30c5445 --- /dev/null +++ b/.history/js/index_20191228093854.js @@ -0,0 +1,88 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) { + / + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093855.js b/.history/js/index_20191228093855.js new file mode 100644 index 0000000..168768b --- /dev/null +++ b/.history/js/index_20191228093855.js @@ -0,0 +1,87 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; i++) + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093856.js b/.history/js/index_20191228093856.js new file mode 100644 index 0000000..780d241 --- /dev/null +++ b/.history/js/index_20191228093856.js @@ -0,0 +1,87 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < eligible.length; + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093857.js b/.history/js/index_20191228093857.js new file mode 100644 index 0000000..07be55a --- /dev/null +++ b/.history/js/index_20191228093857.js @@ -0,0 +1,87 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0; i < + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093858.js b/.history/js/index_20191228093858.js new file mode 100644 index 0000000..426447f --- /dev/null +++ b/.history/js/index_20191228093858.js @@ -0,0 +1,87 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for (var i = 0 + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093859.js b/.history/js/index_20191228093859.js new file mode 100644 index 0000000..2dd6605 --- /dev/null +++ b/.history/js/index_20191228093859.js @@ -0,0 +1,87 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + // for + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093900.js b/.history/js/index_20191228093900.js new file mode 100644 index 0000000..bdd5fab --- /dev/null +++ b/.history/js/index_20191228093900.js @@ -0,0 +1,87 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093901.js b/.history/js/index_20191228093901.js new file mode 100644 index 0000000..f41ff17 --- /dev/null +++ b/.history/js/index_20191228093901.js @@ -0,0 +1,86 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093902.js b/.history/js/index_20191228093902.js new file mode 100644 index 0000000..f41ff17 --- /dev/null +++ b/.history/js/index_20191228093902.js @@ -0,0 +1,86 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093905.js b/.history/js/index_20191228093905.js new file mode 100644 index 0000000..bf483df --- /dev/null +++ b/.history/js/index_20191228093905.js @@ -0,0 +1,86 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)};); + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093907.js b/.history/js/index_20191228093907.js new file mode 100644 index 0000000..f41ff17 --- /dev/null +++ b/.history/js/index_20191228093907.js @@ -0,0 +1,86 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book)}); + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093913.js b/.history/js/index_20191228093913.js new file mode 100644 index 0000000..3259593 --- /dev/null +++ b/.history/js/index_20191228093913.js @@ -0,0 +1,86 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book);}); + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228093917.js b/.history/js/index_20191228093917.js new file mode 100644 index 0000000..3259593 --- /dev/null +++ b/.history/js/index_20191228093917.js @@ -0,0 +1,86 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book);}); + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.history/js/index_20191228094042.js b/.history/js/index_20191228094042.js new file mode 100644 index 0000000..3259593 --- /dev/null +++ b/.history/js/index_20191228094042.js @@ -0,0 +1,86 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book);}); + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f673a71 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5502 +} \ No newline at end of file diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..132d0e2 --- /dev/null +++ b/css/style.css @@ -0,0 +1,4 @@ +body { + font-family: 'Pacifico', cursive; + background-color: #68aa77; +} \ No newline at end of file diff --git a/index.html b/index.html index e69de29..3e98a0a 100644 --- a/index.html +++ b/index.html @@ -0,0 +1,32 @@ + + + + + + + + + + + + Book-Worm + + + + + +
+
+
+ + + + \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..3259593 --- /dev/null +++ b/js/index.js @@ -0,0 +1,86 @@ +var content = document.getElementById("content"); +var search = document.getElementById("search"); + +search.addEventListener("click", () => { + var searchText = document.getElementById("searchText").value; + if (searchText !== "" && searchText.trim(" ").length !== 0) { + getData(getUrl(searchText)); + } else { + window.alert("Please enter a search term that contains at least one alphanumeric character") + } + searchText = ""; +}); + +window.onload = () => { + getData(getUrl("Happy people")); +}; + +const getData = (url) => { + var request = new XMLHttpRequest(); + request.open('GET', url); + request.onload = () => { + if (request.status = 200) { + var data = JSON.parse(request.responseText); + var books = data.items; + var eligible = []; + for (x = 0; x < books.length; x++) { + if (books[x].volumeInfo.imageLinks != null && + books[x].volumeInfo.authors != null && + books[x].volumeInfo.industryIdentifiers != null) { + eligible.push(books[x]); + } else { + continue; + } + } + content.innerHTML = ""; + eligible.map(book => {displayCards(book);}); + } else { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + } + }; + + request.onerror = () => { + window.alert("There's a problem contacting the server, Please refresh or try again in a few moments."); + }; + request.send(); +}; + +const getUrl = (searchText) => { + var url = `https://www.googleapis.com/books/v1/volumes?q=${searchText}&download=epub&maxResults=40`; + return url; +}; + +const displayCards = (book) => { + var info = book.volumeInfo; + var card = + `
+
+
+ ${info.title}+"cover" +

Preview

+

Download

+ +
+ +
+
+
${info.title}
+
+

${info.description}

+
+
    +
  • Author: ${info.authors.join(", ")}
  • +
  • Published: ${info.publishedDate}
  • +
  • Publisher: ${info.publisher}
  • +
  • ${info.industryIdentifiers[0].type}: ${info.industryIdentifiers[0].identifier}
  • +
  • Category: ${info.categories}
  • +
+ + +
+
+
`; + content.insertAdjacentHTML('beforeend', card); +}; \ No newline at end of file diff --git a/style.css b/style.css deleted file mode 100644 index e69de29..0000000