add autocomplete menu

This commit is contained in:
rolux 2011-05-19 21:03:35 +02:00
parent 1fe6765e8b
commit 0fc5299bda

View file

@ -144,6 +144,19 @@ Ox.VideoEditor = function(options, self) {
videoRatio: self.options.videoWidth / self.options.videoHeight videoRatio: self.options.videoWidth / self.options.videoHeight
}); });
self.words = []
Ox.forEach(Ox.count(Ox.words(self.options.subtitles.map(function(subtitle) {
return subtitle.text;
}).join(' '))), function(count, word) {
self.words.push({count: count, word: word});
});
self.words = self.words.sort(function(a, b) {
return b.count - a.count;
}).map(function(obj) {
return obj.word;
});
Ox.print('WORDS', self.words)
self.$editor = new Ox.Element() self.$editor = new Ox.Element()
.addClass('OxVideoEditor') .addClass('OxVideoEditor')
.click(function(e) { .click(function(e) {
@ -447,6 +460,10 @@ Ox.VideoEditor = function(options, self) {
.appendTo(self.$menubar); .appendTo(self.$menubar);
self.$findInput = Ox.Input({ self.$findInput = Ox.Input({
autocomplete: self.words,
autocompleteSelect: true,
autocompleteSelectHighlight: true,
autocompleteSelectSubmit: true,
changeOnKeypress: true, changeOnKeypress: true,
placeholder: 'Find...', placeholder: 'Find...',
width: 96 width: 96