Cancel autocomplete searches when starting new one
This commit is contained in:
@@ -45,7 +45,7 @@
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
display: block;
|
display: block;
|
||||||
border: 0;
|
border: 0;
|
||||||
background: rgba(255,255,255,.08);
|
background: none;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
background: #5c697b;
|
background: #5c697b;
|
||||||
margin: 4px 0 0;
|
margin: 4px 0 0;
|
||||||
width: 470px;
|
width: 470px;
|
||||||
min-height: 140px;
|
min-height: 50px;
|
||||||
box-shadow: 0 20px 20px -10px rgba(0,0,0,0.55);
|
box-shadow: 0 20px 20px -10px rgba(0,0,0,0.55);
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ Block.Search = new Class({
|
|||||||
self.el[self.q() ? 'addClass' : 'removeClass']('filled')
|
self.el[self.q() ? 'addClass' : 'removeClass']('filled')
|
||||||
|
|
||||||
if(self.q() != self.last_q){
|
if(self.q() != self.last_q){
|
||||||
|
if(self.api_request && self.api_request.isRunning())
|
||||||
|
self.api_request.cancel();
|
||||||
|
|
||||||
if(self.autocomplete_timer) clearTimeout(self.autocomplete_timer)
|
if(self.autocomplete_timer) clearTimeout(self.autocomplete_timer)
|
||||||
self.autocomplete_timer = self.autocomplete.delay(300, self)
|
self.autocomplete_timer = self.autocomplete.delay(300, self)
|
||||||
}
|
}
|
||||||
@@ -116,12 +119,9 @@ Block.Search = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
list: function(){
|
list: function(){
|
||||||
var self = this;
|
var self = this,
|
||||||
|
q = self.q(),
|
||||||
if(self.api_request && self.api_request.running) return
|
cache = self.cache[q];
|
||||||
|
|
||||||
var q = self.q();
|
|
||||||
var cache = self.cache[q];
|
|
||||||
|
|
||||||
self.hideResults(false);
|
self.hideResults(false);
|
||||||
|
|
||||||
@@ -164,9 +164,6 @@ Block.Search = new Class({
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(q != self.q())
|
|
||||||
self.list()
|
|
||||||
|
|
||||||
// Calculate result heights
|
// Calculate result heights
|
||||||
var w = window.getSize(),
|
var w = window.getSize(),
|
||||||
rc = self.result_container.getCoordinates();
|
rc = self.result_container.getCoordinates();
|
||||||
|
|||||||
Reference in New Issue
Block a user