From bf10e8c252d216828f26310c6dd0bd83a35a102f Mon Sep 17 00:00:00 2001 From: miaawong Date: Mon, 14 Oct 2024 10:51:15 -0400 Subject: [PATCH] copy command link --- kurl_proxy/assets/insecure.html | 16 ++++++++++++---- kurl_proxy/assets/tls-custom.css | 5 +++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/kurl_proxy/assets/insecure.html b/kurl_proxy/assets/insecure.html index b2e6e2deb0..bc88541707 100644 --- a/kurl_proxy/assets/insecure.html +++ b/kurl_proxy/assets/insecure.html @@ -177,8 +177,12 @@
                         
                         
-                        Copy command
                       
+
+ Copy command +
@@ -235,15 +239,19 @@ document .getElementById("copy-command") .addEventListener("click", function () { - // Get the code inside the element const codeSnippet = document.getElementById("verify-snippet").textContent; - // Copy the code to the clipboard navigator.clipboard .writeText(codeSnippet) .then(() => { - alert("Command copied to clipboard!"); + const copyCommandElement = document.getElementById("copy-command"); + const originalText = copyCommandElement.textContent; + copyCommandElement.textContent = "Copied!"; + + setTimeout(() => { + copyCommandElement.textContent = originalText; + }, 3000); }) .catch((err) => { console.error("Failed to copy text: ", err); diff --git a/kurl_proxy/assets/tls-custom.css b/kurl_proxy/assets/tls-custom.css index ec684ea122..293abbc451 100644 --- a/kurl_proxy/assets/tls-custom.css +++ b/kurl_proxy/assets/tls-custom.css @@ -617,3 +617,8 @@ p.hidden { .cursor { cursor: pointer; } + +.copy-command { + font-size: 12px; + padding-top: 8px; +}