-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcondition_logic.js
46 lines (31 loc) · 1.05 KB
/
condition_logic.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$( document ).ready(function() {
sourcetype = 0;
referencetype = 0;
$("[name='source']").on('changed.bs.select', function (e) {
console.log(this.value);
sourcetype = this.value;
update_source_field(this.value);
});
$("[name='reference']").on('changed.bs.select', function (e) {
console.log(this.value);
referencetype = this.value;
update_reference_field(this.value);
});
//setup before functions
var typingTimer; //timer identifier
var doneTypingInterval = 100; //time in ms, 5 second for example
var $input = $('.container');
//on keyup, start the countdown
$input.on('keyup', function () {
clearTimeout(typingTimer);
typingTimer = setTimeout(doneTyping, doneTypingInterval);
});
//on keydown, clear the countdown
$input.on('keydown', function () {
clearTimeout(typingTimer);
});
//user is "finished typing," do something
function doneTyping () {
generate_sql();
}
});