X-Git-Url: https://git.mdrn.pl/copyspeak.git/blobdiff_plain/7cca0ec1d838201a964c3aba93e63fbec6faacbb..b61fb61373dbb41f789aa0f28c5d944a53d36027:/src/copyspeak/static/js/word_detail.js diff --git a/src/copyspeak/static/js/word_detail.js b/src/copyspeak/static/js/word_detail.js new file mode 100644 index 0000000..dfb502b --- /dev/null +++ b/src/copyspeak/static/js/word_detail.js @@ -0,0 +1,16 @@ +document.onkeydown = function(e) { + if (!e) e = window.event; + var keynum = e.keyCode ? e.keyCode : e.which; // IE vs others + switch (keynum) { + case 37: + var link = document.getElementById('previous-card'); + link.setAttribute('class', 'active'); + location.href = link.getAttribute('href'); + return false; + case 39: + var link = document.getElementById('next-card'); + link.setAttribute('class', 'active'); + location.href = link.getAttribute('href'); + return false; + } +};