From e68ed8b01706cf0a1e27058e413bde2e5d62df90 Mon Sep 17 00:00:00 2001 From: Bernidpv Date: Mon, 12 Jun 2023 12:40:02 -0400 Subject: [PATCH 01/33] Index js modificado --- src/index.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 58ba255..98cb7ad 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,32 @@ import analyzer from './analyzer.js'; -//TODO: escuchar eventos del DOM e invocar los métodos del objeto `analyzer` \ No newline at end of file +// //TODO: escuchar eventos del DOM e invocar los métodos del objeto `analyzer` + +const textarea= document.querySelector("textarea[name='user-input']"); +textarea.addEventListener("keyup",function(){ + const contenido = textarea.value; + + const contarCaracteres = analyzer.getCharacterCount(contenido); + document.getElementById("contarCaracteres").innerHTML = contarCaracteres; + + const contarPalabras = analyzer.getWordCount(contenido); + document.getElementById("contarPalabras").innerHTML = contarPalabras; + + const sinCaracteres = analyzer.getCharacterCountExcludingSpaces(contenido); + document.getElementById("sinCaracteres").innerHTML = sinCaracteres; + + const longitudPromedio = analyzer.getAverageWordLength(contenido); + document.getElementById("longitudPromedio").innerHTML = longitudPromedio; + + const contarNumeros = analyzer.getNumberCount(contenido); + document.getElementById("contarNumeros").innerHTML = contarNumeros; + + const sumaNumeros = analyzer.getNumberSum(contenido); + document.getElementById("sumaNumeros").innerHTML = sumaNumeros; +}) + +const button= document.getElementById("reset-button"); +button.addEventListener("click",()=>{ + const textarea = document.querySelector("textarea[name='user-input']"); + textarea.value=''; +}); \ No newline at end of file From acd39c2f242359ad13b2a53b4f8a231d9f9faf4e Mon Sep 17 00:00:00 2001 From: Bernidpv Date: Mon, 12 Jun 2023 12:42:55 -0400 Subject: [PATCH 02/33] actualizacion con cosas previsas --- src/analyzer.js | 8 ++++ src/index.html | 36 +++++++++++++++-- src/style.css | 103 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 143 insertions(+), 4 deletions(-) diff --git a/src/analyzer.js b/src/analyzer.js index 85797a8..d214055 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -1,8 +1,13 @@ const analyzer = { + getWordCount: (text) => { + const cantidadDePalabras = text.split(" ").length; + return cantidadDePalabras; //TODO: esta función debe retornar el recuento de palabras que se encuentran en el parámetro `text` de tipo `string`. }, getCharacterCount: (text) => { + const cantidadDeLetras = text.length; + return cantidadDeLetras; //TODO: esta función debe retornar el recuento de caracteres que se encuentran en el parámetro `text` de tipo `string`. }, getCharacterCountExcludingSpaces: (text) => { @@ -12,6 +17,9 @@ const analyzer = { //TODO: esta función debe retornar la longitud media de palabras que se encuentran en el parámetro `text` de tipo `string`. }, getNumberCount: (text) => { + let contenidoSinNumeros = text.replace(/\D/g,''); + let numerosEnTotal = contenidoSinNumeros.length; + return numerosEnTotal; //TODO: esta función debe retornar cúantos números se encuentran en el parámetro `text` de tipo `string`. }, getNumberSum: (text) => { diff --git a/src/index.html b/src/index.html index 3f32ea9..a2e93fa 100644 --- a/src/index.html +++ b/src/index.html @@ -3,11 +3,39 @@ - Analizador de texto + Proyecto1 - - - + + + +
+

Analizador de texto

+
+ +

+

+

+ + + +
+ +
+ +
+

Bernardita del Pino Villaseca

+
+ + + \ No newline at end of file diff --git a/src/style.css b/src/style.css index e69de29..437eebf 100644 --- a/src/style.css +++ b/src/style.css @@ -0,0 +1,103 @@ +.centrar{ + text-align: -webkit-center; +} + +header{ + text-align: -webkit-center; + font-family: math; + color: white; + background-color: #9376E0; + margin: 30px; + border: solid 3px; + border-radius: 16px; + border-color: #9376E0; +} + +.colorDeFondo{ + background-image: url('https://i.pinimg.com/736x/bb/87/b1/bb87b128cb37e85e4c6f28ddf99639b3.jpg'); +} + +.cuadroDeTexto{ + text-align: -webkit-center; + font-family: math; + color: #9376E0; + max-width: -webkit-fill-available; + margin: 50px; + width: 1000px; + height: 137px; + resize: none; + margin-top: 0px; + margin-left: 150px; + font-size: 18px; + color: black; + font-family: math; + border-radius: 24px; +} + +.ul-estilo{ + position: relative; + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-content: flex-start; + justify-content: center; + align-items: baseline; + justify-content: center; +} + +.li-Estilo{ + background-color: bisque; + border-radius: 10px; + border: solid 2px white; + width: 186px; + height: 42px; + font-family: math; + font-size: 14px; + padding: 9px; + margin: 9px; +} + +.reset-button{ + + border: solid 2px white; + width: 93px; + height: 50px; + font-family: math; + font-size: 14px; + padding: 9px; + margin: 9px; + margin-left: auto; + margin-right: auto; +} + + +footer{ + text-align: -webkit-center; + font-family: math; + color: white; + background-color: #9376E0; + max-width: -webkit-fill-available; + margin: 50px; + border: solid 10p; + border-radius: 16px; + border-color: #9376E0; + width: 100%; +} + +.cuadroResultado{ + width: 50px; + height: 20px; + background-color: white; +} + +.separadoDeLineas{ + line-height: 2; +} + +.textAreaNoModificable{ + resize: none; + /* float: right; */ + margin-left: 6px; + width: 20px; + height: 20px; +} \ No newline at end of file From b568de40471dd1031f98175492c4465ff1653c53 Mon Sep 17 00:00:00 2001 From: Bernidpv Date: Mon, 12 Jun 2023 12:43:48 -0400 Subject: [PATCH 03/33] prueba --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8d41210..f0da627 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "card-validation", + "name": "text-analyzer", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "card-validation", + "name": "text-analyzer", "version": "1.0.0", "license": "MIT", "devDependencies": { From 0d3b55ea49d17d610ed9310078beca133b52b01e Mon Sep 17 00:00:00 2001 From: Bernidpv Date: Mon, 12 Jun 2023 16:50:08 -0400 Subject: [PATCH 04/33] test ok css y html --- src/index.html | 23 ++++++------- src/index.js | 8 ++--- src/style.css | 91 +++++++++++++++++++++++--------------------------- 3 files changed, 56 insertions(+), 66 deletions(-) diff --git a/src/index.html b/src/index.html index a2e93fa..9fe9e88 100644 --- a/src/index.html +++ b/src/index.html @@ -8,34 +8,33 @@ - -
-

Analizador de texto

+
+

Analizador de texto

    -
  • Recuento de caracteres
  • -
  • Recuento de palabras
  • -
  • Sin caracteres
  • -
  • Promedio de longitud
  • -
  • Recuento de numeros
  • -
  • Suma de numeros
  • +
  • Recuento de caracteres
  • +
  • Recuento de palabras
  • +
  • Sin caracteres
  • +
  • Promedio de longitud
  • +
  • Recuento de numeros
  • +
  • Suma de numeros

-
-