/[webpac2]/Webpacus/root/js/controls.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Webpacus/root/js/controls.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 104 by dpavlin, Mon Nov 21 17:46:27 2005 UTC revision 105 by dpavlin, Tue Nov 22 19:34:27 2005 UTC
# Line 73  Autocompleter.Base.prototype = { Line 73  Autocompleter.Base.prototype = {
73      this.active      = false;      this.active      = false;
74      this.index       = 0;          this.index       = 0;    
75      this.entry_count = 0;      this.entry_count = 0;
76        this.in_dropdown = false;
77    
78      if (this.setOptions)      if (this.setOptions)
79        this.setOptions(options);        this.setOptions(options);
# Line 145  Autocompleter.Base.prototype = { Line 146  Autocompleter.Base.prototype = {
146        switch(event.keyCode) {        switch(event.keyCode) {
147         case Event.KEY_TAB:         case Event.KEY_TAB:
148         case Event.KEY_RETURN:         case Event.KEY_RETURN:
149           this.select_entry();           if (this.in_dropdown) this.select_entry();
150           Event.stop(event);           Event.stop(event);
151         case Event.KEY_ESC:         case Event.KEY_ESC:
152           this.hide();           this.hide();
# Line 164  Autocompleter.Base.prototype = { Line 165  Autocompleter.Base.prototype = {
165           this.render();           this.render();
166           if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);           if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
167           return;           return;
168           default:
169             this.in_dropdown = false;
170        }        }
171       else       else
172        if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN)        if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN)
# Line 204  Autocompleter.Base.prototype = { Line 207  Autocompleter.Base.prototype = {
207    render: function() {    render: function() {
208      if(this.entry_count > 0) {      if(this.entry_count > 0) {
209        for (var i = 0; i < this.entry_count; i++)        for (var i = 0; i < this.entry_count; i++)
210          this.index==i ?          this.index==i && this.in_dropdown ?
211            Element.addClassName(this.get_entry(i),"selected") :            Element.addClassName(this.get_entry(i),"selected") :
212            Element.removeClassName(this.get_entry(i),"selected");            Element.removeClassName(this.get_entry(i),"selected");
213                    
# Line 221  Autocompleter.Base.prototype = { Line 224  Autocompleter.Base.prototype = {
224    mark_previous: function() {    mark_previous: function() {
225      if(this.index > 0) this.index--      if(this.index > 0) this.index--
226        else this.index = this.entry_count-1;        else this.index = this.entry_count-1;
227        this.in_dropdown = true;
228    },    },
229        
230    mark_next: function() {    mark_next: function() {
231      if(this.index < this.entry_count-1) this.index++      if(this.index < this.entry_count-1) this.index++
232        else this.index = 0;        else this.index = 0;
233        if (! this.in_dropdown) this.index = 0;
234        this.in_dropdown = true;
235    },    },
236        
237    get_entry: function(index) {    get_entry: function(index) {

Legend:
Removed from v.104  
changed lines
  Added in v.105

  ViewVC Help
Powered by ViewVC 1.1.26