From 923ef50be2ef306de2423b2fb64dafcbaa783fa3 Mon Sep 17 00:00:00 2001 From: Rolux Date: Fri, 19 Feb 2010 16:27:19 +0530 Subject: [PATCH] autocomplete, continued --- build/css/ox.ui.css | 7 +++++-- build/js/ox.ui.js | 13 +++++++++++-- demos/test/index.html | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/build/css/ox.ui.css b/build/css/ox.ui.css index eecdc26..2238a03 100644 --- a/build/css/ox.ui.css +++ b/build/css/ox.ui.css @@ -430,11 +430,14 @@ Menus padding-top: 2px; font-size: 9px; } -.OxMainMenu .OxTitle.OxSelected { +.OxMainMenu > .OxTitle.OxSelected { background: rgb(48, 48, 48); background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(80, 80, 80)), color-stop(1, rgb(48, 48, 48))); } - +.OxMainMenu > .OxExtras { + float: right; + padding: 4px 12px 0 0; +} .OxMenu { diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 647c629..214b146 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -1720,6 +1720,7 @@ requires self.placeholder = data.value; // fixme: could be "title" as well if (that.$input.is(".OxPlaceholder")) { that.$input.val(self.placeholder); + //that.$input.focus(); } else { that.$input.focus(); call(); @@ -2165,8 +2166,7 @@ requires that.titles = []; that.layer = $("
").addClass("OxLayer"); - $.each(options.menus, function(position, menu) { - var event = + $.each(self.options.menus, function(position, menu) { that.titles[position] = $("
") .addClass("OxTitle") .html(menu.title) @@ -2180,6 +2180,15 @@ requires that.bindEvent("hide_" + that.menus[position].options("id"), onHideMenu); }); + if (self.options.extras.length) { + that.extras = $("
") + .addClass("OxExtras") + .appendTo(that.$element); + $.each(self.options.extras, function(position, extra) { + extra.appendTo(that.extras); + }); + } + function click(event) { var $target = $(event.target), position = typeof $target.data("position") != "undefined" ? diff --git a/demos/test/index.html b/demos/test/index.html index 88d15d9..7f0f6aa 100644 --- a/demos/test/index.html +++ b/demos/test/index.html @@ -60,6 +60,41 @@ })*/; var mainMenu = new Ox.MainMenu({ + extras: [ + new Ox.Input({ + autocomplete: { + "Find: Director": [ + "Luis Buñuel", + "Adam Curtis", + "Guy Debord", + "Rainer Werner Fassbinder", + "Jean-Luc Godard", + "Todd Haynes", + "Alfred Hitchcock", + "David Lynch", + "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" + ] + }, + clear: true, + highlight: true, + id: "find", + placeholder: ["Find: Director", "Find: Title"], + selected: 1 + }).width(256) + ], menus: [ { id: "oxjs",