Skip to content

Commit

Permalink
feat: creates invalid decoding notification
Browse files Browse the repository at this point in the history
  • Loading branch information
weessm committed Jan 25, 2024
1 parent 444cbf7 commit b20bac4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Uma ferramenta simples e eficiente para mensagens codificadas. Este projeto foi

## Funcionalidades

- **Decodificação Simples:** É possível criptografar e descriptografar mensagens de maneira rápida e fácil.
- **Decodificação Simples:** É possível converter uma palavra para a versão criptografada e retornar para a versão original de maneira rápida e fácil.
- **Interface Intuitiva:** Navegue por uma interface limpa e intuitiva, projetada para ser direto ao ponto.
- **Restrição:** Aceita apenas letras minúsculas sem acentos nem caracteres especiais.

## Como Usar

Expand Down
26 changes: 25 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const action = {
checkText: (text) => {
const regex = /^[a-z\s]+$/;

return regex.test(text)
return regex.test(text);
},

decodeText: (operation) => {
Expand All @@ -53,6 +53,8 @@ const action = {

if (action.checkText(sendField.trim())) {
receiveField.innerHTML = operation(sendField.trim());
} else {
notification.invalidDecode();
}
},

Expand Down Expand Up @@ -80,4 +82,26 @@ const notification = {
copyButton.innerHTML = 'Copiar';
}, 500);
},

invalidDecode: () => {
let notifyField = document.getElementById('main__input__warning__text');
let notifyIcon = document.getElementById('main__input__warning__icon');
let count = 0;

const interval = setInterval(() => {
if(count % 2 === 0) {
notifyField.style.color = '#FF0000';
notifyIcon.style.backgroundColor = '#FF0000';
} else {
notifyField.style.color = 'transparent';
notifyIcon.style.backgroundColor = 'transparent';
}

if (++count === 20) {
clearInterval(interval);
notifyField.style.color = '#110F0F';
notifyIcon.style.backgroundColor = '#008CDB';
}
}, 100);
},
}

0 comments on commit b20bac4

Please sign in to comment.