-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
50 lines (26 loc) · 1.03 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//selecionando elementos
let areaTexto = document.querySelector(".areaTexto");
let areaResultado = document.querySelector(".areaResultado");
//função encriptar
function encriptar(){
var texto = areaTexto.value;
var textoEncrip =texto.replace(/a/gi, "ar").replace(/e/gi, "enter").replace(/i/gi, "imes").replace(/o/gi, "ober").replace(/u/gi, "ufat");
areaResultado.innerHTML = textoEncrip;
}
//função desencriptar
function desencriptar(){
var texto = areaTexto.value;
var textoDescrip = texto.replace(/ar/gi, "a").replace(/enter/gi, "e").replace(/imes/gi, "i").replace(/ober/gi, "o").replace(/ufat/gi, "u");
areaResultado.innerHTML = textoDescrip;
}
//função copiar texto
function copiar(){
var copiarTxt = areaResultado.value;
navigator.clipboard.writeText(copiarTxt);
}
// As "chaves" de criptografia que utilizaremos são:
// "a" é convertida para "ai"
// "e" é convertida para "enter"
// "i" é convertida para "imes"
// "o" é convertida para "ober"
// "u" é convertida para "ufat"