diff options
author | Marvin Borner | 2019-01-27 18:25:08 +0100 |
---|---|---|
committer | Marvin Borner | 2019-01-27 18:25:08 +0100 |
commit | 517736ae1d3813fb3bc7e32c36cd90906d530b91 (patch) | |
tree | 5791a8712fb1f32417b429283fe11cb426e859f3 /public/scripts/4_input_pin.js | |
parent | dfce4c5a178275f4b7226ae397226cbbf84571a8 (diff) |
Cleaned up code
Diffstat (limited to 'public/scripts/4_input_pin.js')
-rw-r--r-- | public/scripts/4_input_pin.js | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/public/scripts/4_input_pin.js b/public/scripts/4_input_pin.js deleted file mode 100644 index b496e95..0000000 --- a/public/scripts/4_input_pin.js +++ /dev/null @@ -1,57 +0,0 @@ -const $ = require('jquery'); -let pin = []; - -/** - * Initializes actions of the pin input field - * @param callback - */ -function init(callback) { - let tryCount = 0; - - $('#1').focus().on('input', (el) => { - pin.push($(el.target).val()); - $(el.target).val('*'); - $('#' + (parseInt($(el.target).attr('id')) + 1).toString()).focus(); - }); - - $('#2').on('input', (el) => { - pin.push($(el.target).val()); - $(el.target).val('*'); - $('#' + (parseInt($(el.target).attr('id')) + 1).toString()).focus(); - }); - - $('#3').on('input', (el) => { - pin.push($(el.target).val()); - $(el.target).val('*'); - $('#' + (parseInt($(el.target).attr('id')) + 1).toString()).focus(); - }); - - $('#4').on('input', (el) => { - pin.push($(el.target).val()); - $(el.target).val('*'); - tryCount++; - callback(pin.join(''), tryCount) - }); -} - -/** - * Displays error message and clears input - */ -function isWrong(message) { - $('#pin_message').text(message); - for (let i = 1; i < 5; i++) $(`#${i}`).val(''); - $('#1').focus(); - pin = []; -} - -/** - * Display generation message - */ -function needsGeneration() { - // TODO: Add loading animation - $('#pin_message').text('Generating keys...'); -} - -exports.init = init; -exports.failure = isWrong; -exports.generate = needsGeneration; |