Skip to content

Commit 42003a5

Browse files
add copy button
1 parent 9565ced commit 42003a5

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

img/copy.png

485 Bytes
Loading

src/index.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@
3737
</div>
3838
<textarea id="inData" placeholder="Input data..." rows="7"></textarea>
3939
<button onclick="decode()">convert</button>
40-
<textarea id="outData" placeholder="Outout data..." readonly rows="7">fref</textarea>
40+
<textarea id="outData" placeholder="Outout data..." readonly rows="7">The output data will be here</textarea>
41+
<div class="tools">
42+
<div class="tool" onclick="copyOutputData()">
43+
<img src="../img/copy.png" alt="copy" />
44+
</div>
45+
</div>
4146
</article>
4247
<footer>
4348
<span>Bytes formatter Copyright © 2022 Pavlo Myroniuk; released as <a

src/script.js

+2
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,5 @@ const decode = () => {
9090

9191
outData.value = value;
9292
};
93+
94+
const copyOutputData = () => navigator.clipboard.writeText(document.getElementById('outData').value);

src/style.css

+27-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
body {
32
font-family: 'Source Code Pro', monospace;
43
padding: 0;
@@ -49,6 +48,31 @@ textarea {
4948
font-family: 'Source Code Pro', monospace;
5049
}
5150

51+
.tools {
52+
width: 100%;
53+
display: inline-flex;
54+
margin-top: 0.7em;
55+
}
56+
57+
.tool {
58+
display: inline-flex;
59+
cursor: pointer;
60+
height: 2em;
61+
width: fit-content;
62+
padding: 0.1em;
63+
border-radius: 0.2em;
64+
justify-content: center;
65+
align-items: center;
66+
}
67+
68+
.tool:hover {
69+
background-color: aliceblue;
70+
}
71+
72+
.tool>img {
73+
height: 90%;
74+
}
75+
5276
footer {
5377
width: 70%;
5478
display: flex;
@@ -58,7 +82,7 @@ footer {
5882
margin-top: 2em;
5983
}
6084

61-
footer > span {
85+
footer>span {
6286
margin: 1em;
6387
text-align: center;
64-
}
88+
}

0 commit comments

Comments
 (0)