Skip to content

Commit 03e103a

Browse files
copie coller
1 parent 2cfb6a8 commit 03e103a

File tree

5 files changed

+79
-6
lines changed

5 files changed

+79
-6
lines changed

copier-active.png

13.7 KB
Loading

copier.png

16.2 KB
Loading

index.html

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,24 @@
1313
<div class="bg bloc">
1414
<div class="double">
1515
<p class="bg">Write the key you want...</p>
16-
<textarea class="bg input hash" placeholder="kee"></textarea>
16+
<textarea class="bg input hash" placeholder="key"></textarea>
17+
<div class="bg imgBloc">
18+
<div class="img a"></div>
19+
</div>
1720
</div>
1821
<div class="double">
1922
<p class="bg">Write the message you want to encrypt...</p>
2023
<textarea class="bg input txt" placeholder="msg"></textarea>
24+
<div class="bg imgBloc">
25+
<div class="img b"></div>
26+
</div>
2127
</div>
2228
<div class="double">
2329
<p class="bg">Write the message you want to decipher...</p>
2430
<textarea class="bg input txtHash" placeholder="msg-hash"></textarea>
31+
<div class="bg imgBloc">
32+
<div class="img c"></div>
33+
</div>
2534
</div>
2635

2736
<div class="double">

msg-hash.css

+41-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ body {
2020
background-repeat: no-repeat;
2121
background-color: black;
2222
font-size: 1.2em;
23+
backdrop-filter: brightness(0.7);
2324

2425
}
2526

@@ -36,7 +37,7 @@ body {
3637

3738
background-color: rgba(255, 255, 255, 0.25);
3839
backdrop-filter: blur(15px);
39-
max-width: max-content;
40+
-webkit-backdrop-filter: blur(15px);
4041
padding: 10px;
4142
border-radius: 10px;
4243
color: white;
@@ -46,19 +47,30 @@ body {
4647
.double {
4748

4849
display: flex;
49-
justify-content:space-between;
50+
justify-content: space-between;
5051
gap: 30px;
5152
margin: 20px;
5253
align-items: center;
5354

5455
}
5556

57+
p {
58+
59+
width: 250px;
60+
height: 70px;
61+
display: flex;
62+
justify-content: center;
63+
align-items: center;
64+
65+
}
66+
5667
.input {
5768

5869
resize: none;
5970
border: none;
6071
height: 70px;
6172
transition: 1.5s;
73+
font-size: 1.000009em;
6274

6375
}
6476

@@ -82,6 +94,25 @@ body {
8294

8395
}
8496

97+
.img {
98+
99+
background-position: center;
100+
background-size: cover;
101+
background-image: url(copier.png);
102+
transition: 0.7s;
103+
width: 50px;
104+
height: 50px;
105+
cursor: pointer;
106+
transition: 1.5s;
107+
108+
}
109+
110+
.img.active {
111+
112+
background-image: url(copier-active.png);
113+
114+
}
115+
85116
.footer {
86117

87118
text-decoration: none;
@@ -94,7 +125,7 @@ body {
94125
.bloc {
95126

96127
position: relative;
97-
top: 485px;
128+
top: 605px;
98129

99130
}
100131

@@ -110,6 +141,7 @@ body {
110141
margin: 40px;
111142
margin-left: 0px;
112143
margin-right: 0px;
144+
gap: 15px;
113145

114146
}
115147

@@ -126,6 +158,12 @@ body {
126158

127159
}
128160

161+
p {
162+
163+
width: 265px;
164+
165+
}
166+
129167
.input {
130168

131169
height: 150px;

msg-hash.js

+28-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ const hash = document.querySelector(".hash");
88
const txt = document.querySelector(".txt");
99
const txtHash = document.querySelector(".txtHash");
1010

11-
let hashValue
11+
const copieHash = document.querySelector(".a");
12+
const copieTxt = document.querySelector(".b");
13+
const copieTxtHash = document.querySelector(".c");
14+
15+
let hashValue;
1216

1317
hash.addEventListener("input", function() {
1418
hashValue = hash.value;
@@ -36,4 +40,26 @@ txtHash.addEventListener("input", function() {
3640
let decrypted = atob(txtHash.value);
3741
txt.value = encryptDecrypt(decrypted, hashValue);
3842
} catch {}
39-
});
43+
});
44+
45+
function copyToClipboard(element, text) {
46+
element.classList.add("active");
47+
48+
navigator.clipboard.writeText(text || '');
49+
50+
setTimeout(function() {
51+
element.classList.remove("active");
52+
}, 2500);
53+
}
54+
55+
copieHash.onclick = function() {
56+
copyToClipboard(copieHash, hashValue);
57+
}
58+
59+
copieTxt.onclick = function() {
60+
copyToClipboard(copieTxt, txt.value);
61+
}
62+
63+
copieTxtHash.onclick = function() {
64+
copyToClipboard(copieTxtHash, txtHash.value);
65+
}

0 commit comments

Comments
 (0)