Skip to content

Commit

Permalink
Publicación de proyecto
Browse files Browse the repository at this point in the history
Publicación de archivos del proyecto de encriptador
  • Loading branch information
Kurai0206 authored Aug 27, 2024
1 parent 2b688f2 commit 59b16d5
Show file tree
Hide file tree
Showing 5 changed files with 375 additions and 0 deletions.
Binary file added cinnamoroll.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added flor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="en"></html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel= "stylesheet" href="styles.css" />
<title> Encriptador de Texto </title>
</head>

<body>
<div class = "container">
<div>
<h1> Bienvenido al encriptador de texto </h1>
</div>

<div class= "encriptado">
<textarea
name = "texto"
class = "texto"
id = "texto"
cols = "30"
rows = "10"
placeholder = "Ingresa el texto a encriptar aquí"></textarea>

<textarea
name = "texto2"
class = "texto2"
id = "texto2"
cols = "30"
rows = "10"
placeholder = "Texto encriptado" readonly></textarea>
</div>

<div class= "terminos">
<p > Sólo letras minúsculas y sin acentos </p>
</div>

<div class = "botones">
<button class= "btn-encriptar" type= "button" onclick= "btnEncriptar()">Encriptar</button>

<button class= "btn-desencriptar" type= "button" onclick= "btnDesencriptar()"> Desencriptar </button>

<button class="btn-copy" id = "btn-copy" type="button" onclick="btnCopiar()"> Copiar encriptado </button>
</div>

<div class="gif-cinnamoroll">
<img src="cinnamoroll.gif" id= "cinnamoroll">
</div>
<div>
<img src="flor.png" id= "flor">
<img src="flor.png" id= "flor2">
<img src="flor.png" id= "flor3">
</div>


</div>
<footer>
<div class= "footer">
<p> Creado por: Monserrath Gutiérrez González </p>
</div>
</footer>

<script src= "index.js"></script>
</body>
</html>

61 changes: 61 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const textArea = document.querySelector('.texto');
const mensaje = document.querySelector('.texto2');

function btnEncriptar(){
const validaMensaje = /[A-ZÁÉÍÓÚáéíóú]/.test(textArea.value);
if(validaMensaje==true){
alert("Por favor, ingrese un texto sin mayúsculas ni acentos");
return;
}
const textoEncriptado = encriptar(textArea.value);
mensaje.value = textoEncriptado;
textArea.value = "";
}



function encriptar(stringEncriptado){
let matrizCode = [["e", "enter"], ["i", "imes"], ["a", "ai"], ["o", "ober"], ["u", "ufat"]];
stringEncriptado = stringEncriptado.toLowerCase();

for(let i = 0; i < matrizCode.length; i++){
if(stringEncriptado.includes(matrizCode[i][0])){
stringEncriptado = stringEncriptado.replaceAll(matrizCode[i][0], matrizCode[i][1]);

}

}
return stringEncriptado;
}

function btnDesencriptar(){
const textoEncriptado = desencriptar(textArea.value);
mensaje.value = textoEncriptado;
textArea.value = "";
}

function desencriptar(stringDesencriptado){
let matrizCode = [["e", "enter"], ["i", "imes"], ["a", "ai"], ["o", "ober"], ["u", "ufat"]];
stringDesencriptado = stringDesencriptado.toLowerCase();

for(let i = 0; i < matrizCode.length; i++){
if(stringDesencriptado.includes(matrizCode[i][0])){
stringDesencriptado = stringDesencriptado.replaceAll(matrizCode[i][1], matrizCode[i][0]);

}
}

return stringDesencriptado;
}

function btnCopiar(){
navigator.clipboard.writeText(mensaje.value).then(function(){
alert("Texto copiado al portapapeles");
})
.catch (function(err){
console.error('Error al copiar el texto: ', err);
});
}



247 changes: 247 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

/* Estilos generales */
body {
background-color: #ffdfd3;
text-align: center;
margin: 0;
padding: 0;
background-size: cover;
display: flex;
flex-direction: column;

}

/* Título principal */
h1 {
font-size: 2.5em;
font-weight: bold;
color: #554851;
margin-top: 20px;
padding: 20px;
background: linear-gradient(0deg, #e9a1d1 0%, #ffedf9 100%);
font-family: Papyrus, fantasy;
margin-bottom: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 15px;
}

/* Contenedor principal */
.container {
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;


}

/* Estilo de los cuadros de texto */
.encriptado {
display: flex;
gap: 20px;
}

textarea {
width: 400px;
height: 350px;
border: none;
border-radius: 15px;
padding: 15px;
font-size: 1.2em;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
resize: none;
font-weight: bold;
background-color: #ffffff;
font-family: Papyrus;
text-align: center;
color: #314B79;
}

/*Terminos*/
.terminos p {
font-size: 0.9em;
color: #666;
font-family: Papyrus;
margin-top: 10px;
}

/* Botones */
.botones {
display: flex;
justify-content: center;
padding: 20px;
gap: 10px;
}

button, input[type="button"] {
padding: 15px 25px;
font-size: 1em;
border-radius: 20px;
border: none;
cursor: pointer;
font-family: Papyrus;
font-weight: bold;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}

.btn-encriptar {
background: #cde2db;
color: black;
background: linear-gradient(0deg, #cde2db 0%, #9fecd1 100%);
}
.btn-encriptar:before{
height: 0%;
width: 2px;
}
.btn-encriptar:hover{
box-shadow: 4px 4px 6px 0 rgba(255,255,255,.5),
-4px -4px 6px 0 rgba(116, 125, 136, .5),
inset -4px -4px 6px 0 rgba(255,255,255,.2),
inset 4px 4px 6px 0 rgba(0, 0, 0, .4);
}

.btn-desencriptar {
background: #f9c4cc;
color: black;
background: linear-gradient(0deg, #f9c4cc 0%, #f59eab 100%);
}
.btn-desencriptar:before{
height: 0%;
width: 2px;
}
.btn-desencriptar:hover{
box-shadow: 4px 4px 6px 0 rgba(255,255,255,.5),
-4px -4px 6px 0 rgba(116, 125, 136, .5),
inset -4px -4px 6px 0 rgba(255,255,255,.2),
inset 4px 4px 6px 0 rgba(0, 0, 0, .4);
}

.btn-copy{
background: #ddc7ea;
color: black;
background: linear-gradient(0deg, #ddc7ea 0%, #d19af1 100%);
}
.btn-copy:before{
height: 0%;
width: 2px;
}
.btn-copy:hover{
box-shadow: 4px 4px 6px 0 rgba(255,255,255,.5),
-4px -4px 6px 0 rgba(116, 125, 136, .5),
inset -4px -4px 6px 0 rgba(255,255,255,.2),
inset 4px 4px 6px 0 rgba(0, 0, 0, .4);
}

button:hover, input[type="button"]:hover {
transform: translateY(-3px);
}

/* Imágenes */
#cinnamoroll {
width: 250px;
position: absolute;
right: 20px;
top: 20px;
}

#flor, #flor2, #flor3 {
position: absolute;
}


#flor {
width: 100px;
bottom: 200px; /* Flor 1 - la de arriba */
left: 30px;
}

#flor2 {
width: 180px;
bottom: 10px; /* Flor 2 - la de en medio */
left: 20px;
}

#flor3 {
width: 100px;
bottom: 10px; /* Flor 3 - la de abajo */
left: 210px;
}

.footer{
font-family: Papyrus;
font-weight: bold;
font-size: 0.9em;
color: #554851;
padding: 10px;
}

footer{
display: flex;
justify-content: center;
flex-direction: row;
}






@media screen and (max-width: 768px) {

.encriptado {
display: flex;
flex-direction: column;
gap: 15px;
justify-content: center;
align-items: center;

}

textarea{
width: 100%;
height: 200px;
display: flex;
flex-direction: column;
justify-content: center;
}


button, input[type="button"] {
padding: 10px 20px;
font-size: 0.8em;
width: 100%;

}

.btn-copy, .btn-encriptar, .btn-desencriptar {
margin: 5px 0;
width:100%;


}

#flor,#flor2,#flor3 {
display:none;
}

#cinnamoroll {
width: 101px;
right: -1px;
top: 80px;

}

h1{
font-size: 1.5em;
padding: 10px;
}



}

0 comments on commit 59b16d5

Please sign in to comment.