Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ananyag309 authored Aug 10, 2024
1 parent 44c094b commit e4929fe
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
40 changes: 40 additions & 0 deletions New_APIs/Cat API/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
width: 300px;
height: 300px;
background: url('Cat.jpg') no-repeat center center;
background-size: cover;
display: flex;
justify-content: center;
align-items: center;
}
.container {
padding: 8px;
border-radius: 0.5rem;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.Dog {
display: inline-flex;
margin: auto 10px;
font-size: 1.125rem;
color: #cc8c2b; /* blue-500 */
border-radius: 0.5rem;
border: 1px solid rgb(236, 229, 128);
padding: 10px;
background-color: white;
}
</style>
<title>Random Cat</title>
</head>
<body>
<div class="container">
<p id="DogElement" class="Dog">Loading...</p>
</div>
<script src="script.js"></script>
</body>
</html>
12 changes: 12 additions & 0 deletions New_APIs/Cat API/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Cat facts",
"version": "0.0.1",
"manifest_version": 2,
"browser_action": {
"default_popup": "index.html",
"default_icon": "Cat.png"
},
"icons": {
"128": "Cat.png"
}
}
10 changes: 10 additions & 0 deletions New_APIs/Cat API/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
document.addEventListener('DOMContentLoaded', () => {
fetch('https://catapi./api/v2/facts')
.then(response => response.json())
.then(DogData => {
const DogText = DogData.data[0].attributes.body;
const DogElement = document.getElementById('DogElement');
DogElement.innerHTML = DogText;
})
.catch(error => console.error('Error fetching the Dog:', error));
});

0 comments on commit e4929fe

Please sign in to comment.