From 5447fe79d39c5ca792a52237302094f249feffde Mon Sep 17 00:00:00 2001 From: Talitha Date: Mon, 5 Nov 2018 12:42:57 -0200 Subject: [PATCH] add switch case --- sapl/templates/painel/voto_nominal.html | 30 ++++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/sapl/templates/painel/voto_nominal.html b/sapl/templates/painel/voto_nominal.html index 187a23e66..59a6a83b3 100644 --- a/sapl/templates/painel/voto_nominal.html +++ b/sapl/templates/painel/voto_nominal.html @@ -97,7 +97,7 @@


-
+
@@ -133,16 +133,24 @@ $( "#votonao" ).mouseleave(function(){document.location.reload(true);}); $( "#votoabstencao" ).mouseleave(function(){document.location.reload(true);}); - $(document).on('keyup', (e) => {if (e.keyCode == 83){ - document.querySelectorAll("#votosim input")[0].click(); - - };}); - $(document).on('keyup', (e) => {if (e.keyCode == 78){ - document.querySelectorAll("#votonao input")[0].click(); - };}); - $(document).on('keyup', (e) => {if (e.keyCode == 65){ - document.querySelectorAll("#votoabstencao input")[0].click(); - };}); + $(document).on('keyup', (e) => { + var tecla_press = e.keyCode; + switch (tecla_press) { + case 83: // 83 = valor da tecla S + document.querySelectorAll("#votosim input")[0].click(); + break; + case 78: //78 = valor da tecla N + document.querySelectorAll("#votonao input")[0].click(); + break; + case 65: //65 = valor da tecla A + document.querySelectorAll("#votoabstencao input")[0].click(); + break; + case 86: //86 = valor da tecla V + document.querySelectorAll("#voltar button")[0].click(); + break; + + }; + }); $(document).ready( function(){