-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogica.js
96 lines (78 loc) · 2.45 KB
/
logica.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
var scrollId;
function resolver(id){
var scrolling = false;
var textField = document.getElementById("display");
var container = document.getElementById("msgcontainer");
var text = document.getElementById("userinput").value;
document.getElementById("userinput").value = "";
textField.style.top = "0px";
clearInterval(scrollId);
if (id == 1){
var encrypt = text.replaceAll("e","enter").replaceAll("i","imes").replaceAll("a","ai").replaceAll("o","ober").replaceAll("u", "ufat")
}
if (id == 0) {
var encrypt = text.replaceAll("enter","e").replaceAll("imes","i").replaceAll("ai","a").replaceAll("ober","o").replaceAll("ufat", "u");
}
if (text.trim() != ""){
hideError();
textField.style.top = "0px";
textField.innerHTML = encrypt;
textField.style.textAlign = "left";
if (container.scrollHeight > container.offsetHeight && !scrolling) {
scrolling = true;
var scrollDistance = container.scrollHeight + container.offsetHeight / 15;
var i = 0;
scrollId = setInterval(function(){
textField.style.top = i + "px";
i = i - 0.5;
if (-i > scrollDistance){
i = container.offsetHeight;
}
}, 30);
}
} else {
textField.innerHTML = "Ningun mensaje fue encontrado";
textField.style.textAlign = "center"
showError();
}
}
function copiar(){
var text = document.getElementById("display").innerHTML;
navigator.clipboard.writeText(text);
}
function hideError(){
var errorimg = document.getElementById("imgerror");
var error = document.getElementById("error");
var btnCopiar = document.getElementById("copiar");
errorimg.style.display = "none";
error.style.display = "none";
btnCopiar.style.display = "block";
}
function showError(){
var errorimg = document.getElementById("imgerror");
var error = document.getElementById("error");
var btnCopiar = document.getElementById("copiar");
errorimg.style.display = "block";
error.style.display = "block";
btnCopiar.style.display = "none";
}
/*
function title(){
var title = "Proyecto Encriptador";
var specialChars = "123456789@#$;"
var count = 0;
setInterval(function(){
var titleC = title[Math.floor(Math.random() * title.length)]
var subsC = specialChars[Math.floor(Math.random() * specialChars.length)]
title = title.replaceAll(titleC, subsC)
count++;
if (count == 3){
count = 0;
title = "Proyecto Encriptador";
}
console.log(titleC + " " + subsC + " " + title);
document.getElementById("title").innerHTML = title;
}, 1000);
}
window.onload = title;
*/