Pārlūkot izejas kodu

Add js/, index.js with working typing detection.

Add:
    static/js/
        -Add directory for all `javascript` files.

    static/js/index.js
        -Add functional search-bar typing-begin and typing-end detection.
        -Currently logs an appropriate message to the console in either state.
tags/v1.0^2
Severyn Kozak pirms 10 gadiem
vecāks
revīzija
6a9a25dfdf
1 mainītis faili ar 16 papildinājumiem un 0 dzēšanām
  1. +16
    -0
      static/js/index.js

+ 16
- 0
static/js/index.js Parādīt failu

@@ -0,0 +1,16 @@
var typingTimer;
var finishedTypingInterval = 650;

searchBar = document.querySelectorAll("form#search-bar input[type='text']")[0]
console.log(searchBar)

searchBar.onkeyup = function(){
clearTimeout(typingTimer);
if(searchBar.value){
typingTimer = setTimeout(finishedTyping, doneTypingInterval);
}
};

function finishedTyping(){
console.log("You stopped typing.");
}

Notiek ielāde…
Atcelt
Saglabāt