From d4377e0f49dc8dd5787f4466c9ab7f7e7cd37ec5 Mon Sep 17 00:00:00 2001 From: Andreas Erhard Date: Thu, 3 Aug 2017 20:34:22 +0200 Subject: [PATCH] keyboard controls and visuals closes #21 --- static/main.css | 13 +++++++++++-- static/main.js | 22 ++++++++++++++++++++++ templates/index.html | 3 +-- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/static/main.css b/static/main.css index 9f2c798..86106d7 100644 --- a/static/main.css +++ b/static/main.css @@ -96,11 +96,20 @@ div #reset:hover { } .sound a:hover { - background-color: #ff4136; - box-shadow: inset 5px 5px 5px rgba(0, 0, 0, 0.6); cursor: pointer; } +.sound a:active { + background-color: #ff4136; + box-shadow: inset 5px 5px 5px rgba(0, 0, 0, 0.6); + cursor: pointer; +} + +.sound-pressed { + background-color: #ff4136 !important; + box-shadow: inset 5px 5px 5px rgba(0, 0, 0, 0.6) !important; +} + .unselectable { -webkit-touch-callout: none; -webkit-user-select: none; diff --git a/static/main.js b/static/main.js index f5a682c..b33f0bd 100644 --- a/static/main.js +++ b/static/main.js @@ -6,6 +6,10 @@ function ready(fn) { } } +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + ready(function() { hideSections(); @@ -52,12 +56,29 @@ ready(function() { reset.addEventListener("click", resetSearch, false); sounds_nav.addEventListener("click", resetSearch, false); + // keyboard listener for esc button document.onkeydown = function(evt) { evt = evt || window.event; if (evt.keyCode == 27) { resetSearch(); } }; + + // keyboard listener for enter key + var all_a_s = document.getElementsByTagName("a"); + for(i=0; i
тип
{% for sound in sounds %} - + {% endfor %}
@@ -67,4 +67,3 @@ -