From 91f666b522995f2f9233e717c7ecfbeb36714425 Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Wed, 25 May 2005 00:14:42 +0000 Subject: [PATCH] - #23506: Fix autocomplete throbber firing on wrong events. - Add simple throbber to drupal.css --- misc/autocomplete.js | 9 ++++++--- misc/drupal.css | 12 +++++++++++- misc/throbber.gif | Bin 0 -> 1336 bytes 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 misc/throbber.gif diff --git a/misc/autocomplete.js b/misc/autocomplete.js index 534b2fe4f510..658203dac61c 100644 --- a/misc/autocomplete.js +++ b/misc/autocomplete.js @@ -44,7 +44,6 @@ function jsAC(input, db) { var ac = this; this.input = input; this.db = db; - this.db.owner = this; this.input.onkeydown = function (event) { return ac.onkeydown(this, event); }; this.input.onkeyup = function (event) { ac.onkeyup(this, event) }; 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.left = pos.x +'px'; this.popup.style.width = (this.input.offsetWidth - 4) +'px'; - addClass(this.input, 'throbbing'); + this.db.owner = this; this.db.search(this.input.value); } @@ -241,7 +240,10 @@ ACDB.prototype.search = function(searchString) { clearTimeout(this.timer); } 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) { if (xmlhttp.status != 200) { + removeClass(acdb.owner.input, 'throbbing'); return alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ acdb.uri); } // Split into array of key->value pairs diff --git a/misc/drupal.css b/misc/drupal.css index 618b8ffd7cc5..cbd039428320 100644 --- a/misc/drupal.css +++ b/misc/drupal.css @@ -555,6 +555,7 @@ ul.secondary a.active { /* ** Autocomplete styles */ +/* Suggestion list */ #autocomplete { position: absolute; border: 1px solid; @@ -575,4 +576,13 @@ ul.secondary a.active { background: #0072b9; 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; +} diff --git a/misc/throbber.gif b/misc/throbber.gif new file mode 100644 index 0000000000000000000000000000000000000000..4352e64e859bb5e4d2e438f00d9d34c1d27462d1 GIT binary patch literal 1336 zcmZ?wbhEHbQ4?wxw{`P%dE_uhYh4g^5*`~UYq@csXH5cvQ7KL`K~ zSNzZI=Nc01>=@u`q-Vg)2on0q!pa7ub%2-wGjt;xM?96htN#UJ%?T-6rgZtrY<|Ka1OPl_mB6Jg*5LIzfMpw})>Vz{+posxMR zi-3r`qS(tB$*%Owi{%D!oL792{%`J$H8TJ!WCqrdP3uc@?o?A_*6SBIA!xCfoBN~lRKL}M9M}TG4QR6P1VqX}3Jj+37jp#`NeKl+ z>&)2Oz@T087*cX=&L8M`3NOk?4psB${7@Fdqq+!*ZTY z`Gde>Nly`jfCh%+>s)6fl&%oVSz>6|tzodh26yaXCJl3e3{HlJ4mJh>J;4c@TugrF zoRVf0bY%3*eemdGkJ{S6#H*_hFti2t8t>X5u