Spaces:
Running
Running
Update index.html
Browse files- index.html +93 -18
index.html
CHANGED
|
@@ -1,19 +1,94 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>GitHub Scanner and Code Optimizer</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
</head>
|
| 9 |
+
<body class="bg-gray-100">
|
| 10 |
+
<div class="container mx-auto p-8">
|
| 11 |
+
<h1 class="text-3xl font-semibold mb-4 text-gray-800">GitHub Scanner and Code Optimizer</h1>
|
| 12 |
+
|
| 13 |
+
<div class="mb-6">
|
| 14 |
+
<label for="githubUrl" class="block text-gray-700 text-sm font-bold mb-2">GitHub Repository URL:</label>
|
| 15 |
+
<input type="text" id="githubUrl" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" placeholder="https://github.com/user/repo">
|
| 16 |
+
</div>
|
| 17 |
+
|
| 18 |
+
<button id="scanButton" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">
|
| 19 |
+
Scan Repository
|
| 20 |
+
</button>
|
| 21 |
+
|
| 22 |
+
<div id="scanResults" class="mt-8 hidden">
|
| 23 |
+
<h2 class="text-2xl font-semibold mb-2 text-gray-800">Scan Results</h2>
|
| 24 |
+
<ul id="scanResultsList" class="list-disc pl-5 text-gray-700"></ul>
|
| 25 |
+
</div>
|
| 26 |
+
|
| 27 |
+
<div id="optimizationSuggestions" class="mt-8 hidden">
|
| 28 |
+
<h2 class="text-2xl font-semibold mb-2 text-gray-800">Optimization Suggestions</h2>
|
| 29 |
+
<ul id="optimizationList" class="list-disc pl-5 text-gray-700"></ul>
|
| 30 |
+
</div>
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
<script>
|
| 34 |
+
const scanButton = document.getElementById('scanButton');
|
| 35 |
+
const githubUrlInput = document.getElementById('githubUrl');
|
| 36 |
+
const scanResultsDiv = document.getElementById('scanResults');
|
| 37 |
+
const scanResultsList = document.getElementById('scanResultsList');
|
| 38 |
+
const optimizationDiv = document.getElementById('optimizationSuggestions');
|
| 39 |
+
const optimizationList = document.getElementById('optimizationList');
|
| 40 |
+
|
| 41 |
+
scanButton.addEventListener('click', async () => {
|
| 42 |
+
const githubUrl = githubUrlInput.value.trim();
|
| 43 |
+
if (!githubUrl) {
|
| 44 |
+
alert('Please enter a GitHub repository URL.');
|
| 45 |
+
return;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
scanButton.textContent = 'Scanning...';
|
| 49 |
+
scanButton.disabled = true;
|
| 50 |
+
|
| 51 |
+
// Clear previous results
|
| 52 |
+
scanResultsList.innerHTML = '';
|
| 53 |
+
optimizationList.innerHTML = '';
|
| 54 |
+
scanResultsDiv.classList.add('hidden');
|
| 55 |
+
optimizationDiv.classList.add('hidden');
|
| 56 |
+
|
| 57 |
+
// Simulate scan delay
|
| 58 |
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
| 59 |
+
|
| 60 |
+
const dummyScanResults = [
|
| 61 |
+
"Potential security vulnerability: Use of eval() function.",
|
| 62 |
+
"Code complexity detected in module A.",
|
| 63 |
+
"Unused variable found in component B."
|
| 64 |
+
];
|
| 65 |
+
|
| 66 |
+
const dummyOptimizationSuggestions = [
|
| 67 |
+
"Replace eval() with safer alternative.",
|
| 68 |
+
"Refactor module A to reduce complexity.",
|
| 69 |
+
"Remove unused variable in component B.",
|
| 70 |
+
"Consider using memoization for component C."
|
| 71 |
+
];
|
| 72 |
+
|
| 73 |
+
// Display Scan Results
|
| 74 |
+
dummyScanResults.forEach(result => {
|
| 75 |
+
const li = document.createElement('li');
|
| 76 |
+
li.textContent = result;
|
| 77 |
+
scanResultsList.appendChild(li);
|
| 78 |
+
});
|
| 79 |
+
scanResultsDiv.classList.remove('hidden');
|
| 80 |
+
|
| 81 |
+
// Display Optimization Suggestions
|
| 82 |
+
dummyOptimizationSuggestions.forEach(suggestion => {
|
| 83 |
+
const li = document.createElement('li');
|
| 84 |
+
li.textContent = suggestion;
|
| 85 |
+
optimizationList.appendChild(li);
|
| 86 |
+
});
|
| 87 |
+
optimizationDiv.classList.remove('hidden');
|
| 88 |
+
|
| 89 |
+
scanButton.textContent = 'Scan Repository';
|
| 90 |
+
scanButton.disabled = false;
|
| 91 |
+
});
|
| 92 |
+
</script>
|
| 93 |
+
</body>
|
| 94 |
</html>
|