-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2484 from AsmitaMishra24/master
Added Github Repository Analyzer
- Loading branch information
Showing
7 changed files
with
145 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,26 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Github Repository Analyzer</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Github Repository Analyzer</h1> | ||
<form id="repo-form"> | ||
<label for="owner">Repository Owner:</label> | ||
<input type="text" id="owner" name="owner" required> | ||
|
||
<label for="repo">Repository Name:</label> | ||
<input type="text" id="repo" name="repo" required> | ||
|
||
<button type="submit">Analyzer</button> | ||
</form> | ||
|
||
<div id="results"></div> | ||
</div> | ||
<script src="script.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,26 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "GitHub Repository Analyzer", | ||
"version": "1.0", | ||
"description": "Analyze GitHub repositories from your browser.", | ||
"permissions": [ | ||
"activeTab" | ||
], | ||
"host_permissions": [ | ||
"https://api.github.com/*" | ||
], | ||
"action": { | ||
"default_popup": "index.html", | ||
"default_icon": { | ||
"16": "icon16.png", | ||
"48": "icon48.png", | ||
"128": "icon128.png" | ||
} | ||
}, | ||
"icons": { | ||
"16": "icon16.png", | ||
"48": "icon48.png", | ||
"128": "icon128.png" | ||
} | ||
} | ||
|
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,45 @@ | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const form = document.getElementById('repo-form'); | ||
const resultsDiv = document.getElementById('results'); | ||
|
||
if (!form || !resultsDiv) { | ||
console.error('Form or results container not found.'); | ||
return; | ||
} | ||
|
||
form.addEventListener('submit', async (event) => { | ||
event.preventDefault(); | ||
|
||
const ownerInput = document.getElementById('owner'); | ||
const repoInput = document.getElementById('repo'); | ||
|
||
if (!ownerInput || !repoInput) { | ||
console.error('Owner or repo input fields not found.'); | ||
return; | ||
} | ||
|
||
const owner = ownerInput.value.trim(); //ownerInput if null then error | ||
const repo = repoInput.value.trim(); //repoInput if null then error | ||
|
||
resultsDiv.innerHTML = 'Loading...'; | ||
|
||
try { | ||
const response = await fetch(`https://api.github.com/repos/${owner}/${repo}`); | ||
if (!response.ok) throw new Error('Repository not found'); | ||
|
||
const repoData = await response.json(); | ||
|
||
resultsDiv.innerHTML = ` | ||
<h2>Repository Details</h2> | ||
<p><strong>Name:</strong> ${repoData.name}</p> | ||
<p><strong>Description:</strong> ${repoData.description || 'No description available'}</p> | ||
<p><strong>Stars:</strong> ${repoData.stargazers_count}</p> | ||
<p><strong>Forks:</strong> ${repoData.forks_count}</p> | ||
<p><strong>Open Issues:</strong> ${repoData.open_issues_count}</p> | ||
<p><strong>Language:</strong> ${repoData.language || 'Not specified'}</p> | ||
`; | ||
} catch (error) { | ||
resultsDiv.innerHTML = `<p>Error: ${error.message}</p>`; | ||
} | ||
}); | ||
}); |
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,48 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
width: 300px; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.container { | ||
padding: 20px; | ||
} | ||
|
||
h1 { | ||
font-size: 16px; | ||
margin-bottom: 10px; | ||
} | ||
|
||
form { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
label { | ||
margin: 5px 0; | ||
} | ||
|
||
input { | ||
padding: 5px; | ||
margin-bottom: 10px; | ||
border: 1px solid #ddd; | ||
border-radius: 4px; | ||
} | ||
|
||
button { | ||
padding: 5px; | ||
background-color: #007bff; | ||
color: white; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} | ||
|
||
#results { | ||
margin-top: 10px; | ||
} |