1
0
Fork 0
forked from 0x2620/oxjs

less obscure Ox.map

This commit is contained in:
rolux 2012-05-22 16:29:37 +02:00
commit 12cf77cef5
21 changed files with 125 additions and 101 deletions

View file

@ -328,7 +328,7 @@ Ox.AnnotationFolder = function(options, self) {
}
function getAnnotations() {
return Ox.map(self.options.items, function(item) {
return Ox.filter(self.options.items, function(item) {
return self.editing && item.id == self.options.selected || (
(
self.options.range == 'all' || (
@ -344,7 +344,7 @@ Ox.AnnotationFolder = function(options, self) {
self.options.users == 'all'
|| self.options.users.indexOf(item.user) > -1
)
) ? item : null;
);
});
}

View file

@ -425,11 +425,11 @@ Ox.VideoEditor = function(options, self) {
{key: 'G', action: 'Go to Next Result'},
{key: Ox.UI.symbols['return'], action: 'Edit/Submit'},
{key: Ox.UI.symbols.escape, action: 'Cancel/Deselect'}
], Ox.map(self.options.layers, function(layer, i) {
], Ox.filter(self.options.layers.map(function(layer, i) {
return layer.editable
? {key: i + 1, action: 'Add ' + layer.item}
: null;
})).forEach(function(shortcut) {
}))).forEach(function(shortcut) {
self.$keyboardShortcuts.append(
$('<div>').css({display: 'table-row'})
.append(

View file

@ -1175,14 +1175,27 @@ Ox.VideoPlayer = function(options, self) {
var results = [];
if (query.length) {
query = query.toLowerCase();
results = Ox.map(self.options.annotations, function(annotation) {
results = Ox.filter(self.options.annotations, function(annotation) {
return Ox.decodeHTML(Ox.stripTags(
annotation.text.toLowerCase()
)).indexOf(query) > -1 ? {
)).indexOf(query) > -1;
}).map(function(annotation) {
return {
id: annotation.id,
'in': annotation['in'],
out: annotation.out
} : null;
};
})
results = Ox.filter(self.options.annotations, function(annotation) {
return Ox.decodeHTML(Ox.stripTags(
annotation.text.toLowerCase()
)).indexOf(query) > -1;
}).map(function(annotation) {
return {
id: annotation.id,
'in': annotation['in'],
out: annotation.out
};
});
}
//Ox.print('FIND RESULTS:', results);