autocomplete, continued

This commit is contained in:
Rolux 2010-02-19 19:49:48 +05:30
parent 2b9893c514
commit fbedfe5da5
2 changed files with 30 additions and 15 deletions

View File

@ -454,8 +454,9 @@ requires
$(function() {
// fixme: how to do this better?
// in firefox, keypress doesn't fire for up/down
// in firefox on mac, keypress doesn't fire for up/down
// if the cursor is at the start/end of an input element
// on linux, it doesn't seem to fire if the input element has focus
if ($.browser.mozilla) {
$document.keypress(keypress);
$document.keydown(function(event) {
@ -1652,6 +1653,9 @@ requires
}
if (options.autocomplete) {
that.$input.attr({
autocomplete: "off"
});
self.autocompleteId = self.options.id + "_menu"; // fixme: we do this in other places ... are we doing it the same way? var name?
self.autocompleteMenu = new Ox.Menu({
element: that,
@ -1701,7 +1705,7 @@ requires
}
function callback(items) {
var selected = 0;
var selected = -1;
if (items.length) {
items = $.map(items, function(title, position) {
if (that.$input.val().toLowerCase() == Ox.stripTags(title.toLowerCase())) {

View File

@ -63,6 +63,18 @@
extras: [
new Ox.Input({
autocomplete: {
"Find: Title": [
"A bout de souffle",
"Casino",
"Diaries, Notes and Sketches",
"L'age d'or",
"Far From Heaven",
"In girum imus nocte et consumimur igni",
"It Felt Like a Kiss",
"Mulholland Dr.",
"Querelle",
"Vertigo"
],
"Find: Director": [
"Luis Buñuel",
"Adam Curtis",
@ -75,24 +87,23 @@
"Jonas Mekas",
"Martin Scorsese"
],
"Find: Title": [
"A bout de souffle",
"Casino",
"Diaries, Notes and Sketches",
"L'age d'or",
"Far From Heaven",
"In girum imus nocte et consumimur igni",
"It Felt Like a Kiss",
"Mulholland Dr.",
"Querelle",
"Vertigo"
"Find: Country": [
"Austria",
"Canada",
"France",
"Germany",
"Italy",
"Japan",
"Spain",
"Swizerland",
"UK",
"USA"
]
},
clear: true,
highlight: true,
id: "find",
placeholder: ["Find: Director", "Find: Title"],
selected: 1
placeholder: ["Find: Title", "Find: Director", "Find: Country"],
}).width(256)
],
menus: [