Permalink
Browse files

Updated Meio.Autocomplete.

  • Loading branch information...
1 parent 9d98f0d commit 040841de94b917a3e2c70b8d2f1907a295f03f24 @MattiSG committed Aug 14, 2010
Showing with 22 additions and 11 deletions.
  1. +12 −3 Assets/Meio.Autocomplete.js
  2. +10 −8 Demo/meio.autocomplete.css
@@ -4,6 +4,7 @@ description: A plugin for enabling autocomplete of a text input or textarea.
authors:
- Fábio Miranda Costa
+ - Matti Schneider-Ghibaudo
requires:
- core/1.2.4: [Class.Extras, Element.Event, Element.Style]
@@ -72,8 +73,8 @@ provides: [Meio.Autocomplete]
this.elements[name] = obj;
},
- addEventToElement: function(name, eventName, event){
- this.elements[name].addEvent(eventName, event.bindWithEvent(this));
+ addEventToElement: function(name, eventName, event, bind){
+ this.elements[name].addEvent(eventName, event.bindWithEvent(bind || this));
},
addEventsToElement: function(name, events){
@@ -118,7 +119,7 @@ provides: [Meio.Autocomplete]
filter: {
/*
- its posible to pass the filters directly or by passing a type and optionaly a path.
+ It is possible to pass the filters directly or by passing a type and optionally a path.
filter: function(text, data){}
formatMatch: function(text, data, i){}
@@ -234,6 +235,11 @@ provides: [Meio.Autocomplete]
if (this.active && !e.dontHide) this.setInputValue();
}
});
+ this.addEventToElement('list', 'focusItem', function(item) {
+ if (! this.elements.list.focusedItem) return;
+ var index = this.elements.list.focusedItem.get('data-index');
+ this.fireEvent('highlight', [this.elements, (item ? this.itemsData[index] : null)]);
+ }, this);
},
update: function(){
@@ -682,6 +688,8 @@ provides: [Meio.Autocomplete]
this.focusedItem = newFocusedItem;
}
}
+ if (newFocusedItem)
+ this.fireEvent('focusItem', [newFocusedItem]);
},
scrollFocusedItem: function(direction){
@@ -723,6 +731,7 @@ provides: [Meio.Autocomplete]
hide: function(){
this.showing = false;
this.node.setStyle('visibility', 'hidden');
+ this.fireEvent('focusItem', null);
}
});
@@ -5,31 +5,33 @@ description: A plugin for enabling autocomplete of a text input or textarea.
authors:
- Fábio Miranda Costa
+ - Matti Schneider-Ghibaudo
license: MIT-style license
...
*/
-.ma-container{
+.ma-container {
color: #000;
border: 1px solid #333;
background-color: #fff;
position: absolute;
visibility: hidden;
overflow-y: auto;
overflow-x: hidden;
+ z-index: 1000;
}
-.ma-container ul{
+.ma-container ul {
list-style: none;
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
}
-.ma-container li{
+.ma-container li {
padding: 2px 5px;
line-height: 16px;
cursor: pointer;
@@ -38,22 +40,22 @@ license: MIT-style license
overflow: hidden;
}
-.ma-container .ma-hover{
+.ma-container .ma-hover {
color: #fff;
background-color: #921506 !important;
}
-.ma-container .ma-odd{
+.ma-container .ma-odd {
}
-.ma-container .ma-even{
+.ma-container .ma-even {
background-color: #efefef;
}
-.ma-loading{
+.ma-loading {
background-color: #fafba4;
}
-.ma-selected{
+.ma-selected {
background-color: #ccfda8;
}

0 comments on commit 040841d

Please sign in to comment.