forked from Sulagna-Dutta-Roy/GGExtensions
-
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
f7f6cb1
commit d416d57
Showing
5 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "APOD Extension", | ||
"description": "Shows the Astronomy Picture of the Day", | ||
"version": "1.0", | ||
"action": { | ||
"default_popup": "popup.html", | ||
"default_icon": "galaxy.png" | ||
}, | ||
"permissions": [ | ||
"https://api.nasa.gov/" | ||
] | ||
} | ||
|
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,36 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
margin: 0; | ||
padding: 10px; | ||
width: 300px; | ||
background-color: #1a1a1a; | ||
color: #ffffff; | ||
} | ||
|
||
#content { | ||
text-align: center; | ||
} | ||
|
||
#image-container { | ||
margin: 10px 0; | ||
} | ||
|
||
#apod-image { | ||
max-width: 100%; | ||
height: auto; | ||
border: 2px solid #ffffff; | ||
} | ||
|
||
#details { | ||
text-align: left; | ||
} | ||
|
||
#title { | ||
font-size: 1.2em; | ||
margin: 10px 0; | ||
} | ||
|
||
#description { | ||
font-size: 0.9em; | ||
} | ||
|
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,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Astronomy Picture of the Day</title> | ||
<link rel="stylesheet" type="text/css" href="popup.css"> | ||
</head> | ||
<body> | ||
<div id="content"> | ||
<h1>Astronomy Picture of the Day</h1> | ||
<div id="image-container"> | ||
<img id="apod-image" src="" alt="Astronomy Picture of the Day"> | ||
</div> | ||
<div id="details"> | ||
<h2 id="title"></h2> | ||
<p id="description"></p> | ||
</div> | ||
</div> | ||
<script src="popup.js"></script> | ||
</body> | ||
</html> |
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,14 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
const apiKey = 'DEMO_KEY'; // Replace with your NASA API key | ||
const apiURL = `https://api.nasa.gov/planetary/apod?api_key=${apiKey}`; | ||
|
||
fetch(apiURL) | ||
.then(response => response.json()) | ||
.then(data => { | ||
document.getElementById('apod-image').src = data.url; | ||
document.getElementById('title').textContent = data.title; | ||
document.getElementById('description').textContent = data.explanation; | ||
}) | ||
.catch(error => console.error('Error fetching the APOD:', error)); | ||
}); | ||
|