-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5da5aa4
commit b1f292f
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//Namespace for zeldaApp | ||
const zeldaApp = {}; | ||
|
||
//URL | ||
zeldaApp.url = 'https://botw-compendium.herokuapp.com/api/v2/category/creatures'; | ||
|
||
//creat a method to get data from URL | ||
zeldaApp.getInfo=()=>{ | ||
//AJAX request | ||
|
||
const appUrl=new URL(zeldaApp.url); | ||
// console.log(appUrl) | ||
|
||
//fetch data | ||
fetch(appUrl) | ||
.then((apiPromise)=>{ | ||
return apiPromise.json() | ||
}) | ||
.then((data)=>{ | ||
console.log(data) | ||
}) | ||
} | ||
|
||
|
||
//Change visibility of question and answer sections-display:none | ||
|
||
//Click a button “Start Game” to display qustion section | ||
|
||
//When users finish the question, click a button “Show me” then display answer section | ||
|
||
// Display card with: | ||
// Img | ||
// Name | ||
// Location | ||
// description | ||
|
||
|
||
//init menthod | ||
zeldaApp.init = ()=>{ | ||
zeldaApp.getInfo() | ||
} | ||
//call init | ||
zeldaApp.init() | ||
|
||
|
||
// - Click a button “Start Game” to display a multiple choice question for users to choose: | ||
// One answer of the question leads to the food category and another leads to the nonfood category. | ||
// If = Selected // Food = random generate creature under food | ||
// Else if = Selected // Non-Food = random generate creature under food | ||
// Else = A third answer “Whatever” leads to a random character regardless of food/non food category. | ||
|
||
// - When users finish the question, click a button “You’re…” then randomly generate a character form the category they chose. [Array method .filter()] | ||
// Display create card with: | ||
// Img | ||
// Name | ||
// Location | ||
// description | ||
|
||
// - Create an app object (zeldaApp)//Namespace for app. | ||
|
||
// - Store input information in a variable inside a method. | ||
|
||
// - Create a method to get data from API(zeldaApp.getCharacter), and a if statement to make a validation to prevent submitting form without input(s). | ||
|
||
|
||
|
||
// - When API call is successful, display the a card info with character by looping through each result, rendering * HTML elements for character name, picture, common locations, description. | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.