@@ -34,8 +34,7 @@ export os="linux" # or macos
3434<pre class =" bash " id =" bashCode " >
3535 curl -Lo hkubectl hkube-domain.com/hkubectl_files/hkubectl-${os} \
3636 && chmod +x hkubectl \
37- && sudo mv hkubectl /usr/local/bin/
38- <button id =" copyBtn " onclick =" copyToClipboard (' bashCode' )" class =" copy-btn " >Copy</button >
37+ && sudo mv hkubectl /usr/local/bin/<button id =" copyBtn " onclick =" copyToClipboard (' bashCode' )" class =" copy-btn " >Copy</button >
3938</pre >
4039
4140<p >For <strong >Windows</strong >, download <code >hkubectl-win.exe</code > from <a id =" windowsLink " href =" /hkubectl_files/hkubectl-win.exe " >here</a >.</p >
@@ -80,23 +79,27 @@ kubectl get nodes
8079<script >
8180 function copyToClipboard (elementId ) {
8281 var code = document .getElementById (elementId);
82+ var copyButton = document .getElementById (" copyBtn" );
83+
84+ copyButton .textContent = " " ;
85+
8386 var range = document .createRange ();
8487 range .selectNode (code);
8588 window .getSelection ().removeAllRanges ();
8689 window .getSelection ().addRange (range);
8790
8891 try {
8992 document .execCommand (" copy" );
90- var copyButton = document .getElementById (" copyBtn" );
91- copyButton .textContent = " Copied!" ;
93+ copyButton .textContent = " Copied!" ;
94+
95+ setTimeout (function () {
96+ copyButton .textContent = " Copy" ;
97+ }, 300 );
9298
93- setTimeout (function () {
94- copyButton .textContent = " Copy" ;
95- }, 300 );
9699 } catch (err) {
100+ copyButton .textContent = " Copy" ;
97101 console .error (" Unable to copy code" , err);
98102 }
99-
100103 window .getSelection ().removeAllRanges ();
101104 }
102105</script >
0 commit comments