diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..fbb5dc3 --- /dev/null +++ b/.eslintrc @@ -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 + } +} diff --git a/JS/app.js b/JS/app.js new file mode 100644 index 0000000..5a21f63 --- /dev/null +++ b/JS/app.js @@ -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) ; + }); +}); diff --git a/index.html b/index.html new file mode 100644 index 0000000..93a69d0 --- /dev/null +++ b/index.html @@ -0,0 +1,19 @@ + + + + + + + Cifrado + + +
+ Mensaje: + + + +
+ + + +