Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ <h4 class="text-grey-800 text-xl">Optional parameters</h4>
<div class="text-gray-800 border-2 mt-5 border-[#fdfdfe] rounded-md p-8 bg-white">
<h2 class="text-3xl font-medium">Result</h2>
<div class="flex items-center mt-4">
<span onclick="copyResultToCB()" class="dropdown-btn">Copy</span>
<span onclick="copyResultToCB()" id="copy-btn" class="dropdown-btn relative">
Copy
<div>
<span class="blockCopy hidden" id="copy-block">Copied!</span>
</div>
</span>
<input id="result" type="text" placeholder="You will see the result here..."
class="w-full border block py-[.4rem] px-[.75rem] shadow-sm focus:ring-indigo-500 focus:border-indigo-500 border-gray-300"
autocomplete="off" disabled>
Expand Down
9 changes: 9 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ function copyResultToCB() {
resultNode.select()
resultNode.setSelectionRange(0, 99999)
navigator.clipboard.writeText(resultNode.value)

const copyBtn = document.getElementById('copy-btn')
const copyBlock = document.getElementById('copy-block')

copyBlock.classList.remove('hidden')

setTimeout(function() {
copyBlock.classList.add('hidden')
}, 500)
}

function buildResult() {
Expand Down
27 changes: 27 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,31 @@ html {

.container {
max-width: 930px !important;
}

.blockCopy {
width: 100px;
background-color: #374151;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 8px 6px;
position: absolute;
z-index: 1;
bottom: -40px;
left: 50%;
margin-left: -50px;
transition: opacity 1s;
white-space: nowrap;
}

.blockCopy::after {
content: "";
position: absolute;
bottom: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent #374151 transparent;
}