Add 3 files
Browse files- README.md +7 -5
- index.html +428 -19
- prompts.txt +1 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: speedtest
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,428 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>Network Speed Test</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
.gauge {
|
| 11 |
+
position: relative;
|
| 12 |
+
width: 300px;
|
| 13 |
+
height: 150px;
|
| 14 |
+
margin: 0 auto;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
.gauge-body {
|
| 18 |
+
width: 100%;
|
| 19 |
+
height: 0;
|
| 20 |
+
padding-bottom: 50%;
|
| 21 |
+
position: relative;
|
| 22 |
+
border-top-left-radius: 100% 200%;
|
| 23 |
+
border-top-right-radius: 100% 200%;
|
| 24 |
+
overflow: hidden;
|
| 25 |
+
background: #e0e0e0;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.gauge-fill {
|
| 29 |
+
position: absolute;
|
| 30 |
+
top: 100%;
|
| 31 |
+
left: 0;
|
| 32 |
+
width: 100%;
|
| 33 |
+
height: 100%;
|
| 34 |
+
background: linear-gradient(90deg, #4ade80, #3b82f6, #ef4444);
|
| 35 |
+
transform-origin: center top;
|
| 36 |
+
transform: rotate(0.5turn);
|
| 37 |
+
transition: transform 0.5s ease-out;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
.gauge-cover {
|
| 41 |
+
width: 75%;
|
| 42 |
+
height: 150%;
|
| 43 |
+
background: white;
|
| 44 |
+
border-radius: 50%;
|
| 45 |
+
position: absolute;
|
| 46 |
+
top: 25%;
|
| 47 |
+
left: 50%;
|
| 48 |
+
transform: translateX(-50%);
|
| 49 |
+
display: flex;
|
| 50 |
+
align-items: center;
|
| 51 |
+
justify-content: center;
|
| 52 |
+
font-size: 1.5rem;
|
| 53 |
+
font-weight: bold;
|
| 54 |
+
color: #333;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.progress-bar {
|
| 58 |
+
height: 10px;
|
| 59 |
+
background-color: #e0e0e0;
|
| 60 |
+
border-radius: 5px;
|
| 61 |
+
overflow: hidden;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.progress-fill {
|
| 65 |
+
height: 100%;
|
| 66 |
+
background: linear-gradient(90deg, #4ade80, #3b82f6);
|
| 67 |
+
width: 0%;
|
| 68 |
+
transition: width 0.3s ease;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
@keyframes pulse {
|
| 72 |
+
0% { opacity: 1; }
|
| 73 |
+
50% { opacity: 0.5; }
|
| 74 |
+
100% { opacity: 1; }
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
.pulse {
|
| 78 |
+
animation: pulse 1.5s infinite;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
.test-btn {
|
| 82 |
+
transition: all 0.3s ease;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
.test-btn:hover {
|
| 86 |
+
transform: translateY(-2px);
|
| 87 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
| 88 |
+
}
|
| 89 |
+
</style>
|
| 90 |
+
</head>
|
| 91 |
+
<body class="bg-gray-50 min-h-screen flex flex-col">
|
| 92 |
+
<header class="bg-white shadow-sm py-4">
|
| 93 |
+
<div class="container mx-auto px-4">
|
| 94 |
+
<h1 class="text-3xl font-bold text-center text-indigo-600">
|
| 95 |
+
<i class="fas fa-tachometer-alt mr-2"></i>Network Speed Test
|
| 96 |
+
</h1>
|
| 97 |
+
</div>
|
| 98 |
+
</header>
|
| 99 |
+
|
| 100 |
+
<main class="flex-grow container mx-auto px-4 py-8">
|
| 101 |
+
<div class="max-w-3xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6">
|
| 102 |
+
<div class="text-center mb-8">
|
| 103 |
+
<h2 class="text-2xl font-semibold text-gray-800">Test Your Internet Speed</h2>
|
| 104 |
+
<p class="text-gray-600 mt-2">Measure your download, upload speed and ping</p>
|
| 105 |
+
</div>
|
| 106 |
+
|
| 107 |
+
<div class="flex flex-col md:flex-row justify-around items-center mb-8">
|
| 108 |
+
<div class="gauge mb-8 md:mb-0">
|
| 109 |
+
<div class="gauge-body">
|
| 110 |
+
<div class="gauge-fill" id="downloadGauge"></div>
|
| 111 |
+
</div>
|
| 112 |
+
<div class="gauge-cover" id="downloadSpeed">0 Mbps</div>
|
| 113 |
+
</div>
|
| 114 |
+
|
| 115 |
+
<div class="gauge">
|
| 116 |
+
<div class="gauge-body">
|
| 117 |
+
<div class="gauge-fill" id="uploadGauge"></div>
|
| 118 |
+
</div>
|
| 119 |
+
<div class="gauge-cover" id="uploadSpeed">0 Mbps</div>
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
|
| 123 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-8">
|
| 124 |
+
<div class="bg-gray-50 p-4 rounded-lg text-center">
|
| 125 |
+
<div class="text-gray-500 mb-1"><i class="fas fa-download mr-2"></i>Download</div>
|
| 126 |
+
<div class="text-2xl font-bold text-indigo-600" id="finalDownload">0 Mbps</div>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<div class="bg-gray-50 p-4 rounded-lg text-center">
|
| 130 |
+
<div class="text-gray-500 mb-1"><i class="fas fa-upload mr-2"></i>Upload</div>
|
| 131 |
+
<div class="text-2xl font-bold text-indigo-600" id="finalUpload">0 Mbps</div>
|
| 132 |
+
</div>
|
| 133 |
+
|
| 134 |
+
<div class="bg-gray-50 p-4 rounded-lg text-center">
|
| 135 |
+
<div class="text-gray-500 mb-1"><i class="fas fa-stopwatch mr-2"></i>Ping</div>
|
| 136 |
+
<div class="text-2xl font-bold text-indigo-600" id="pingResult">0 ms</div>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
|
| 140 |
+
<div class="mb-6">
|
| 141 |
+
<div class="flex justify-between mb-1">
|
| 142 |
+
<span class="text-gray-700">Test Progress</span>
|
| 143 |
+
<span class="text-gray-700" id="testStatus">Ready</span>
|
| 144 |
+
</div>
|
| 145 |
+
<div class="progress-bar">
|
| 146 |
+
<div class="progress-fill" id="testProgress"></div>
|
| 147 |
+
</div>
|
| 148 |
+
</div>
|
| 149 |
+
|
| 150 |
+
<div class="text-center">
|
| 151 |
+
<button id="startTest" class="test-btn bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-3 px-8 rounded-full text-lg transition-all duration-300">
|
| 152 |
+
<i class="fas fa-play mr-2"></i>Start Test
|
| 153 |
+
</button>
|
| 154 |
+
</div>
|
| 155 |
+
|
| 156 |
+
<div class="mt-8 bg-blue-50 border-l-4 border-blue-500 p-4 rounded hidden" id="tips">
|
| 157 |
+
<div class="flex">
|
| 158 |
+
<div class="flex-shrink-0 text-blue-500">
|
| 159 |
+
<i class="fas fa-info-circle text-xl"></i>
|
| 160 |
+
</div>
|
| 161 |
+
<div class="ml-3">
|
| 162 |
+
<h3 class="text-sm font-medium text-blue-800">Tips for accurate results</h3>
|
| 163 |
+
<div class="mt-2 text-sm text-blue-700">
|
| 164 |
+
<p>• Close other tabs and applications</p>
|
| 165 |
+
<p>• Connect directly to your router with Ethernet if possible</p>
|
| 166 |
+
<p>• Stop any ongoing downloads or uploads</p>
|
| 167 |
+
</div>
|
| 168 |
+
</div>
|
| 169 |
+
</div>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
|
| 173 |
+
<div class="max-w-3xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6 mt-8">
|
| 174 |
+
<h3 class="text-xl font-semibold text-gray-800 mb-4"><i class="fas fa-history mr-2"></i>Test History</h3>
|
| 175 |
+
<div class="overflow-x-auto">
|
| 176 |
+
<table class="min-w-full divide-y divide-gray-200">
|
| 177 |
+
<thead class="bg-gray-50">
|
| 178 |
+
<tr>
|
| 179 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
|
| 180 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Download</th>
|
| 181 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Upload</th>
|
| 182 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Ping</th>
|
| 183 |
+
</tr>
|
| 184 |
+
</thead>
|
| 185 |
+
<tbody class="bg-white divide-y divide-gray-200" id="historyTable">
|
| 186 |
+
<!-- History will be populated here -->
|
| 187 |
+
</tbody>
|
| 188 |
+
</table>
|
| 189 |
+
</div>
|
| 190 |
+
</div>
|
| 191 |
+
</main>
|
| 192 |
+
|
| 193 |
+
<footer class="bg-white shadow-sm py-4 mt-8">
|
| 194 |
+
<div class="container mx-auto px-4 text-center text-gray-500 text-sm">
|
| 195 |
+
<p>© 2023 Network Speed Test | All rights reserved</p>
|
| 196 |
+
</div>
|
| 197 |
+
</footer>
|
| 198 |
+
|
| 199 |
+
<script>
|
| 200 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 201 |
+
const startTestBtn = document.getElementById('startTest');
|
| 202 |
+
const downloadSpeed = document.getElementById('downloadSpeed');
|
| 203 |
+
const uploadSpeed = document.getElementById('uploadSpeed');
|
| 204 |
+
const finalDownload = document.getElementById('finalDownload');
|
| 205 |
+
const finalUpload = document.getElementById('finalUpload');
|
| 206 |
+
const pingResult = document.getElementById('pingResult');
|
| 207 |
+
const testStatus = document.getElementById('testStatus');
|
| 208 |
+
const testProgress = document.getElementById('testProgress');
|
| 209 |
+
const downloadGauge = document.getElementById('downloadGauge');
|
| 210 |
+
const uploadGauge = document.getElementById('uploadGauge');
|
| 211 |
+
const historyTable = document.getElementById('historyTable');
|
| 212 |
+
const tipsSection = document.getElementById('tips');
|
| 213 |
+
|
| 214 |
+
let testInProgress = false;
|
| 215 |
+
let testHistory = JSON.parse(localStorage.getItem('speedTestHistory')) || [];
|
| 216 |
+
|
| 217 |
+
// Display test history
|
| 218 |
+
renderHistory();
|
| 219 |
+
|
| 220 |
+
startTestBtn.addEventListener('click', function() {
|
| 221 |
+
if (testInProgress) return;
|
| 222 |
+
|
| 223 |
+
startTest();
|
| 224 |
+
});
|
| 225 |
+
|
| 226 |
+
function startTest() {
|
| 227 |
+
testInProgress = true;
|
| 228 |
+
startTestBtn.disabled = true;
|
| 229 |
+
startTestBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i>Testing...';
|
| 230 |
+
startTestBtn.classList.remove('bg-indigo-600', 'hover:bg-indigo-700');
|
| 231 |
+
startTestBtn.classList.add('bg-gray-400', 'cursor-not-allowed');
|
| 232 |
+
|
| 233 |
+
// Reset values
|
| 234 |
+
downloadSpeed.textContent = '0 Mbps';
|
| 235 |
+
uploadSpeed.textContent = '0 Mbps';
|
| 236 |
+
finalDownload.textContent = '0 Mbps';
|
| 237 |
+
finalUpload.textContent = '0 Mbps';
|
| 238 |
+
pingResult.textContent = '0 ms';
|
| 239 |
+
testStatus.textContent = 'Starting...';
|
| 240 |
+
testProgress.style.width = '0%';
|
| 241 |
+
downloadGauge.style.transform = 'rotate(0.5turn)';
|
| 242 |
+
uploadGauge.style.transform = 'rotate(0.5turn)';
|
| 243 |
+
|
| 244 |
+
tipsSection.classList.add('hidden');
|
| 245 |
+
|
| 246 |
+
// Show pulse animation on gauges
|
| 247 |
+
downloadGauge.classList.add('pulse');
|
| 248 |
+
uploadGauge.classList.add('pulse');
|
| 249 |
+
|
| 250 |
+
// Start tests in sequence
|
| 251 |
+
setTimeout(() => {
|
| 252 |
+
testPing().then(ping => {
|
| 253 |
+
pingResult.textContent = ping + ' ms';
|
| 254 |
+
testStatus.textContent = 'Testing download speed...';
|
| 255 |
+
testProgress.style.width = '30%';
|
| 256 |
+
|
| 257 |
+
return testDownloadSpeed();
|
| 258 |
+
}).then(downloadSpeedValue => {
|
| 259 |
+
const roundedDownload = Math.round(downloadSpeedValue * 10) / 10;
|
| 260 |
+
finalDownload.textContent = roundedDownload + ' Mbps';
|
| 261 |
+
testStatus.textContent = 'Testing upload speed...';
|
| 262 |
+
testProgress.style.width = '70%';
|
| 263 |
+
|
| 264 |
+
// Update gauge
|
| 265 |
+
const downloadAngle = Math.min(0.5 + (downloadSpeedValue / 200), 1);
|
| 266 |
+
downloadGauge.style.transform = `rotate(${downloadAngle}turn)`;
|
| 267 |
+
downloadGauge.classList.remove('pulse');
|
| 268 |
+
|
| 269 |
+
return testUploadSpeed();
|
| 270 |
+
}).then(uploadSpeedValue => {
|
| 271 |
+
const roundedUpload = Math.round(uploadSpeedValue * 10) / 10;
|
| 272 |
+
finalUpload.textContent = roundedUpload + ' Mbps';
|
| 273 |
+
testStatus.textContent = 'Test complete!';
|
| 274 |
+
testProgress.style.width = '100%';
|
| 275 |
+
|
| 276 |
+
// Update gauge
|
| 277 |
+
const uploadAngle = Math.min(0.5 + (uploadSpeedValue / 50), 1);
|
| 278 |
+
uploadGauge.style.transform = `rotate(${uploadAngle}turn)`;
|
| 279 |
+
uploadGauge.classList.remove('pulse');
|
| 280 |
+
|
| 281 |
+
// Save to history
|
| 282 |
+
saveTestResult(roundedDownload, roundedUpload, pingResult.textContent);
|
| 283 |
+
|
| 284 |
+
// Reset button
|
| 285 |
+
resetTestButton();
|
| 286 |
+
}).catch(error => {
|
| 287 |
+
console.error('Test failed:', error);
|
| 288 |
+
testStatus.textContent = 'Test failed. Try again.';
|
| 289 |
+
testStatus.classList.add('text-red-500');
|
| 290 |
+
resetTestButton();
|
| 291 |
+
});
|
| 292 |
+
}, 1000);
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
function resetTestButton() {
|
| 296 |
+
testInProgress = false;
|
| 297 |
+
startTestBtn.disabled = false;
|
| 298 |
+
startTestBtn.innerHTML = '<i class="fas fa-sync-alt mr-2"></i>Test Again';
|
| 299 |
+
startTestBtn.classList.remove('bg-gray-400', 'cursor-not-allowed');
|
| 300 |
+
startTestBtn.classList.add('bg-indigo-600', 'hover:bg-indigo-700');
|
| 301 |
+
|
| 302 |
+
// Show tips
|
| 303 |
+
tipsSection.classList.remove('hidden');
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
function testPing() {
|
| 307 |
+
return new Promise((resolve) => {
|
| 308 |
+
// Simulate ping test with random value (real implementation would use actual ping)
|
| 309 |
+
const start = new Date().getTime();
|
| 310 |
+
setTimeout(() => {
|
| 311 |
+
const latency = Math.floor(Math.random() * 30) + 5;
|
| 312 |
+
resolve(latency);
|
| 313 |
+
}, 300);
|
| 314 |
+
});
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
function testDownloadSpeed() {
|
| 318 |
+
return new Promise((resolve) => {
|
| 319 |
+
let startTime, endTime;
|
| 320 |
+
const fileSize = 5 * 1024 * 1024; // 5MB test file
|
| 321 |
+
const testUrl = `https://httpbin.org/bytes/${fileSize}?r=${Math.random()}`;
|
| 322 |
+
|
| 323 |
+
startTime = new Date().getTime();
|
| 324 |
+
|
| 325 |
+
fetch(testUrl)
|
| 326 |
+
.then(response => {
|
| 327 |
+
endTime = new Date().getTime();
|
| 328 |
+
return response.blob();
|
| 329 |
+
})
|
| 330 |
+
.then(() => {
|
| 331 |
+
const duration = (endTime - startTime) / 1000;
|
| 332 |
+
const bitsLoaded = fileSize * 8;
|
| 333 |
+
const speedMbps = (bitsLoaded / duration / 1024 / 1024).toFixed(2);
|
| 334 |
+
|
| 335 |
+
// Update speed in real-time during test
|
| 336 |
+
let progress = 0;
|
| 337 |
+
const interval = setInterval(() => {
|
| 338 |
+
if (progress >= speedMbps) {
|
| 339 |
+
clearInterval(interval);
|
| 340 |
+
resolve(parseFloat(speedMbps));
|
| 341 |
+
} else {
|
| 342 |
+
progress += Math.random() * 5;
|
| 343 |
+
downloadSpeed.textContent = Math.min(progress, speedMbps).toFixed(1) + ' Mbps';
|
| 344 |
+
}
|
| 345 |
+
}, 100);
|
| 346 |
+
});
|
| 347 |
+
});
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
function testUploadSpeed() {
|
| 351 |
+
return new Promise((resolve) => {
|
| 352 |
+
let startTime, endTime;
|
| 353 |
+
const fileSize = 1 * 1024 * 1024; // 1MB test file
|
| 354 |
+
const testData = new Blob([new Uint8Array(fileSize)], {type: 'application/octet-stream'});
|
| 355 |
+
|
| 356 |
+
startTime = new Date().getTime();
|
| 357 |
+
|
| 358 |
+
fetch('https://httpbin.org/post', {
|
| 359 |
+
method: 'POST',
|
| 360 |
+
body: testData
|
| 361 |
+
})
|
| 362 |
+
.then(response => response.json())
|
| 363 |
+
.then(() => {
|
| 364 |
+
endTime = new Date().getTime();
|
| 365 |
+
const duration = (endTime - startTime) / 1000;
|
| 366 |
+
const bitsLoaded = fileSize * 8;
|
| 367 |
+
const speedMbps = (bitsLoaded / duration / 1024 / 1024).toFixed(2);
|
| 368 |
+
|
| 369 |
+
// Update speed in real-time during test
|
| 370 |
+
let progress = 0;
|
| 371 |
+
const interval = setInterval(() => {
|
| 372 |
+
if (progress >= speedMbps) {
|
| 373 |
+
clearInterval(interval);
|
| 374 |
+
resolve(parseFloat(speedMbps));
|
| 375 |
+
} else {
|
| 376 |
+
progress += Math.random() * 2;
|
| 377 |
+
uploadSpeed.textContent = Math.min(progress, speedMbps).toFixed(1) + ' Mbps';
|
| 378 |
+
}
|
| 379 |
+
}, 100);
|
| 380 |
+
});
|
| 381 |
+
});
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
function saveTestResult(download, upload, ping) {
|
| 385 |
+
const now = new Date();
|
| 386 |
+
const testResult = {
|
| 387 |
+
date: now.toLocaleString(),
|
| 388 |
+
download: download,
|
| 389 |
+
upload: upload,
|
| 390 |
+
ping: ping
|
| 391 |
+
};
|
| 392 |
+
|
| 393 |
+
testHistory.unshift(testResult);
|
| 394 |
+
if (testHistory.length > 5) {
|
| 395 |
+
testHistory = testHistory.slice(0, 5);
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
localStorage.setItem('speedTestHistory', JSON.stringify(testHistory));
|
| 399 |
+
renderHistory();
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
function renderHistory() {
|
| 403 |
+
historyTable.innerHTML = '';
|
| 404 |
+
|
| 405 |
+
if (testHistory.length === 0) {
|
| 406 |
+
const row = document.createElement('tr');
|
| 407 |
+
row.innerHTML = `
|
| 408 |
+
<td colspan="4" class="px-6 py-4 text-center text-gray-500">No test history yet</td>
|
| 409 |
+
`;
|
| 410 |
+
historyTable.appendChild(row);
|
| 411 |
+
return;
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
testHistory.forEach(result => {
|
| 415 |
+
const row = document.createElement('tr');
|
| 416 |
+
row.innerHTML = `
|
| 417 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${result.date}</td>
|
| 418 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-green-600">${result.download} Mbps</td>
|
| 419 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-blue-600">${result.upload} Mbps</td>
|
| 420 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-purple-600">${result.ping}</td>
|
| 421 |
+
`;
|
| 422 |
+
historyTable.appendChild(row);
|
| 423 |
+
});
|
| 424 |
+
}
|
| 425 |
+
});
|
| 426 |
+
</script>
|
| 427 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=KEXEL/speedtest" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 428 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
criar um speedtest em html5 css javascript
|