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); |
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(); |
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) |
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 |
|
|
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) { |