From 72f6aa0e90d43891dd19c40ec057144b52ab2058 Mon Sep 17 00:00:00 2001 From: logandouglass Date: Sun, 22 May 2022 21:33:51 -0400 Subject: [PATCH 01/11] routine committ --- code/logan/javascript/lab04/index.html | 55 ++++++++++++++++++++++++++ code/logan/javascript/lab04/script.js | 45 +++++++++++++++++++++ code/logan/lab00/text.txt | 0 3 files changed, 100 insertions(+) create mode 100644 code/logan/javascript/lab04/index.html create mode 100644 code/logan/javascript/lab04/script.js delete mode 100644 code/logan/lab00/text.txt diff --git a/code/logan/javascript/lab04/index.html b/code/logan/javascript/lab04/index.html new file mode 100644 index 00000000..560751a7 --- /dev/null +++ b/code/logan/javascript/lab04/index.html @@ -0,0 +1,55 @@ + + + + + + + The Vue-tiful Game + + + + + + + +
+ + + +

{{headline}}

+ + + + + +
+
+ +

{{faveQ}}

+

{{qAuthor}}

+ +
+
+ +
+ + + +
+ + + + + +
+ + + \ No newline at end of file diff --git a/code/logan/javascript/lab04/script.js b/code/logan/javascript/lab04/script.js new file mode 100644 index 00000000..5bcf63fb --- /dev/null +++ b/code/logan/javascript/lab04/script.js @@ -0,0 +1,45 @@ +const App = { + data () { + return { + test: 'Hello World', + headline: 'Vue Quotes', + faveQ: "", + qAuthor: "", + qotdURL: "https://favqs.com/api/qotd", + fQuotes: [], + searchTerm: "", + + } + }, + + created () { + this.getQuote() + }, + + methods: { + getQuote () { + // console.log({ 'this in getDadJoke': this }) // this is the vue app + // this.dadJoke = 'Dad joke incoming...' + axios({ // this entire thing will return a promise + // url: this.baseUrl, + url: this.qotdURL, + headers: { Accept: 'application/json' }, + method: 'get' + }).then(res => { + console.log({ 'this in .then': this }) // this is the Window if not in an arrow function + // this will still be the vue app if in an arrow function + + this.faveQ = res.data.quote.body + this.qAuthor = res.data.quote.author + + // alert(this.faveQ) + })}, + + searchQuote () {}, + + +}} + + +const app = Vue.createApp(App) +app.mount('#app') \ No newline at end of file diff --git a/code/logan/lab00/text.txt b/code/logan/lab00/text.txt deleted file mode 100644 index e69de29b..00000000 From 91b56542f641d06b4715dc4db4de82e3fa10c88f Mon Sep 17 00:00:00 2001 From: logandouglass Date: Mon, 23 May 2022 13:22:00 -0400 Subject: [PATCH 02/11] workin on the snail road --- code/logan/javascript/lab04/index.html | 4 ++++ code/logan/javascript/lab04/script.js | 26 ++++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/code/logan/javascript/lab04/index.html b/code/logan/javascript/lab04/index.html index 560751a7..df38320c 100644 --- a/code/logan/javascript/lab04/index.html +++ b/code/logan/javascript/lab04/index.html @@ -41,7 +41,11 @@

{{qAuthor}}

+
+
+ {{fQuotes}} + - +
-
-
+

Random Quotes

-

{{faveQ}}

-

{{qAuthor}}

+
  • + {{quote}} +
  • -
    -
    +
    +
    + + -
    +
    -
    -
    +
  • + {{quote.body}} +
  • - {{fQuotes}} - +
    + - + {{sQuoteData}}
    diff --git a/code/logan/javascript/lab04/script.js b/code/logan/javascript/lab04/script.js index 77471ad0..daf5879e 100644 --- a/code/logan/javascript/lab04/script.js +++ b/code/logan/javascript/lab04/script.js @@ -7,15 +7,27 @@ const App = { qAuthor: "", qotdURL: "https://favqs.com/api/qotd", baseURL: "https://favqs.com/api/quotes/", - fQuotes: undefined, + fQuotes: [], + sQuotes: undefined, searchTerm: "", error: "", + sQuoteData: undefined, + pagButton: undefined, + pagData: undefined, + pagCounter: 1, } }, created () { - this.getQuote() + + let i = 0 + while (i < 5) { + i++ + this.getQuote() + } + + }, methods: { @@ -34,11 +46,14 @@ const App = { this.faveQ = res.data.quote.body this.qAuthor = res.data.quote.author + this.fQuotes.push(this.faveQ) + // alert(this.faveQ) })}, // heavily indebted to that Pete code searchQuote () { + this.pagCounter = 1 this.error = '' axios({ method: 'get', @@ -48,10 +63,25 @@ const App = { }).then(res => { // throw new Error('Something went wrong. Please try again.') console.log(res.data) - this.fQuotes = res.data.quotes // might need to fool with this .results + this.sQuotes = res.data.quotes // might need to fool with this .results + this.sQuoteData = res.data + this.pagData = res.data.last_page + }).catch(err => this.error = err.message) // .catch will run if an error occurs // alert(this.fQuotes) // .finally(() => alert('finally ran')) // .finally is always going to run}, + + // this.pagButton = "dog" + + if (this.pagData === false){ + this.pagButton = [1] + } + // alert("we here") + }, + + nextPage () { + + } } } diff --git a/code/logan/javascript/todos/index.html b/code/logan/javascript/todos/index.html new file mode 100644 index 00000000..b051d230 --- /dev/null +++ b/code/logan/javascript/todos/index.html @@ -0,0 +1,118 @@ + + + + + + + To Dos! + + + + + +
    +

    {{ headline }}

    + +
    + + + +
    + +
    +
    + +

    Incompleted Tasks

    + +
      +
    • + + {{toDo.name}} + + + + + +
    • + +
    + + +
    +
    + + +

    Completed Tasks

    + +
      +
    • + + {{toDo.name}} + + + + + +
    • + +
    + +
    +
    + +

    Mark Complete

    + +
    + + + +
    + +
    +
    + +

    Mark Incomplete

    + +
    + + + +
    + +
    +
    + +

    Remove

    + +
    + + + +
    + + + + +
    + + + + + + \ No newline at end of file From 73937fee03876d21ae11114793ae41d56f46d248 Mon Sep 17 00:00:00 2001 From: logandouglass Date: Mon, 23 May 2022 18:54:55 -0400 Subject: [PATCH 05/11] finished --- code/logan/javascript/lab04/index.html | 32 +++++-------- code/logan/javascript/lab04/script.js | 64 +++++++++++++++++++++----- 2 files changed, 65 insertions(+), 31 deletions(-) diff --git a/code/logan/javascript/lab04/index.html b/code/logan/javascript/lab04/index.html index c21f3fea..a761f52e 100644 --- a/code/logan/javascript/lab04/index.html +++ b/code/logan/javascript/lab04/index.html @@ -10,27 +10,22 @@ - +
    +

    {{headline}}

    -

    {{headline}}

    - - - -

    -

    {{faveQ}}

    -

    {{qAuthor}}

    +

    {{faveQ}}

    +

    - {{qAuthor}}


    -

    Random Quotes

    +

    Random Quotes

  • {{quote}} @@ -45,25 +40,22 @@

    Random Quotes

    -
    +
    -
  • - {{quote.body}} -
  • - -
    - +

    {{results}}

    +
  • + {{quote.body}} +
  • +
    +
    - - - {{sQuoteData}}
    diff --git a/code/logan/javascript/lab04/script.js b/code/logan/javascript/lab04/script.js index daf5879e..176545b9 100644 --- a/code/logan/javascript/lab04/script.js +++ b/code/logan/javascript/lab04/script.js @@ -12,9 +12,10 @@ const App = { searchTerm: "", error: "", sQuoteData: undefined, - pagButton: undefined, + pagButton: false, pagData: undefined, pagCounter: 1, + results: "", } }, @@ -26,8 +27,6 @@ const App = { i++ this.getQuote() } - - }, methods: { @@ -53,8 +52,10 @@ const App = { })}, // heavily indebted to that Pete code searchQuote () { + this.pagButton = false this.pagCounter = 1 this.error = '' + this.results = "Results" axios({ method: 'get', url: this.baseURL, @@ -66,25 +67,66 @@ const App = { this.sQuotes = res.data.quotes // might need to fool with this .results this.sQuoteData = res.data this.pagData = res.data.last_page - + // alert(this.pagData) + if (this.pagData === false){ + this.pagButton = true} }).catch(err => this.error = err.message) // .catch will run if an error occurs // alert(this.fQuotes) // .finally(() => alert('finally ran')) // .finally is always going to run}, - + // alert(this.pagData) + // if (this.pagData === false){ + // alert("conditional tripped")} + // this.pagButton = "dog" - if (this.pagData === false){ - this.pagButton = [1] - } + // if (this.pagData == false){ + // this.pagButton = true} + + + /////////// + + + + // alert("we here") }, nextPage () { + this.error = '' + this.pagCounter += 1 + // alert("this is working") + axios({ + method: 'get', + url: this.baseURL, + headers: { Accept: 'application/json', Authorization: "Token token=75781e1e8edbf2eb68848384abbbd2bb"}, // doesn't work + params: { filter: this.searchTerm, page: this.pagCounter}, + }).then(res => { + // throw new Error('Something went wrong. Please try again.') + console.log(res.data) + this.sQuotes = res.data.quotes // might need to fool with this .results + this.sQuoteData = res.data + this.pagData = res.data.last_page + if (this.pagData === false){ + this.pagButton = true} + else {pagButton = false} + + }).catch(err => this.error = err.message) // .catch will run if an error occurs + // alert(this.fQuotes) + // .finally(() => alert('finally ran')) // .finally is always going to run}, + + // this.pagButton = "dog" + + // if (this.pagData === false){ + // this.pagButton = true} + + /////////// + + + // else {this.pagButton = []} + +}}} - } -} -} const app = Vue.createApp(App) app.mount('#app') \ No newline at end of file From dc156a3bc173d2115c1be91d0392434f01d5c2b1 Mon Sep 17 00:00:00 2001 From: logandouglass Date: Mon, 23 May 2022 18:56:08 -0400 Subject: [PATCH 06/11] minor alteration --- code/logan/javascript/lab04/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/logan/javascript/lab04/index.html b/code/logan/javascript/lab04/index.html index a761f52e..89d2c752 100644 --- a/code/logan/javascript/lab04/index.html +++ b/code/logan/javascript/lab04/index.html @@ -4,7 +4,7 @@ - The Vue-tiful Game + Vue-tiful Quotations From e3375ccd714349756d03a1669909017014cc6f4b Mon Sep 17 00:00:00 2001 From: logandouglass Date: Tue, 24 May 2022 19:38:48 -0400 Subject: [PATCH 07/11] getting...somewhere? --- code/logan/javascript/lab04/script.js | 35 +----- .../javascript/minicapstone/capscript.js | 38 +++++++ .../javascript/minicapstone/capstone.html | 46 ++++++++ code/logan/javascript/trial/test.html | 81 ++++++++++++++ code/logan/javascript/trial/testscript.js | 102 ++++++++++++++++++ 5 files changed, 270 insertions(+), 32 deletions(-) create mode 100644 code/logan/javascript/minicapstone/capscript.js create mode 100644 code/logan/javascript/minicapstone/capstone.html create mode 100644 code/logan/javascript/trial/test.html create mode 100644 code/logan/javascript/trial/testscript.js diff --git a/code/logan/javascript/lab04/script.js b/code/logan/javascript/lab04/script.js index 176545b9..14a553b3 100644 --- a/code/logan/javascript/lab04/script.js +++ b/code/logan/javascript/lab04/script.js @@ -48,7 +48,7 @@ const App = { this.fQuotes.push(this.faveQ) - // alert(this.faveQ) + })}, // heavily indebted to that Pete code searchQuote () { @@ -64,31 +64,14 @@ const App = { }).then(res => { // throw new Error('Something went wrong. Please try again.') console.log(res.data) - this.sQuotes = res.data.quotes // might need to fool with this .results + this.sQuotes = res.data.quotes this.sQuoteData = res.data this.pagData = res.data.last_page - // alert(this.pagData) + if (this.pagData === false){ this.pagButton = true} }).catch(err => this.error = err.message) // .catch will run if an error occurs - // alert(this.fQuotes) - // .finally(() => alert('finally ran')) // .finally is always going to run}, - // alert(this.pagData) - // if (this.pagData === false){ - // alert("conditional tripped")} - - // this.pagButton = "dog" - - // if (this.pagData == false){ - // this.pagButton = true} - - - /////////// - - - - // alert("we here") }, nextPage () { @@ -111,19 +94,7 @@ const App = { else {pagButton = false} }).catch(err => this.error = err.message) // .catch will run if an error occurs - // alert(this.fQuotes) - // .finally(() => alert('finally ran')) // .finally is always going to run}, - - // this.pagButton = "dog" - - // if (this.pagData === false){ - // this.pagButton = true} - - /////////// - - - // else {this.pagButton = []} }}} diff --git a/code/logan/javascript/minicapstone/capscript.js b/code/logan/javascript/minicapstone/capscript.js new file mode 100644 index 00000000..94160525 --- /dev/null +++ b/code/logan/javascript/minicapstone/capscript.js @@ -0,0 +1,38 @@ +const App = { + // the data property is a function that returns an object + data() { + return { + message: 'Hello World', + baseURL: "https://imsea.herokuapp.com//api/1?q=", + imgFetch: undefined, + searchTerm: "", + + } + }, + + methods: { + getImg () { + axios({ + method: 'get', + url: this.baseURL + this.searchTerm, + headers: { Accept: 'application/json', }, + method: 'get', + params: null, + + }).then(res => { + // console.log({ 'this in .then': this }) // this is the Window if not in an arrow function + // this will still be the vue app if in an arrow function + + this.imgFetch = res.data // hmmm data + })}, + + + + + + }, + + + } + // this is how you create & mount the app in Vue 3: + Vue.createApp(App).mount('#app') \ No newline at end of file diff --git a/code/logan/javascript/minicapstone/capstone.html b/code/logan/javascript/minicapstone/capstone.html new file mode 100644 index 00000000..e6320d5f --- /dev/null +++ b/code/logan/javascript/minicapstone/capstone.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + Capstone + + + +
    + +

    {{message}}

    + + {{imgFetch}} + + + +
    + + + +
    + + + +
    + + + + + + + + \ No newline at end of file diff --git a/code/logan/javascript/trial/test.html b/code/logan/javascript/trial/test.html new file mode 100644 index 00000000..516a4810 --- /dev/null +++ b/code/logan/javascript/trial/test.html @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + Capstone + + + +
    + +

    {{message}}

    + +

    + {{urlFetch}}

    + + {{breedList}}

    + {{breedIDList}}

    + {{shortDict}}

    +

    + +
    +
    + +
    + +
    + + + +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + \ No newline at end of file diff --git a/code/logan/javascript/trial/testscript.js b/code/logan/javascript/trial/testscript.js new file mode 100644 index 00000000..f9e28d82 --- /dev/null +++ b/code/logan/javascript/trial/testscript.js @@ -0,0 +1,102 @@ +const App = { + // the data property is a function that returns an object + data() { + return { + message: 'Cats! (under construction)', + baseURL: " https://api.thecatapi.com/v1/images/search", + breedURL: "https://api.thecatapi.com/v1/breeds", + catFetch: undefined, + urlFetch: undefined, + imgObj: undefined, + searchTerm: "", + imgURLs: [], + breedData: undefined, + breedList: [], + breedIDList: [], + breedDict: {}, + shortDict: {}, + // newKey: undefined, + // newVal: undefined, + // select: document.getElementById("selectBreed"), + + } + }, + created () { + this.breedGrab() + // for(let i = 0; i < this.breedList.length; i++) { + // var opt = this.breedList[i]; + // var el = document.createElement("option"); + // el.textContent = opt; + // el.value = opt; + // this.select.appendChild(el); + // } + // didn't work + let i = 0 // under construction might not work + + + + }, + + methods: { + getCat () { + axios({ + url: this.baseURL, + headers: { Accept: 'application/json', Authorization:"9bf907ff-5c70-40c1-93a1-16d55b35d6bb" }, + method: 'get', + + }).then(res => { + this.catFetch = res.data // + this.urlFetch = this.catFetch[0].url + this.imgObj = {"url": this.urlFetch} + this.imgURLs.push(this.imgObj) + + + + })}, + + + + + + + + searchCat () { + axios({ + url: this.baseURL, + headers: { Accept: 'application/json', Authorization:"9bf907ff-5c70-40c1-93a1-16d55b35d6bb" }, + method: 'get', + parameters: "", + + }).then(res => { + + + })}, + + breedGrab () { + axios({ + url: this.breedURL, + headers: { Accept: 'application/json', Authorization:"9bf907ff-5c70-40c1-93a1-16d55b35d6bb" }, + method: 'get', + + }).then(res => { + this.breedData = res.data + let i = 0 + while (i < this.breedData.length) { + this.breedList.push(this.breedData[i].name) + i++} + i = 0 + while (i < this.breedData.length) { + this.breedIDList.push(this.breedData[i].id) + i++} + + + })}, + + + + }, + + + } + // this is how you create & mount the app in Vue 3: + Vue.createApp(App).mount('#app') \ No newline at end of file From 2f61b205e5be1ea9db4664731344099f5dee329b Mon Sep 17 00:00:00 2001 From: logandouglass Date: Wed, 25 May 2022 18:36:13 -0400 Subject: [PATCH 08/11] cat judger online --- code/logan/javascript/trial/test.html | 39 ++++++++++++++++++++--- code/logan/javascript/trial/testscript.js | 16 +++++++++- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/code/logan/javascript/trial/test.html b/code/logan/javascript/trial/test.html index 516a4810..080bb873 100644 --- a/code/logan/javascript/trial/test.html +++ b/code/logan/javascript/trial/test.html @@ -21,7 +21,7 @@
    -

    {{message}}

    +

    {{message}}

    {{urlFetch}}

    @@ -32,7 +32,38 @@

    {{message}}


    -
    + +
    + +
    + +

    Hall of Fame

    + + +
    + +
    + +

    Hall of Shame

    + + +
    + + + +
    + + +
    +

    Random Cat

    + + + +
    + + + +
    @@ -41,12 +72,12 @@

    {{message}}

    - +
    - + diff --git a/code/logan/javascript/trial/testscript.js b/code/logan/javascript/trial/testscript.js index f9e28d82..263d9869 100644 --- a/code/logan/javascript/trial/testscript.js +++ b/code/logan/javascript/trial/testscript.js @@ -2,7 +2,7 @@ const App = { // the data property is a function that returns an object data() { return { - message: 'Cats! (under construction)', + message: 'CAT JUDGMENT', baseURL: " https://api.thecatapi.com/v1/images/search", breedURL: "https://api.thecatapi.com/v1/breeds", catFetch: undefined, @@ -10,11 +10,14 @@ const App = { imgObj: undefined, searchTerm: "", imgURLs: [], + hallOfFame: [], + hallOfShame: [], breedData: undefined, breedList: [], breedIDList: [], breedDict: {}, shortDict: {}, + clickCheck: false // newKey: undefined, // newVal: undefined, // select: document.getElementById("selectBreed"), @@ -39,6 +42,8 @@ const App = { methods: { getCat () { + this.imgURLs = [] + this.clickCheck=true axios({ url: this.baseURL, headers: { Accept: 'application/json', Authorization:"9bf907ff-5c70-40c1-93a1-16d55b35d6bb" }, @@ -91,6 +96,15 @@ const App = { })}, + rFame () { + this.hallOfFame.push(this.imgObj) + + }, + + rShame () { + this.hallOfShame.push(this.imgObj) + + }, From 505779712d6fb37e59e75ae0a4dd6e8765b46d7f Mon Sep 17 00:00:00 2001 From: logandouglass Date: Wed, 25 May 2022 18:42:31 -0400 Subject: [PATCH 09/11] testing --- .../javascript/minicapstone/capscript.js | 38 ------ .../javascript/minicapstone/capstone.html | 46 ------- code/logan/javascript/minicapstone/test.html | 112 +++++++++++++++++ .../javascript/minicapstone/testscript.js | 116 ++++++++++++++++++ code/logan/javascript/trial/test.html | 4 +- 5 files changed, 230 insertions(+), 86 deletions(-) delete mode 100644 code/logan/javascript/minicapstone/capscript.js delete mode 100644 code/logan/javascript/minicapstone/capstone.html create mode 100644 code/logan/javascript/minicapstone/test.html create mode 100644 code/logan/javascript/minicapstone/testscript.js diff --git a/code/logan/javascript/minicapstone/capscript.js b/code/logan/javascript/minicapstone/capscript.js deleted file mode 100644 index 94160525..00000000 --- a/code/logan/javascript/minicapstone/capscript.js +++ /dev/null @@ -1,38 +0,0 @@ -const App = { - // the data property is a function that returns an object - data() { - return { - message: 'Hello World', - baseURL: "https://imsea.herokuapp.com//api/1?q=", - imgFetch: undefined, - searchTerm: "", - - } - }, - - methods: { - getImg () { - axios({ - method: 'get', - url: this.baseURL + this.searchTerm, - headers: { Accept: 'application/json', }, - method: 'get', - params: null, - - }).then(res => { - // console.log({ 'this in .then': this }) // this is the Window if not in an arrow function - // this will still be the vue app if in an arrow function - - this.imgFetch = res.data // hmmm data - })}, - - - - - - }, - - - } - // this is how you create & mount the app in Vue 3: - Vue.createApp(App).mount('#app') \ No newline at end of file diff --git a/code/logan/javascript/minicapstone/capstone.html b/code/logan/javascript/minicapstone/capstone.html deleted file mode 100644 index e6320d5f..00000000 --- a/code/logan/javascript/minicapstone/capstone.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - Capstone - - - -
    - -

    {{message}}

    - - {{imgFetch}} - - - -
    - - - -
    - - - -
    - - - - - - - - \ No newline at end of file diff --git a/code/logan/javascript/minicapstone/test.html b/code/logan/javascript/minicapstone/test.html new file mode 100644 index 00000000..1bcfbfb4 --- /dev/null +++ b/code/logan/javascript/minicapstone/test.html @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + Capstone + + + +
    + +

    {{message}}

    + +

    + {{urlFetch}}

    + + {{breedList}}

    + {{breedIDList}}

    + {{shortDict}}

    +

    + +
    + +
    + +
    + +

    Hall of Fame

    + + +
    + +
    + +

    Hall of Shame

    + + +
    + + + +
    + + +
    +

    Random Cat

    + + + +
    + + + +
    + +
    + +
    + + + +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + \ No newline at end of file diff --git a/code/logan/javascript/minicapstone/testscript.js b/code/logan/javascript/minicapstone/testscript.js new file mode 100644 index 00000000..263d9869 --- /dev/null +++ b/code/logan/javascript/minicapstone/testscript.js @@ -0,0 +1,116 @@ +const App = { + // the data property is a function that returns an object + data() { + return { + message: 'CAT JUDGMENT', + baseURL: " https://api.thecatapi.com/v1/images/search", + breedURL: "https://api.thecatapi.com/v1/breeds", + catFetch: undefined, + urlFetch: undefined, + imgObj: undefined, + searchTerm: "", + imgURLs: [], + hallOfFame: [], + hallOfShame: [], + breedData: undefined, + breedList: [], + breedIDList: [], + breedDict: {}, + shortDict: {}, + clickCheck: false + // newKey: undefined, + // newVal: undefined, + // select: document.getElementById("selectBreed"), + + } + }, + created () { + this.breedGrab() + // for(let i = 0; i < this.breedList.length; i++) { + // var opt = this.breedList[i]; + // var el = document.createElement("option"); + // el.textContent = opt; + // el.value = opt; + // this.select.appendChild(el); + // } + // didn't work + let i = 0 // under construction might not work + + + + }, + + methods: { + getCat () { + this.imgURLs = [] + this.clickCheck=true + axios({ + url: this.baseURL, + headers: { Accept: 'application/json', Authorization:"9bf907ff-5c70-40c1-93a1-16d55b35d6bb" }, + method: 'get', + + }).then(res => { + this.catFetch = res.data // + this.urlFetch = this.catFetch[0].url + this.imgObj = {"url": this.urlFetch} + this.imgURLs.push(this.imgObj) + + + + })}, + + + + + + + + searchCat () { + axios({ + url: this.baseURL, + headers: { Accept: 'application/json', Authorization:"9bf907ff-5c70-40c1-93a1-16d55b35d6bb" }, + method: 'get', + parameters: "", + + }).then(res => { + + + })}, + + breedGrab () { + axios({ + url: this.breedURL, + headers: { Accept: 'application/json', Authorization:"9bf907ff-5c70-40c1-93a1-16d55b35d6bb" }, + method: 'get', + + }).then(res => { + this.breedData = res.data + let i = 0 + while (i < this.breedData.length) { + this.breedList.push(this.breedData[i].name) + i++} + i = 0 + while (i < this.breedData.length) { + this.breedIDList.push(this.breedData[i].id) + i++} + + + })}, + rFame () { + this.hallOfFame.push(this.imgObj) + + }, + + rShame () { + this.hallOfShame.push(this.imgObj) + + }, + + + + }, + + + } + // this is how you create & mount the app in Vue 3: + Vue.createApp(App).mount('#app') \ No newline at end of file diff --git a/code/logan/javascript/trial/test.html b/code/logan/javascript/trial/test.html index 080bb873..1bcfbfb4 100644 --- a/code/logan/javascript/trial/test.html +++ b/code/logan/javascript/trial/test.html @@ -71,8 +71,8 @@

    Random Cat

    -
    - +
    +
    From 834a8c8c1ce0d4d0a1819781fc9808a7676b4b48 Mon Sep 17 00:00:00 2001 From: logandouglass Date: Wed, 25 May 2022 19:30:00 -0400 Subject: [PATCH 10/11] search breed not working :( :( everything else is a go... --- .../minicapstone/{test.html => minicap.html} | 24 ++++++------- .../javascript/minicapstone/testscript.js | 35 +++++++++++-------- 2 files changed, 31 insertions(+), 28 deletions(-) rename code/logan/javascript/minicapstone/{test.html => minicap.html} (84%) diff --git a/code/logan/javascript/minicapstone/test.html b/code/logan/javascript/minicapstone/minicap.html similarity index 84% rename from code/logan/javascript/minicapstone/test.html rename to code/logan/javascript/minicapstone/minicap.html index 1bcfbfb4..16b84823 100644 --- a/code/logan/javascript/minicapstone/test.html +++ b/code/logan/javascript/minicapstone/minicap.html @@ -22,18 +22,11 @@

    {{message}}

    - -

    - {{urlFetch}}

    - - {{breedList}}

    - {{breedIDList}}

    - {{shortDict}}

    -

    - + +
    -
    +
    @@ -55,7 +48,7 @@

    Hall of Shame

    -

    Random Cat

    +

    Judge Me

    @@ -69,11 +62,16 @@

    Random Cat


    + +
    + +

    FUN FACTS BY BREED

    - -
    +
    +
    +
    diff --git a/code/logan/javascript/minicapstone/testscript.js b/code/logan/javascript/minicapstone/testscript.js index 263d9869..655bf66c 100644 --- a/code/logan/javascript/minicapstone/testscript.js +++ b/code/logan/javascript/minicapstone/testscript.js @@ -5,6 +5,8 @@ const App = { message: 'CAT JUDGMENT', baseURL: " https://api.thecatapi.com/v1/images/search", breedURL: "https://api.thecatapi.com/v1/breeds", + breedSearchURL: "https://api.thecatapi.com/v1/breeds/search", + breedParam: undefined, catFetch: undefined, urlFetch: undefined, imgObj: undefined, @@ -17,7 +19,8 @@ const App = { breedIDList: [], breedDict: {}, shortDict: {}, - clickCheck: false + clickCheck: false, + desc: undefined, // newKey: undefined, // newVal: undefined, // select: document.getElementById("selectBreed"), @@ -26,17 +29,6 @@ const App = { }, created () { this.breedGrab() - // for(let i = 0; i < this.breedList.length; i++) { - // var opt = this.breedList[i]; - // var el = document.createElement("option"); - // el.textContent = opt; - // el.value = opt; - // this.select.appendChild(el); - // } - // didn't work - let i = 0 // under construction might not work - - }, @@ -65,14 +57,27 @@ const App = { - searchCat () { + searchCat (breed) { + this.imgURLs = [] + let i = this.breedList.indexOf(breed) + this.breedParam = this.breedIDList[i] + // alert(this.breedParam) + this.clickCheck=true + + axios({ - url: this.baseURL, + url: this.breedSearchURL, + // url: this.baseURL, headers: { Accept: 'application/json', Authorization:"9bf907ff-5c70-40c1-93a1-16d55b35d6bb" }, method: 'get', - parameters: "", + parameters: {q:this.breedParam}, }).then(res => { + this.catFetch = res.data // + alert(this.catFetch) + // this.urlFetch = this.catFetch[0].url + // this.imgObj = {"url": this.urlFetch} + // this.imgURLs.push(this.imgObj) })}, From 85074e335c8edba430b2746f9977df1bcdc6f8d2 Mon Sep 17 00:00:00 2001 From: logandouglass Date: Thu, 26 May 2022 15:37:36 -0400 Subject: [PATCH 11/11] done for now --- code/logan/javascript/minicapstone/minicap.html | 5 +++++ code/logan/javascript/minicapstone/testscript.js | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/code/logan/javascript/minicapstone/minicap.html b/code/logan/javascript/minicapstone/minicap.html index 16b84823..39be0eef 100644 --- a/code/logan/javascript/minicapstone/minicap.html +++ b/code/logan/javascript/minicapstone/minicap.html @@ -23,6 +23,7 @@

    {{message}}

    +
    @@ -66,6 +67,10 @@

    Judge Me


    FUN FACTS BY BREED

    + +
    diff --git a/code/logan/javascript/minicapstone/testscript.js b/code/logan/javascript/minicapstone/testscript.js index 655bf66c..abe80aae 100644 --- a/code/logan/javascript/minicapstone/testscript.js +++ b/code/logan/javascript/minicapstone/testscript.js @@ -6,6 +6,7 @@ const App = { baseURL: " https://api.thecatapi.com/v1/images/search", breedURL: "https://api.thecatapi.com/v1/breeds", breedSearchURL: "https://api.thecatapi.com/v1/breeds/search", + breedSearchURLAlt: "https://api.thecatapi.com/v1/breeds/search?q=", breedParam: undefined, catFetch: undefined, urlFetch: undefined, @@ -68,13 +69,15 @@ const App = { axios({ url: this.breedSearchURL, // url: this.baseURL, + // url: this.breedSearchURLAlt, headers: { Accept: 'application/json', Authorization:"9bf907ff-5c70-40c1-93a1-16d55b35d6bb" }, method: 'get', - parameters: {q:this.breedParam}, + params: {q:this.breedParam}, }).then(res => { this.catFetch = res.data // - alert(this.catFetch) + this.desc = this.catFetch[0].description + // alert(this.catFetch) // this.urlFetch = this.catFetch[0].url // this.imgObj = {"url": this.urlFetch} // this.imgURLs.push(this.imgObj)