Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial commit for submission #444

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node server.js
28 changes: 28 additions & 0 deletions data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"fun facts": [
{
"dogs": [
{
"fun fact 1": "a dog's sense of smell is at least 40 times better than ours. they have upwards of 300 million olfactory receptors in their noses.",
"fun fact 2": "Dogs can sniff while they breathe. Their noses are designed so air can move in and out at the same time, unlike us humans who have to either breathe in OR out only."
}
]
},
{
"cats": [
{
"fun fact 1": "We have 206 bones - cats on average have 244.",
"fun fact 2": "A house cat is genetically 95.6% Tiger."
}
]
},
{
"tattoos": [
{
"fun fact 1":"During a tattoo session, our skin gets pricked anywhere between 50 to 3000 times each miinute.",
"fun fact 2":"The first tattoo machine was created in 1891 and got its inspiration from Thomas Edison's electric pen."
}
]
}
]
}
30 changes: 30 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>

<body>
<section class="intro">
<h1>Did you know....</h1>
<p>that fun facts are...well FUN! Click on a button below to grab a random fun fact about the subject you are
interested in!</p>
</section>
<section>
<button id="dogs" onclick="apiRequest(this.id)">Dogs</button>
<button id="cats" onclick="apiRequest(this.id)">Cats</button>
<button id="tattoos" onclick="apiRequest(this.id)">Tattoos</button>
<button id="planet" onclick="apiRequest(this.id)">Planet Earth</button>
</section>
<section>
<h2></h2>
</section>
<script src="js/main.js"></script>
</body>


</html>
28 changes: 28 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
alert('working')

/*const sources = ['https://www.pdsa.org.uk/what-we-do/blog/10-amazing-facts-about-dogs']

async function apiRequest(clickID){
let subject = clickID
try{
const res = await fetch(`https://mb-fun-fact-api.herokuapp.com/api/${subject}`)
const data = await res.json()

console.log(data)
console.log(document.querySelector('h2').innerHTML = data[randomFact()])
}catch(error){
console.log(error)
}
}

function randomFact() {
let funFact = Math.random()

if (funFact < .5){
return 'fun fact 1'
} else {
return 'fun fact 2'
}
}

console.log("Sources I used for fun facts:", sources)*/
Loading