- #23506: Fix autocomplete throbber firing on wrong events.
- Add simple throbber to drupal.css4.7.x
parent
8aba3a430b
commit
91f666b522
|
|
@ -44,7 +44,6 @@ function jsAC(input, db) {
|
||||||
var ac = this;
|
var ac = this;
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.db = db;
|
this.db = db;
|
||||||
this.db.owner = this;
|
|
||||||
this.input.onkeydown = function (event) { return ac.onkeydown(this, event); };
|
this.input.onkeydown = function (event) { return ac.onkeydown(this, event); };
|
||||||
this.input.onkeyup = function (event) { ac.onkeyup(this, event) };
|
this.input.onkeyup = function (event) { ac.onkeyup(this, event) };
|
||||||
this.input.onblur = function () { ac.hidePopup() };
|
this.input.onblur = function () { ac.hidePopup() };
|
||||||
|
|
@ -181,7 +180,7 @@ jsAC.prototype.populatePopup = function () {
|
||||||
this.popup.style.top = (pos.y + this.input.offsetHeight) +'px';
|
this.popup.style.top = (pos.y + this.input.offsetHeight) +'px';
|
||||||
this.popup.style.left = pos.x +'px';
|
this.popup.style.left = pos.x +'px';
|
||||||
this.popup.style.width = (this.input.offsetWidth - 4) +'px';
|
this.popup.style.width = (this.input.offsetWidth - 4) +'px';
|
||||||
addClass(this.input, 'throbbing');
|
this.db.owner = this;
|
||||||
this.db.search(this.input.value);
|
this.db.search(this.input.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -241,7 +240,10 @@ ACDB.prototype.search = function(searchString) {
|
||||||
clearTimeout(this.timer);
|
clearTimeout(this.timer);
|
||||||
}
|
}
|
||||||
var db = this;
|
var db = this;
|
||||||
this.timer = setTimeout(function() { HTTPGet(db.uri +'/'+ searchString +'/'+ db.max, db.receive, db); }, this.delay);
|
this.timer = setTimeout(function() {
|
||||||
|
addClass(db.owner.input, 'throbbing');
|
||||||
|
HTTPGet(db.uri +'/'+ searchString +'/'+ db.max, db.receive, db);
|
||||||
|
}, this.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -249,6 +251,7 @@ ACDB.prototype.search = function(searchString) {
|
||||||
*/
|
*/
|
||||||
ACDB.prototype.receive = function(string, xmlhttp, acdb) {
|
ACDB.prototype.receive = function(string, xmlhttp, acdb) {
|
||||||
if (xmlhttp.status != 200) {
|
if (xmlhttp.status != 200) {
|
||||||
|
removeClass(acdb.owner.input, 'throbbing');
|
||||||
return alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ acdb.uri);
|
return alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ acdb.uri);
|
||||||
}
|
}
|
||||||
// Split into array of key->value pairs
|
// Split into array of key->value pairs
|
||||||
|
|
|
||||||
|
|
@ -555,6 +555,7 @@ ul.secondary a.active {
|
||||||
/*
|
/*
|
||||||
** Autocomplete styles
|
** Autocomplete styles
|
||||||
*/
|
*/
|
||||||
|
/* Suggestion list */
|
||||||
#autocomplete {
|
#autocomplete {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
|
|
@ -575,4 +576,13 @@ ul.secondary a.active {
|
||||||
background: #0072b9;
|
background: #0072b9;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
/* Animated throbber */
|
||||||
|
input.form-autocomplete {
|
||||||
|
background: url('throbber.gif') no-repeat 100% 2px;
|
||||||
|
}
|
||||||
|
input.form-autocomplete > * {
|
||||||
|
margin-right: 17px;
|
||||||
|
}
|
||||||
|
input.throbbing {
|
||||||
|
background-position: 100% -18px;
|
||||||
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Loading…
Reference in New Issue