Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Kordian-Napoleon authored Dec 25, 2024
1 parent e7fd318 commit 0db742d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ document.addEventListener('DOMContentLoaded', () => {

// Obsługa kliknięcia przycisku START
document.getElementById('startButton').addEventListener('click', () => {
const informacja = informacjaInput.value.trim();
const klucz = kluczInput.value.trim();
const tablicaText = tablicaInput.value.trim();
let informacja = informacjaInput.value.replace(/\s+/g, '');
let klucz = kluczInput.value.replace(/\s+/g, '');
let tablicaText = tablicaInput.value.replace(/\s+/g, '');

if (!informacja) {
alert("Proszę wpisać tekst do szyfrowania lub deszyfrowania.");
Expand All @@ -43,6 +43,7 @@ document.addEventListener('DOMContentLoaded', () => {

// Funkcja do przetwarzania tekstu z pola 'Tablica'
function processTablica(tablicaText) {
tablicaText = tablicaText.replace(/\s+/g, '');
const tablicaArray = [];

for (let i = 0; i < tablicaText.length; i++) {
Expand Down Expand Up @@ -172,10 +173,4 @@ document.addEventListener('DOMContentLoaded', () => {
// Nasłuchiwanie kliknięcia na elementy
encryptSpan.addEventListener('click', () => selectOption('encrypt'));
decryptSpan.addEventListener('click', () => selectOption('decrypt'));

document.addEventListener('keydown', (event) => {
if (event.key === 'Enter') {
startButton.click(); // Kliknięcie przycisku start, gdy Enter jest naciśnięty
}
});
});

0 comments on commit 0db742d

Please sign in to comment.