Skip to content

Commit 6dfb426

Browse files
author
Hailgrim
committed
Some updates
1 parent 9c5bf8e commit 6dfb426

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

index.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,17 @@
7575
<script>
7676
function encrypt() {
7777
const text = document.querySelector('#decrypted')?.value;
78+
7879
if (!text) {
7980
alert('Please, enter the encryption text!');
8081
return;
8182
}
8283

83-
const result = document.querySelector('#encrypted');
8484
let cursor = 0;
8585
let output = '';
86-
86+
const result = document.querySelector('#encrypted');
8787
const key = prompt('Enter the encryption key:', '');
88+
8889
if (result && key) {
8990
for (let i = 0; i < text.length; i++) {
9091
if (cursor > (key.length - 1)) cursor = 0;
@@ -100,15 +101,17 @@
100101
}
101102
function decrypt() {
102103
const text = document.querySelector('#encrypted')?.value.split(' ');
104+
103105
if (!text) {
104106
alert('Please, enter the encrypted text!');
105107
return;
106108
}
107109

108-
const result = document.querySelector('#decrypted');
109110
let cursor = 0;
110111
let output = '';
112+
const result = document.querySelector('#decrypted');
111113
const key = prompt('Enter the decryption key:', '');
114+
112115
if (result && key) {
113116
for (let i = 0; i < text.length; i++) {
114117
if (cursor > (key.length - 1)) { cursor = 0; }

0 commit comments

Comments
 (0)