From 9926fbe7ddb787a440cb80dbd1a60615cc007005 Mon Sep 17 00:00:00 2001 From: Luba Orlova Date: Wed, 20 Mar 2024 20:12:11 -0600 Subject: [PATCH] first commit --- assets/css/normalize.css | 349 +++++++++++++++++++++++++++++++++ assets/css/style.css | 256 ++++++++++++++++++++++++ "assets/img/Mu\303\261eco.svg" | 139 +++++++++++++ assets/img/alert.svg | 3 + assets/img/logo__alura.svg | 3 + assets/js/script.js | 89 +++++++++ index.html | 59 ++++++ 7 files changed, 898 insertions(+) create mode 100644 assets/css/normalize.css create mode 100644 assets/css/style.css create mode 100644 "assets/img/Mu\303\261eco.svg" create mode 100644 assets/img/alert.svg create mode 100644 assets/img/logo__alura.svg create mode 100644 assets/js/script.js create mode 100644 index.html diff --git a/assets/css/normalize.css b/assets/css/normalize.css new file mode 100644 index 0000000..192eb9c --- /dev/null +++ b/assets/css/normalize.css @@ -0,0 +1,349 @@ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + +html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +/** + * Render the `main` element consistently in IE. + */ + +main { + display: block; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type="button"], +[type="reset"], +[type="submit"] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 0000000..20b4701 --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,256 @@ +:root { + --colorAlura: #0a3871; + --colorTextAlura: #495057; + --textSerif: sans-serif; +} + +img { + max-width: 100%; +} + +body { + background-color: #E5E5E5; + display: grid; + grid-template-columns: 10% 60% 30%; +} + +/* logo Alura */ +.logo__Alura { + width: 25px; + display: block; + margin: 15% auto; +} + +/* main */ +.container { + margin-top: 90px; +} + +.areaEncriptar { + color: var(--colorAlura); + background: none; + border: 0; + resize: none; + font-family: var(--textSerif); + font-size: 25px; + width: 90%; + height: 65%; + +} + +.areaEncriptar::placeholder { + color: var(--colorAlura); +} + +.areaEncriptar:focus { + outline: 0; +} + + +/* texto */ +.alerta__text { + display: flex; +} + +.img__alert { + display: block; + padding: 1%; +} + +.texto { + display: inline-block; + color: var(--colorTextAlura); + font-family: var(--textSerif); +} + +.text__bold { + font-weight: bold; + color: #000; + text-align: center; +} + +.text__center { + text-align: center; +} + +.tex_encriptado { + margin: 0 auto; + line-height: 30px; + height: 70%; + width: 90%; +} + +/* botones */ + +.botones { + width: 90%; + padding: 1%; + display: flex; + justify-content: space-around; +} + +.botonStyle { + width: 47%; + cursor: pointer; + font-family: var(--textSerif); + padding: 15px 10px; + border-radius: 15px; + -webkit-border-radius: 15px; + -moz-border-radius: 15px; + -ms-border-radius: 15px; + -o-border-radius: 15px; +} + +.btn__encriptar { + color: #fff; + background-color: var(--colorAlura); + border: none; +} + +.btn__desencriptar { + color: var(--colorAlura); + border-color: var(--colorAlura); + background-color: transparent; + +} + +.boton__aside { + margin: 0 auto; + width: 80%; + background-color: #fff; + padding: 15px 10px; +} + + + +/* aside */ +.cuadro__aside { + position: relative; + background-color: #fff; + box-shadow: 1px 1px 30px 1px rgb(215, 208, 208); + border-radius: 23px; + -webkit-border-radius: 23px; + -moz-border-radius: 23px; + -ms-border-radius: 23px; + -o-border-radius: 23px; + padding: 15px; + margin: 7% 9% 0; + height: 85vh; + text-align: center; + display: flex; + flex-direction: column; + justify-content: center; +} + +.txtcopiado { + position: absolute; + bottom: 120px; + left: 37%; + background-color: var(--colorAlura); + padding: 5px; + width: 70px; + font-size: 15px; + color: #fff; + font-family: var(--textSerif); + border-radius: 20px; + -webkit-border-radius: 20px; + -moz-border-radius: 20px; + -ms-border-radius: 20px; + -o-border-radius: 20px; +} + + +/* medida para tablet */ +@media screen and (max-width: 1024px) { + body { + display: block; + padding: 3%; + } + + /* logos alura */ + .logo__Alura { + width: 35px; + display: block; + position: absolute; + top: 100px; + left: 70px; + margin: 1px auto; + } + + .contente__alura { + position: relative; + height: 50px; + } + + /* campo de textarea */ + .container { + margin-top: 190px; + } + + .areaEncriptar { + font-size: 40px; + width: 100%; + height: 40vh; + + } + + .botonStyle{ + font-size: 25px; + } + .botones { + width: 100%; + + } + /* campo texto aside */ + .tex_encriptado{ + font-size: 35px; + } + .text__1{ + font-size: 25px; + } + + /* munieco aside */ + .img__munieco { + display: none; + } + + .cuadro__aside { + margin: 3% 1% ; + height: auto; + + } + .tex_encriptado { + height: 30vh; + width: 100%; + } + +} + +/* medida para celular */ +@media screen and (max-width: 601px) { + .botones{ + display: flex; + flex-wrap: wrap; + } + .botonStyle{ + width: 90%; + margin: 10px 0px; + font-size: 30px; + padding: 25px 10px; + } + +} + + + + + + +.mostrar { + display: block; + +} + +.ocultar { + display: none; +} \ No newline at end of file diff --git "a/assets/img/Mu\303\261eco.svg" "b/assets/img/Mu\303\261eco.svg" new file mode 100644 index 0000000..63aea21 --- /dev/null +++ "b/assets/img/Mu\303\261eco.svg" @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/img/alert.svg b/assets/img/alert.svg new file mode 100644 index 0000000..4d71217 --- /dev/null +++ b/assets/img/alert.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/img/logo__alura.svg b/assets/img/logo__alura.svg new file mode 100644 index 0000000..1234c83 --- /dev/null +++ b/assets/img/logo__alura.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/js/script.js b/assets/js/script.js new file mode 100644 index 0000000..6efb86a --- /dev/null +++ b/assets/js/script.js @@ -0,0 +1,89 @@ +let areaEncriptar = document.getElementById("areaEncriptar"); + +const btnEncriptar = document.querySelector(".btn__encriptar"); +const btnDesencriptar = document.querySelector(".btn__desencriptar"); + +const elements = document.querySelectorAll(".elements"); + +const btnCopiar = document.querySelector(".boton__aside"); +const txtcopiado = document.querySelector(".txtcopiado"); + +let textEncriptado = document.querySelector(".tex_encriptado"); + +// ocultamos los elementos no deseados del aside +const ocultarElementos = () => { + elements.forEach((elemento) => elemento.classList.add("ocultar")); + btnCopiar.classList.remove("ocultar"); + textEncriptado.classList.remove("ocultar"); +}; + +// código para encriptar +const encriptar = () => { + let texto = areaEncriptar.value; + texto = texto + .replaceAll(/e/gi, "enter") + .replaceAll(/i/gi, "imes") + .replaceAll(/o/gi, "ober") + .replaceAll(/a/gi, "ai") + .replaceAll(/u/gi, "ufat"); + textEncriptado.value = texto; + areaEncriptar.value = ""; +}; + +// código para desencriptar +const desenCriptar = () => { + let texto = areaEncriptar.value; + texto = texto + .replaceAll(/enter/gi, "e") + .replaceAll(/imes/gi, "i") + .replaceAll(/ober/gi, "o") + .replaceAll(/ai/gi, "a") + .replaceAll(/ufat/gi, "u"); + textEncriptado.value = texto; + areaEncriptar.value = ""; +}; + +//comprobamos los campos vacíos, de ser true recargamos la pagina automáticamente +const comprobarVacios = () => { + if (areaEncriptar.value.trim() == "") { + alert("ingresa una palabra"); + location.reload(); + } +}; + +// detectamos si tiene activado el Bloq Mayus para las letras mayúsculas +areaEncriptar.addEventListener("keyup", (event) => { + if (event.getModifierState("CapsLock")) { + alert("Solo se puede escribir en minúscula"); + location.reload(); + } +}); + +// encriptamos el texto +btnEncriptar.addEventListener("click", () => { + comprobarVacios(); + ocultarElementos(); + encriptar(); +}); + +// desencriptamos el texto +btnDesencriptar.addEventListener("click", () => { + comprobarVacios(); + ocultarElementos(); + desenCriptar(); +}); + +// boton de copiar +btnCopiar.addEventListener("click", () => { + // accedemos a los valores + textEncriptado.select(); + textEncriptado.setSelectionRange(0, 99999); + + navigator.clipboard.writeText(textEncriptado.value); + + //agregamos y quitamos el anuncio de copiado + txtcopiado.classList.remove("ocultar"); + setTimeout(() => { + txtcopiado.classList.add("ocultar"); + }, 1000); +}); diff --git a/index.html b/index.html new file mode 100644 index 0000000..8790110 --- /dev/null +++ b/index.html @@ -0,0 +1,59 @@ + + + + + + + + + Encriptador de texto + + +
+ imagen de logo de Alura +
+ +
+ +
+ imagen de alerta +

Solo letras minúsculas y sin acentos

+
+
+ + +
+
+ + + + + + +