remove input js from the bottom and make the code explainer more aproaching
Browse files- index.html +0 -75
index.html
CHANGED
|
@@ -458,82 +458,7 @@ tailwind.config = {
|
|
| 458 |
</div>
|
| 459 |
</div>
|
| 460 |
</div>
|
| 461 |
-
<!-- Enhanced Code Editor with VS Code-like styling -->
|
| 462 |
-
<div class="code-editor p-4 glow">
|
| 463 |
-
<div class="flex items-center justify-between mb-4">
|
| 464 |
-
<div class="flex items-center">
|
| 465 |
-
<div class="flex space-x-2 mr-4">
|
| 466 |
-
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
| 467 |
-
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
|
| 468 |
-
<div class="w-3 h-3 rounded-full bg-green-500"></div>
|
| 469 |
-
</div>
|
| 470 |
-
<div class="text-sm text-gray-400">input.js</div>
|
| 471 |
-
</div>
|
| 472 |
-
<div class="flex space-x-2">
|
| 473 |
-
<button onclick="copyCode()" class="group relative text-gray-400 hover:text-white p-1.5 rounded hover:bg-gray-700/50 transition-all duration-200" title="Copy Code">
|
| 474 |
-
<i data-feather="copy" class="w-4 h-4"></i>
|
| 475 |
-
<span class="absolute top-full left-1/2 transform -translate-x-1/2 mt-1 px-2 py-1 text-xs text-white bg-gray-800 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200">Copy</span>
|
| 476 |
-
</button>
|
| 477 |
-
<button onclick="downloadCode()" class="group relative text-gray-400 hover:text-white p-1.5 rounded hover:bg-gray-700/50 transition-all duration-200" title="Download Code">
|
| 478 |
-
<i data-feather="download" class="w-4 h-4"></i>
|
| 479 |
-
<span class="absolute top-full left-1/2 transform -translate-x-1/2 mt-1 px-2 py-1 text-xs text-white bg-gray-800 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200">Download</span>
|
| 480 |
-
</button>
|
| 481 |
-
</div>
|
| 482 |
-
</div>
|
| 483 |
-
<div id="codeEditor" class="w-full h-96 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-auto">
|
| 484 |
-
<div>
|
| 485 |
-
<div class="text-primary font-medium">Function Declaration:</div>
|
| 486 |
-
<div class="text-gray-400 ml-4"><span class="text-purple-400">function</span> <span class="text-yellow-300">calculateTotal</span>(<span class="text-blue-400">items</span>) {</div>
|
| 487 |
-
</div>
|
| 488 |
-
<div class="mt-2">
|
| 489 |
-
<div class="text-primary font-medium">Input Validation:</div>
|
| 490 |
-
<div class="text-gray-400 ml-4"><span class="text-green-400">if</span> (!Array.isArray(<span class="text-blue-400">items</span>)) {</div>
|
| 491 |
-
<div class="text-gray-400 ml-8"><span class="text-green-400">throw</span> <span class="text-purple-400">new</span> <span class="text-blue-400">Error</span>(<span class="text-orange-300">'Items must be an array'</span>);</div>
|
| 492 |
-
<div class="text-gray-400 ml-4">}</div>
|
| 493 |
-
</div>
|
| 494 |
-
<div class="mt-2">
|
| 495 |
-
<div class="text-primary font-medium">Total Calculation:</div>
|
| 496 |
-
<div class="text-gray-400 ml-4"><span class="text-purple-400">let</span> total = <span class="text-blue-400">0</span>;</div>
|
| 497 |
-
<div class="text-gray-400 ml-4"><span class="text-blue-400">items</span>.forEach(<span class="text-blue-400">item</span> => {</div>
|
| 498 |
-
<div class="text-gray-400 ml-8"><span class="text-purple-400">const</span> price = <span class="text-blue-400">Number</span>(<span class="text-blue-400">item</span>.price) || <span class="text-blue-400">0</span>;</div>
|
| 499 |
-
<div class="text-gray-400 ml-8">total += price * (<span class="text-blue-400">item</span>.quantity || <span class="text-blue-400">1</span>);</div>
|
| 500 |
-
<div class="text-gray-400 ml-4">});</div>
|
| 501 |
-
</div>
|
| 502 |
-
<div class="mt-2">
|
| 503 |
-
<div class="text-primary font-medium">Return Value:</div>
|
| 504 |
-
<div class="text-gray-400 ml-4"><span class="text-green-400">return</span> total;</div>
|
| 505 |
-
<div class="text-gray-400 ml-4">}</div>
|
| 506 |
-
</div>
|
| 507 |
-
</div>
|
| 508 |
-
<div class="grid grid-cols-5 gap-3 mt-4">
|
| 509 |
-
<button onclick="explainCode()" class="group relative bg-gray-700/70 hover:bg-gray-600/80 border border-gray-600 hover:border-blue-500 text-white py-2.5 px-3 rounded-lg text-sm font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-blue-500/20">
|
| 510 |
-
<div class="absolute inset-0 bg-blue-500/10 group-hover:bg-blue-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
|
| 511 |
-
<i data-feather="book-open" class="mr-2 w-4 h-4 text-blue-400"></i>
|
| 512 |
-
<span class="relative">Explain</span>
|
| 513 |
-
</button>
|
| 514 |
-
<button onclick="commentCode()" class="group relative bg-gray-700/70 hover:bg-gray-600/80 border border-gray-600 hover:border-purple-500 text-white py-2.5 px-3 rounded-lg text-sm font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-purple-500/20">
|
| 515 |
-
<div class="absolute inset-0 bg-purple-500/10 group-hover:bg-purple-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
|
| 516 |
-
<i data-feather="message-square" class="mr-2 w-4 h-4 text-purple-400"></i>
|
| 517 |
-
<span class="relative">Comment</span>
|
| 518 |
-
</button>
|
| 519 |
-
<button onclick="analyzeCode()" class="group relative bg-gray-700/70 hover:bg-gray-600/80 border border-gray-600 hover:border-red-500 text-white py-2.5 px-3 rounded-lg text-sm font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-red-500/20">
|
| 520 |
-
<div class="absolute inset-0 bg-red-500/10 group-hover:bg-red-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
|
| 521 |
-
<i data-feather="bug" class="mr-2 w-4 h-4 text-red-400"></i>
|
| 522 |
-
<span class="relative">Find Bugs</span>
|
| 523 |
-
</button>
|
| 524 |
-
<button onclick="documentCode()" class="group relative bg-gray-700/70 hover:bg-gray-600/80 border border-gray-600 hover:border-green-500 text-white py-2.5 px-3 rounded-lg text-sm font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-green-500/20">
|
| 525 |
-
<div class="absolute inset-0 bg-green-500/10 group-hover:bg-green-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
|
| 526 |
-
<i data-feather="file-text" class="mr-2 w-4 h-4 text-green-400"></i>
|
| 527 |
-
<span class="relative">Document</span>
|
| 528 |
-
</button>
|
| 529 |
-
<button onclick="fixCode()" class="group relative bg-gray-700/70 hover:bg-gray-600/80 border border-gray-600 hover:border-indigo-500 text-white py-2.5 px-3 rounded-lg text-sm font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-indigo-500/20">
|
| 530 |
-
<div class="absolute inset-0 bg-indigo-500/10 group-hover:bg-indigo-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
|
| 531 |
-
<i data-feather="wrench" class="mr-2 w-4 h-4 text-indigo-400"></i>
|
| 532 |
-
<span class="relative">Fix Code</span>
|
| 533 |
-
</button>
|
| 534 |
-
</div>
|
| 535 |
</div>
|
| 536 |
-
</div>
|
| 537 |
</div>
|
| 538 |
<script>
|
| 539 |
function copyCode() {
|
|
|
|
| 458 |
</div>
|
| 459 |
</div>
|
| 460 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 461 |
</div>
|
|
|
|
| 462 |
</div>
|
| 463 |
<script>
|
| 464 |
function copyCode() {
|