Skip to content

Commit

Permalink
🐛 (index.html): fix selector for install-command-button to ensure cor…
Browse files Browse the repository at this point in the history
…rect element is targeted

✨ (index.html): add error handling and alert for missing install-command-button element
  • Loading branch information
closedLoop committed Jul 24, 2024
1 parent b4294d0 commit 85a0040
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,11 @@ <h2 class="text-4xl mb-6 text-green-500 font-bold terminal-text">
navigator.clipboard
.writeText(text)
.then(() => {
const button = document.querySelector(
"#install-command-button + button"
);
const button = document.querySelector("#install-command-button");
if (!button) {
console.error("install-command-button not found");
alert("Code copied to clipboard.");
};
const originalContent = button.innerHTML;
button.innerHTML =
'<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path d="M9 2a1 1 0 000 2h2a1 1 0 100-2H9z" /><path fill-rule="evenodd" d="M4 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v11a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm9.707 5.707a1 1 0 00-1.414-1.414L9 12.586l-1.293-1.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>';
Expand Down

0 comments on commit 85a0040

Please sign in to comment.