Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

Añadiendo arreglos con EsLint #80

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"parserOptions": {
"ecmaVersion": 6
},
"rules": {
"keyword-spacing": 1,
"space-before-function-paren": [1, "never"],
"eqeqeq": 1,
"space-infix-ops": 1,
"comma-spacing": 1,
"brace-style": 1,
"no-multiple-empty-lines": 1,
"camelcase": 1,
"func-call-spacing": 1,
"key-spacing": 1,
"semi": 1,
"no-floating-decimal": 1,
"no-multi-spaces": 1,
"object-property-newline": 1,
"padded-blocks": [1, "never"],
"space-before-blocks": 1,
"space-in-parens": 1,
"spaced-comment": 1,
"quotes": [1, "single"],
"id-length": [1, { "exceptions": ["i", "j", "x"] }],
"indent": [1, 2],
"no-array-constructor": 1
}
}
31 changes: 31 additions & 0 deletions JS/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
$(document).ready(function() {
$('#text').focus();
//Funcion para Codificar
$('#code').on('click', function cipher() {
const str = $('#text').val();
let unicode;
let word;
let newPhrase= '';
for (i = 0; i <= str.length - 1; i++) {
unicode = str.charCodeAt(i);
word = (unicode - 97 + 33) % 26 + 97;
let neWord = String.fromCharCode(word);
newPhrase = newPhrase.concat(neWord);
}
return document.write('Tu frase codificada es: ' + newPhrase);
});
//Función para Decodificar
$('#decode').on('click', function decipher() {
const str2 = $('#text').val();
let unicode2;
let word2;
let newPhrase2 = '';
for (var i = 0; i <= str2.length - 1; i++) {
unicode2 = str2.charCodeAt(i);
word2 = (unicode2 + 97 + 33) % 26 + 97;
let neWord2 = String.fromCharCode(word2);
newPhrase2 = newPhrase2.concat(neWord2);
}
return document.write('Tu frase decodificada es: ' + newPhrase2) ;
});
});
19 changes: 19 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Cifrado</title>
</head>
<body>
<div>
<span>Mensaje: </span>
<input id="text" type="text" name="" value="">
<input id="code" type="button" value="Codificar">
<input id="decode" type="button" value="Decodificar">
</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="js/app.js"></script>
</body>
</html>