remove Ox.each, , $.extend, $.map and $.merge
This commit is contained in:
parent
6d35c64eb1
commit
f7ea2f71ee
19 changed files with 62 additions and 69 deletions
|
|
@ -136,7 +136,7 @@ Ox.FilesView = function(options, self) {
|
|||
columnsVisible: true,
|
||||
id: 'files',
|
||||
items: function(data, callback) {
|
||||
pandora.api.findFiles($.extend(data, {
|
||||
pandora.api.findFiles(Ox.extend(data, {
|
||||
query: {
|
||||
conditions: [{
|
||||
key: 'id',
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||
|
||||
pandora.ui.accountDialog = function(action) {
|
||||
var that = Ox.Dialog($.extend({
|
||||
var that = Ox.Dialog(Ox.extend({
|
||||
fixedSize: true,
|
||||
height: 192,
|
||||
id: 'accountDialog',
|
||||
|
|
@ -72,7 +72,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
|
|||
}
|
||||
}
|
||||
return {
|
||||
buttons: Ox.merge($.map(buttons[action], function(type) {
|
||||
buttons: Ox.merge(buttons[action].map(function(type) {
|
||||
return button(type);
|
||||
}), [{}, button('cancel'), button('submit')]),
|
||||
content: Ox.Element()
|
||||
|
|
@ -120,7 +120,7 @@ pandora.ui.accountForm = function(action, value) {
|
|||
'reset': ['usernameOrEmail'],
|
||||
'resetAndSignin': ['oldUsername', 'newPassword', 'code']
|
||||
},
|
||||
$items = $.map(items[action], function(v) {
|
||||
$items = items[action].map(function(v) {
|
||||
return item(v, value);
|
||||
}),
|
||||
that = Ox.Form({
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ pandora.ui.annotations = function() {
|
|||
}
|
||||
}),
|
||||
$bins = [];
|
||||
$.each(pandora.site.layers, function(i, layer) {
|
||||
pandora.site.layers.forEach(function(layer) {
|
||||
var $bin = Ox.CollapsePanel({
|
||||
id: layer.id,
|
||||
size: 16,
|
||||
|
|
@ -37,7 +37,7 @@ pandora.ui.annotations = function() {
|
|||
)
|
||||
);
|
||||
});
|
||||
$.each($bins, function(i, bin) {
|
||||
$bins.forEach(function(bin) {
|
||||
that.append(bin);
|
||||
});
|
||||
return that;
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ pandora.ui.folderBrowserList = function(id) {
|
|||
select: function(data) {
|
||||
// fixme: duplicated
|
||||
if (data.ids.length) {
|
||||
$.each(pandora.$ui.folderList, function(id_, $list) {
|
||||
Ox.forEach(pandora.$ui.folderList, function($list, id_) {
|
||||
id != id_ && $list.options('selected', []);
|
||||
});
|
||||
pandora.UI.set({list: data.ids[0]});
|
||||
|
|
|
|||
|
|
@ -127,11 +127,11 @@ pandora.ui.group = function(id) {
|
|||
}
|
||||
});
|
||||
Ox.Select({
|
||||
items: $.map(pandora.site.groups, function(v) {
|
||||
items: pandora.site.groups.map(function(group) {
|
||||
return {
|
||||
checked: v.id == id,
|
||||
id: v.id,
|
||||
title: v.title
|
||||
checked: group.id == id,
|
||||
id: group.id,
|
||||
title: group.title
|
||||
}
|
||||
}),
|
||||
max: 1,
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ pandora.ui.item = function() {
|
|||
operator: '='
|
||||
}]},
|
||||
query = {conditions:[]};
|
||||
return pandora.api.findPlaces($.extend(data, {
|
||||
return pandora.api.findPlaces(Ox.extend(data, {
|
||||
itemQuery: itemQuery,
|
||||
query: query
|
||||
}), callback);
|
||||
|
|
@ -216,7 +216,7 @@ pandora.ui.item = function() {
|
|||
if(place) {
|
||||
pandora.$ui.clips.options({
|
||||
items: function(data, callback) {
|
||||
return pandora.api.findAnnotations($.extend(data, {
|
||||
return pandora.api.findAnnotations(Ox.extend(data, {
|
||||
query: {
|
||||
conditions:[{key: 'place', value: place.id, operator:'='}]
|
||||
},
|
||||
|
|
@ -296,8 +296,8 @@ pandora.ui.item = function() {
|
|||
// fixme: duplicated
|
||||
var layers = [],
|
||||
video = {};
|
||||
$.each(pandora.site.layers, function(i, layer) {
|
||||
layers[i] = $.extend({}, layer, {items: result.data.layers[layer.id]});
|
||||
pandora.site.layers.forEach(function(layer, i) {
|
||||
layers[i] = Ox.extend({}, layer, {items: result.data.layers[layer.id]});
|
||||
});
|
||||
pandora.site.video.resolutions.forEach(function(resolution) {
|
||||
video[resolution] = Ox.range(result.data.parts).map(function(i) {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ pandora.ui.leftPanel = function() {
|
|||
toggle: function(data) {
|
||||
pandora.UI.set({showSidebar: !data.collapsed});
|
||||
if (data.collapsed) {
|
||||
$.each(pandora.$ui.folderList, function(k, $list) {
|
||||
Ox.forEach(pandora.$ui.folderList, function($list) {
|
||||
$list.loseFocus();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -554,7 +554,7 @@ pandora.ui.list = function() { // fixme: remove view argument
|
|||
init: function(data) {
|
||||
pandora.$ui.total.html(pandora.ui.status('total', data));
|
||||
data = [];
|
||||
$.each(pandora.site.totals, function(i, v) {
|
||||
pandora.site.totals.forEach(function(v) {
|
||||
data[v.id] = 0;
|
||||
});
|
||||
pandora.$ui.selected.html(pandora.ui.status('selected', data));
|
||||
|
|
@ -569,7 +569,7 @@ pandora.ui.list = function() { // fixme: remove view argument
|
|||
pandora.requests.preview = pandora.api.find({
|
||||
keys: ['director', 'id', 'posterRatio', 'title'],
|
||||
query: {
|
||||
conditions: $.map(data.ids, function(id, i) {
|
||||
conditions: data.ids.map(function(id) {
|
||||
return {
|
||||
key: 'id',
|
||||
value: id,
|
||||
|
|
@ -658,7 +658,7 @@ pandora.ui.list = function() { // fixme: remove view argument
|
|||
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info(data.ids[0]));
|
||||
pandora.api.find({
|
||||
query: {
|
||||
conditions: $.map(data.ids, function(id, i) {
|
||||
conditions: data.ids.map(function(id) {
|
||||
return {
|
||||
key: 'id',
|
||||
value: id,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ pandora.ui.mainMenu = function() {
|
|||
] },
|
||||
{ id: 'viewMenu', title: 'View', items: [
|
||||
{ id: 'movies', title: 'View ' + pandora.site.itemName.plural, items: [
|
||||
{ group: 'viewmovies', min: 1, max: 1, items: $.map(pandora.site.listViews, function(view, i) {
|
||||
{ group: 'viewmovies', min: 1, max: 1, items: pandora.site.listViews.map(function(view) {
|
||||
return Ox.extend({
|
||||
checked: pandora.user.ui.lists[pandora.user.ui.list].listView == view.id,
|
||||
}, view);
|
||||
|
|
@ -88,7 +88,7 @@ pandora.ui.mainMenu = function() {
|
|||
]},
|
||||
{},
|
||||
{ id: 'openmovie', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], items: [
|
||||
{ group: 'movieview', min: 1, max: 1, items: $.map(pandora.site.itemViews, function(view, i) {
|
||||
{ group: 'movieview', min: 1, max: 1, items: pandora.site.itemViews.map(function(view) {
|
||||
return Ox.extend({
|
||||
checked: pandora.user.ui.itemView == view.id,
|
||||
}, view);
|
||||
|
|
@ -114,7 +114,7 @@ pandora.ui.mainMenu = function() {
|
|||
]},
|
||||
{ id: 'sortMenu', title: 'Sort', items: [
|
||||
{ id: 'sortmovies', title: 'Sort ' + pandora.site.itemName.plural + ' by', items: [
|
||||
{ group: 'sortmovies', min: 1, max: 1, items: $.map(pandora.site.sortKeys, function(key, i) {
|
||||
{ group: 'sortmovies', min: 1, max: 1, items: pandora.site.sortKeys.map(function(key) {
|
||||
return Ox.extend({
|
||||
checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id
|
||||
}, key);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ pandora.ui.placesDialog = function() {
|
|||
content: pandora.$ui.placesElement = Ox.ListMap({
|
||||
height: height - 48,
|
||||
places: function(data, callback) {
|
||||
return pandora.api.findPlaces($.extend({
|
||||
return pandora.api.findPlaces(Ox.extend({
|
||||
query: {conditions: [], operator: ''}
|
||||
}, data), callback);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
pandora.ui.sortSelect = function() {
|
||||
var that = Ox.Select({
|
||||
id: 'sortSelect',
|
||||
items: $.map(pandora.site.sortKeys, function(key) {
|
||||
items: pandora.site.sortKeys.map(function(key) {
|
||||
//Ox.print('????', pandora.user.ui.lists[pandora.user.ui.list].sort.key, key.id)
|
||||
return $.extend($.extend({}, key), {
|
||||
return Ox.extend(Ox.extend({}, key), {
|
||||
checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id,
|
||||
title: 'Sort by ' + key.title
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ pandora.ui.viewSelect = function() {
|
|||
var that = Ox.Select({
|
||||
id: 'viewSelect',
|
||||
items: !pandora.user.ui.item ? pandora.site.listViews.map(function(view) {
|
||||
return $.extend($.extend({}, view), {
|
||||
return Ox.extend(Ox.extend({}, view), {
|
||||
checked: pandora.user.ui.lists[pandora.user.ui.list].listView == view.id,
|
||||
title: 'View ' + view.title
|
||||
});
|
||||
}) : pandora.site.itemViews.map(function(view) {
|
||||
return $.extend($.extend({}, view), {
|
||||
return Ox.extend(Ox.extend({}, view), {
|
||||
checked: pandora.user.ui.itemView == view.id,
|
||||
title: 'View: ' + view.title
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue