-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
31 lines (30 loc) · 1.01 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const userText = document.querySelector('#userText');
const cript = document.querySelector('.encript1');
const descript = document.querySelector('.encript2');
const finalResult = document.querySelector('.finalResult');
const copy = document.querySelector('#copy')
cript.addEventListener('click', function () {
let textValue = userText.value
.replaceAll('e', 'enter')
.replaceAll('i', 'imes')
.replaceAll('a', 'ai')
.replaceAll('o', 'ober')
.replaceAll('u', 'ufat');
finalResult.innerHTML = textValue;
});
descript.addEventListener('click', function () {
let textValue = userText.value
.replaceAll('enter', 'e')
.replaceAll('imes', 'i')
.replaceAll('ai', 'a')
.replaceAll('ober', 'o')
.replaceAll('ufat', 'u');
finalResult.innerHTML = textValue;
});
copy.addEventListener('click', function() {
if (navigator.clipboard) {
navigator.clipboard.writeText(finalResult.textContent)
copy.classList.add('greenButton')
copy.innerHTML = 'Copiado!'
}
})