forked from 0x2620/pandora
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
|
@ -90,10 +90,12 @@ function constructList() {
|
||||||
return 0;
|
return 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(!data.keys) {
|
if (!data.keys) {
|
||||||
app.api.api(function(results) {
|
app.api.api(function(results) {
|
||||||
var items = [];
|
var items = [];
|
||||||
$.each(results.data.actions, function(i, k) {items.push({'name': i})});
|
Ox.forEach(results.data.actions, function(v, k) {
|
||||||
|
items.push({'name': v})
|
||||||
|
});
|
||||||
items.sort(_sort);
|
items.sort(_sort);
|
||||||
var result = {'data': {'items': items.length}};
|
var result = {'data': {'items': items.length}};
|
||||||
callback(result);
|
callback(result);
|
||||||
|
@ -101,7 +103,9 @@ function constructList() {
|
||||||
} else {
|
} else {
|
||||||
app.api.api(function(results) {
|
app.api.api(function(results) {
|
||||||
var items = [];
|
var items = [];
|
||||||
$.each(results.data.actions, function(i, k) {items.push({'name': i})});
|
Ox.forEach(results.data.actions, function(v, k) {
|
||||||
|
items.push({'name': v})
|
||||||
|
});
|
||||||
items.sort(_sort);
|
items.sort(_sort);
|
||||||
var result = {'data': {'items': items}};
|
var result = {'data': {'items': items}};
|
||||||
callback(result);
|
callback(result);
|
||||||
|
@ -120,13 +124,13 @@ function constructList() {
|
||||||
var info = $('<div>').addClass('OxSelectable'),
|
var info = $('<div>').addClass('OxSelectable'),
|
||||||
hash = '#';
|
hash = '#';
|
||||||
if(data.ids.length)
|
if(data.ids.length)
|
||||||
$.each(data.ids, function(v, k) {
|
data.ids.forEach(function(id) {
|
||||||
info.append($("<h2>").html(k));
|
info.append($("<h2>").html(id));
|
||||||
var $doc =$('<pre>')
|
var $doc =$('<pre>')
|
||||||
.html(app.actions[k].doc.replace('/\n/<br>\n/g'))
|
.html(app.actions[id].doc.replace('/\n/<br>\n/g'))
|
||||||
.appendTo(info);
|
.appendTo(info);
|
||||||
var $code = $('<code class=" python">')
|
var $code = $('<code class="python">')
|
||||||
.html(app.actions[k].code[1].replace('/\n/<br>\n/g'))
|
.html(app.actions[id].code[1].replace('/\n/<br>\n/g'))
|
||||||
.hide();
|
.hide();
|
||||||
var $button = new Ox.Button({
|
var $button = new Ox.Button({
|
||||||
title: [
|
title: [
|
||||||
|
@ -143,7 +147,7 @@ function constructList() {
|
||||||
$('<pre>').append($code).appendTo(info)
|
$('<pre>').append($code).appendTo(info)
|
||||||
hljs.highlightBlock($code[0], ' ');
|
hljs.highlightBlock($code[0], ' ');
|
||||||
|
|
||||||
hash += k + ','
|
hash += id + ','
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
info.html(app.site.default_info);
|
info.html(app.site.default_info);
|
||||||
|
|
|
@ -11,7 +11,7 @@ Ox.load('UI', {
|
||||||
window.pandora = new Ox.App({url: '/api/'}).bindEvent({
|
window.pandora = new Ox.App({url: '/api/'}).bindEvent({
|
||||||
apiURL: '/api/',
|
apiURL: '/api/',
|
||||||
}).bindEvent('load', function(data) {
|
}).bindEvent('load', function(data) {
|
||||||
$.extend(pandora, {
|
Ox.extend(pandora, {
|
||||||
ui: {},
|
ui: {},
|
||||||
info: function(item) {
|
info: function(item) {
|
||||||
var that = Ox.Element()
|
var that = Ox.Element()
|
||||||
|
@ -116,7 +116,7 @@ window.pandora = new Ox.App({url: '/api/'}).bindEvent({
|
||||||
'value': value
|
'value': value
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$.each(args, function(i, a) {
|
args.forEach(function(a, i) {
|
||||||
Ox.print(i, a);
|
Ox.print(i, a);
|
||||||
if (a.key == key) {
|
if (a.key == key) {
|
||||||
result = a.value;
|
result = a.value;
|
||||||
|
|
|
@ -52,7 +52,7 @@ Ox.load({
|
||||||
user: data.user.level == 'guest' ? Ox.extend({}, data.site.user) : data.user
|
user: data.user.level == 'guest' ? Ox.extend({}, data.site.user) : data.user
|
||||||
});
|
});
|
||||||
Ox.extend(pandora.site, {
|
Ox.extend(pandora.site, {
|
||||||
findKeys: $.map(data.site.itemKeys, function(key, i) {
|
findKeys: data.site.itemKeys.map(function(key) {
|
||||||
return key.find ? key : null;
|
return key.find ? key : null;
|
||||||
}),
|
}),
|
||||||
sectionFolders: {
|
sectionFolders: {
|
||||||
|
@ -73,7 +73,7 @@ Ox.load({
|
||||||
{id: 'featured', title: 'Featured Texts', showBrowser: false}
|
{id: 'featured', title: 'Featured Texts', showBrowser: false}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
sortKeys: $.map(data.site.itemKeys, function(key, i) {
|
sortKeys: data.site.itemKeys.map(function(key) {
|
||||||
return key.columnWidth ? key : null;
|
return key.columnWidth ? key : null;
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -96,7 +96,7 @@ pandora.afterLaunch.push(function() {
|
||||||
pandora.local.volumes(function(data) {
|
pandora.local.volumes(function(data) {
|
||||||
Ox.print("got volumes", data);
|
Ox.print("got volumes", data);
|
||||||
var volumes = 0;
|
var volumes = 0;
|
||||||
$.each(data, function(name, info) {
|
Ox.forEach(data, function(info, name) {
|
||||||
volumes ++;
|
volumes ++;
|
||||||
Ox.print("add volume", name, info);
|
Ox.print("add volume", name, info);
|
||||||
var status = info.available?"online":"offline";
|
var status = info.available?"online":"offline";
|
||||||
|
@ -269,10 +269,10 @@ pandora.afterLaunch.push(function() {
|
||||||
var videos = {};
|
var videos = {};
|
||||||
function parseResult(result) {
|
function parseResult(result) {
|
||||||
//extract and upload requested videos
|
//extract and upload requested videos
|
||||||
$.each(result.data.data, function(i, oshash) {
|
result.data.data.forEach(function(oshash) {
|
||||||
$.each(folder_ids, function(i, ids) {
|
folder_ids.forEach(function(ids, i) {
|
||||||
if($.inArray(oshash, ids) > -1) {
|
if (ids.indexOf(oshash) > -1) {
|
||||||
if(!videos[i]) {
|
if (!videos[i]) {
|
||||||
videos[i] = [];
|
videos[i] = [];
|
||||||
var button = new Ox.Button({
|
var button = new Ox.Button({
|
||||||
id: 'upload_' + oshash,
|
id: 'upload_' + oshash,
|
||||||
|
@ -285,7 +285,7 @@ pandora.afterLaunch.push(function() {
|
||||||
title: 'Cancel',
|
title: 'Cancel',
|
||||||
width: 48
|
width: 48
|
||||||
}).bindEvent('click', function(data) {
|
}).bindEvent('click', function(data) {
|
||||||
$.each(videos[fid], function(i, oshash) {
|
videos[fid].forEach(function(oshash) {
|
||||||
_this.cancel(oshash);
|
_this.cancel(oshash);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -312,13 +312,13 @@ pandora.afterLaunch.push(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//upload requested files
|
//upload requested files
|
||||||
$.each(result.data.file, function(i, oshash) {
|
result.data.file.forEach(function(oshash) {
|
||||||
pandora.local.uploadFile(oshash);
|
pandora.local.uploadFile(oshash);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
if (result.data.info.length>0) {
|
if (result.data.info.length>0) {
|
||||||
var post = {'info': {}};
|
var post = {'info': {}};
|
||||||
$.each(result.data.info, function(i, oshash) {
|
result.data.info.forEach(function(oshash) {
|
||||||
if(fileInfo[oshash]) {
|
if(fileInfo[oshash]) {
|
||||||
post.info[oshash] = fileInfo[oshash];
|
post.info[oshash] = fileInfo[oshash];
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ pandora.afterLaunch.push(function() {
|
||||||
}
|
}
|
||||||
var folder_ids = {};
|
var folder_ids = {};
|
||||||
var folders = {};
|
var folders = {};
|
||||||
$.each(result.files, function(i, file) {
|
result.files.forEach(function(file) {
|
||||||
var f = pandora.local.parsePath(file.path);
|
var f = pandora.local.parsePath(file.path);
|
||||||
if(!folders[f.folder]) {
|
if(!folders[f.folder]) {
|
||||||
folders[f.folder] = {
|
folders[f.folder] = {
|
||||||
|
@ -352,7 +352,7 @@ pandora.afterLaunch.push(function() {
|
||||||
folder_ids[folders[f.folder].id].push(file.oshash);
|
folder_ids[folders[f.folder].id].push(file.oshash);
|
||||||
});
|
});
|
||||||
var j = 1;
|
var j = 1;
|
||||||
$.each(folders, function(i, folder) {
|
folders.forEach(function(folder) {
|
||||||
data.items.push(folder);
|
data.items.push(folder);
|
||||||
});
|
});
|
||||||
r = {
|
r = {
|
||||||
|
|
|
@ -62,7 +62,7 @@ pandora.URL = (function() {
|
||||||
? /[\d\.:,-]+/.exec(split[split.length - 1])
|
? /[\d\.:,-]+/.exec(split[split.length - 1])
|
||||||
: null,
|
: null,
|
||||||
view = new RegExp(
|
view = new RegExp(
|
||||||
'^(' + $.map(pandora.site.itemViews, function(v) {
|
'^(' + pandora.site.itemViews.map(function(v) {
|
||||||
return v.id;
|
return v.id;
|
||||||
}).join('|') + ')$'
|
}).join('|') + ')$'
|
||||||
).exec(split[1]);
|
).exec(split[1]);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
pandora.autovalidateCode = function(value, blur, callback) {
|
pandora.autovalidateCode = function(value, blur, callback) {
|
||||||
value = $.map(value.toUpperCase().split(''), function(v) {
|
value = value.toUpperCase().split('').map(function(v) {
|
||||||
return /[0-9A-Z]/(v) ? v : null;
|
return /[0-9A-Z]/(v) ? v : null;
|
||||||
}).join('');
|
}).join('');
|
||||||
callback(value);
|
callback(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.autovalidateEmail = function(value, blur, callback) {
|
pandora.autovalidateEmail = function(value, blur, callback) {
|
||||||
value = $.map(value.toLowerCase().split(''), function(v, i) {
|
value = value.toLowerCase().split('').map(function(v, i) {
|
||||||
return /[0-9a-z\.\+\-_@]/(v) ? v : null;
|
return /[0-9a-z\.\+\-_@]/(v) ? v : null;
|
||||||
}).join('');
|
}).join('');
|
||||||
callback(value);
|
callback(value);
|
||||||
|
@ -15,14 +15,14 @@ pandora.autovalidateEmail = function(value, blur, callback) {
|
||||||
|
|
||||||
pandora.autovalidateListname = function(value, blur, callback) {
|
pandora.autovalidateListname = function(value, blur, callback) {
|
||||||
var length = value.length;
|
var length = value.length;
|
||||||
value = $.map(value.split(''), function(v, i) {
|
value = value.split('').map(function(v, i) {
|
||||||
if (new RegExp('[0-9' + Ox.regexp.letters + '\\(\\)' + ((i == 0 || (i == length - 1 && blur)) ? '' : ' \-') + ']', 'i').test(v)) {
|
if (new RegExp('[0-9' + Ox.regexp.letters + '\\(\\)' + ((i == 0 || (i == length - 1 && blur)) ? '' : ' \-') + ']', 'i').test(v)) {
|
||||||
return v;
|
return v;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}).join('');
|
}).join('');
|
||||||
$.each([' ', ' -', '- ', '--', '\\(\\(', '\\)\\(', '\\)\\)'], function(i, v) {
|
[' ', ' -', '- ', '--', '\\(\\(', '\\)\\(', '\\)\\)'].forEach(function(v) {
|
||||||
//Ox.print(v, v[0], v[0] == '\\')
|
//Ox.print(v, v[0], v[0] == '\\')
|
||||||
while (value.indexOf(v) > -1) {
|
while (value.indexOf(v) > -1) {
|
||||||
value = value.replace(new RegExp(v, 'g'), v[0] + (v[0] == '\\' ? v[1] : ''));
|
value = value.replace(new RegExp(v, 'g'), v[0] + (v[0] == '\\' ? v[1] : ''));
|
||||||
|
@ -33,14 +33,14 @@ pandora.autovalidateListname = function(value, blur, callback) {
|
||||||
|
|
||||||
pandora.autovalidateUsername = function(value, blur, callback) {
|
pandora.autovalidateUsername = function(value, blur, callback) {
|
||||||
var length = value.length;
|
var length = value.length;
|
||||||
value = $.map(value.toLowerCase().split(''), function(v, i) {
|
value = value.toLowerCase().split('').map(function(v, i) {
|
||||||
if (new RegExp('[0-9a-z' + ((i == 0 || (i == length - 1 && blur)) ? '' : '\-_') + ']').test(v)) {
|
if (new RegExp('[0-9a-z' + ((i == 0 || (i == length - 1 && blur)) ? '' : '\-_') + ']').test(v)) {
|
||||||
return v;
|
return v;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}).join('');
|
}).join('');
|
||||||
$.each(['--', '-_', '_-', '__'], function(i, v) {
|
['--', '-_', '_-', '__'].forEach(function(v) {
|
||||||
while (value.indexOf(v) > -1) {
|
while (value.indexOf(v) > -1) {
|
||||||
value = value.replace(new RegExp(v, 'g'), v[0]);
|
value = value.replace(new RegExp(v, 'g'), v[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,24 +276,13 @@ pandora.getFoldersHeight = function() {
|
||||||
height += 16 + pandora.user.ui.showFolder[pandora.user.ui.section][folder.id] * (
|
height += 16 + pandora.user.ui.showFolder[pandora.user.ui.section][folder.id] * (
|
||||||
!!folder.showBrowser * 40 + folder.items * 16
|
!!folder.showBrowser * 40 + folder.items * 16
|
||||||
);
|
);
|
||||||
// // // Ox.print('h', height);
|
|
||||||
});
|
});
|
||||||
/*
|
|
||||||
$.each(pandora.user.ui.showFolder[pandora.user.ui.section], function(id, show) {
|
|
||||||
var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id);
|
|
||||||
height += show * (
|
|
||||||
pandora.site.sectionFolders[pandora.user.ui.section][i].showBrowser * 40 +
|
|
||||||
pandora.site.sectionFolders[pandora.user.ui.section][i].items * 16
|
|
||||||
);
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
return height;
|
return height;
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.getFoldersWidth = function() {
|
pandora.getFoldersWidth = function() {
|
||||||
var width = pandora.user.ui.sidebarSize;
|
var width = pandora.user.ui.sidebarSize;
|
||||||
// fixme: don't use height(), look up in splitpanels
|
// fixme: don't use height(), look up in splitpanels
|
||||||
// // // Ox.print(pandora.getFoldersHeight(), '>', pandora.$ui.leftPanel.height() - 24 - 1 - pandora.$ui.info.height());
|
|
||||||
if (pandora.getFoldersHeight() > pandora.$ui.leftPanel.height() - 24 - 1 - pandora.$ui.info.height()) {
|
if (pandora.getFoldersHeight() > pandora.$ui.leftPanel.height() - 24 - 1 - pandora.$ui.info.height()) {
|
||||||
width -= Ox.UI.SCROLLBAR_SIZE;
|
width -= Ox.UI.SCROLLBAR_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -413,7 +402,7 @@ pandora.reloadGroups = function(i) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$.each(pandora.user.ui.groups, function(i_, id) {
|
Ox.forEach(pandora.user.ui.groups, function(id, i_) {
|
||||||
if (i_ != i) {
|
if (i_ != i) {
|
||||||
//Ox.print('setting groups request', i, i_)
|
//Ox.print('setting groups request', i, i_)
|
||||||
pandora.$ui.groups[i_].options({
|
pandora.$ui.groups[i_].options({
|
||||||
|
|
|
@ -136,7 +136,7 @@ Ox.FilesView = function(options, self) {
|
||||||
columnsVisible: true,
|
columnsVisible: true,
|
||||||
id: 'files',
|
id: 'files',
|
||||||
items: function(data, callback) {
|
items: function(data, callback) {
|
||||||
pandora.api.findFiles($.extend(data, {
|
pandora.api.findFiles(Ox.extend(data, {
|
||||||
query: {
|
query: {
|
||||||
conditions: [{
|
conditions: [{
|
||||||
key: 'id',
|
key: 'id',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
|
|
||||||
pandora.ui.accountDialog = function(action) {
|
pandora.ui.accountDialog = function(action) {
|
||||||
var that = Ox.Dialog($.extend({
|
var that = Ox.Dialog(Ox.extend({
|
||||||
fixedSize: true,
|
fixedSize: true,
|
||||||
height: 192,
|
height: 192,
|
||||||
id: 'accountDialog',
|
id: 'accountDialog',
|
||||||
|
@ -72,7 +72,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
buttons: Ox.merge($.map(buttons[action], function(type) {
|
buttons: Ox.merge(buttons[action].map(function(type) {
|
||||||
return button(type);
|
return button(type);
|
||||||
}), [{}, button('cancel'), button('submit')]),
|
}), [{}, button('cancel'), button('submit')]),
|
||||||
content: Ox.Element()
|
content: Ox.Element()
|
||||||
|
@ -120,7 +120,7 @@ pandora.ui.accountForm = function(action, value) {
|
||||||
'reset': ['usernameOrEmail'],
|
'reset': ['usernameOrEmail'],
|
||||||
'resetAndSignin': ['oldUsername', 'newPassword', 'code']
|
'resetAndSignin': ['oldUsername', 'newPassword', 'code']
|
||||||
},
|
},
|
||||||
$items = $.map(items[action], function(v) {
|
$items = items[action].map(function(v) {
|
||||||
return item(v, value);
|
return item(v, value);
|
||||||
}),
|
}),
|
||||||
that = Ox.Form({
|
that = Ox.Form({
|
||||||
|
|
|
@ -18,7 +18,7 @@ pandora.ui.annotations = function() {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
$bins = [];
|
$bins = [];
|
||||||
$.each(pandora.site.layers, function(i, layer) {
|
pandora.site.layers.forEach(function(layer) {
|
||||||
var $bin = Ox.CollapsePanel({
|
var $bin = Ox.CollapsePanel({
|
||||||
id: layer.id,
|
id: layer.id,
|
||||||
size: 16,
|
size: 16,
|
||||||
|
@ -37,7 +37,7 @@ pandora.ui.annotations = function() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
$.each($bins, function(i, bin) {
|
$bins.forEach(function(bin) {
|
||||||
that.append(bin);
|
that.append(bin);
|
||||||
});
|
});
|
||||||
return that;
|
return that;
|
||||||
|
|
|
@ -178,7 +178,7 @@ pandora.ui.folderBrowserList = function(id) {
|
||||||
select: function(data) {
|
select: function(data) {
|
||||||
// fixme: duplicated
|
// fixme: duplicated
|
||||||
if (data.ids.length) {
|
if (data.ids.length) {
|
||||||
$.each(pandora.$ui.folderList, function(id_, $list) {
|
Ox.forEach(pandora.$ui.folderList, function($list, id_) {
|
||||||
id != id_ && $list.options('selected', []);
|
id != id_ && $list.options('selected', []);
|
||||||
});
|
});
|
||||||
pandora.UI.set({list: data.ids[0]});
|
pandora.UI.set({list: data.ids[0]});
|
||||||
|
|
|
@ -127,11 +127,11 @@ pandora.ui.group = function(id) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Ox.Select({
|
Ox.Select({
|
||||||
items: $.map(pandora.site.groups, function(v) {
|
items: pandora.site.groups.map(function(group) {
|
||||||
return {
|
return {
|
||||||
checked: v.id == id,
|
checked: group.id == id,
|
||||||
id: v.id,
|
id: group.id,
|
||||||
title: v.title
|
title: group.title
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
max: 1,
|
max: 1,
|
||||||
|
|
|
@ -203,7 +203,7 @@ pandora.ui.item = function() {
|
||||||
operator: '='
|
operator: '='
|
||||||
}]},
|
}]},
|
||||||
query = {conditions:[]};
|
query = {conditions:[]};
|
||||||
return pandora.api.findPlaces($.extend(data, {
|
return pandora.api.findPlaces(Ox.extend(data, {
|
||||||
itemQuery: itemQuery,
|
itemQuery: itemQuery,
|
||||||
query: query
|
query: query
|
||||||
}), callback);
|
}), callback);
|
||||||
|
@ -216,7 +216,7 @@ pandora.ui.item = function() {
|
||||||
if(place) {
|
if(place) {
|
||||||
pandora.$ui.clips.options({
|
pandora.$ui.clips.options({
|
||||||
items: function(data, callback) {
|
items: function(data, callback) {
|
||||||
return pandora.api.findAnnotations($.extend(data, {
|
return pandora.api.findAnnotations(Ox.extend(data, {
|
||||||
query: {
|
query: {
|
||||||
conditions:[{key: 'place', value: place.id, operator:'='}]
|
conditions:[{key: 'place', value: place.id, operator:'='}]
|
||||||
},
|
},
|
||||||
|
@ -296,8 +296,8 @@ pandora.ui.item = function() {
|
||||||
// fixme: duplicated
|
// fixme: duplicated
|
||||||
var layers = [],
|
var layers = [],
|
||||||
video = {};
|
video = {};
|
||||||
$.each(pandora.site.layers, function(i, layer) {
|
pandora.site.layers.forEach(function(layer, i) {
|
||||||
layers[i] = $.extend({}, layer, {items: result.data.layers[layer.id]});
|
layers[i] = Ox.extend({}, layer, {items: result.data.layers[layer.id]});
|
||||||
});
|
});
|
||||||
pandora.site.video.resolutions.forEach(function(resolution) {
|
pandora.site.video.resolutions.forEach(function(resolution) {
|
||||||
video[resolution] = Ox.range(result.data.parts).map(function(i) {
|
video[resolution] = Ox.range(result.data.parts).map(function(i) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ pandora.ui.leftPanel = function() {
|
||||||
toggle: function(data) {
|
toggle: function(data) {
|
||||||
pandora.UI.set({showSidebar: !data.collapsed});
|
pandora.UI.set({showSidebar: !data.collapsed});
|
||||||
if (data.collapsed) {
|
if (data.collapsed) {
|
||||||
$.each(pandora.$ui.folderList, function(k, $list) {
|
Ox.forEach(pandora.$ui.folderList, function($list) {
|
||||||
$list.loseFocus();
|
$list.loseFocus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -554,7 +554,7 @@ pandora.ui.list = function() { // fixme: remove view argument
|
||||||
init: function(data) {
|
init: function(data) {
|
||||||
pandora.$ui.total.html(pandora.ui.status('total', data));
|
pandora.$ui.total.html(pandora.ui.status('total', data));
|
||||||
data = [];
|
data = [];
|
||||||
$.each(pandora.site.totals, function(i, v) {
|
pandora.site.totals.forEach(function(v) {
|
||||||
data[v.id] = 0;
|
data[v.id] = 0;
|
||||||
});
|
});
|
||||||
pandora.$ui.selected.html(pandora.ui.status('selected', data));
|
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({
|
pandora.requests.preview = pandora.api.find({
|
||||||
keys: ['director', 'id', 'posterRatio', 'title'],
|
keys: ['director', 'id', 'posterRatio', 'title'],
|
||||||
query: {
|
query: {
|
||||||
conditions: $.map(data.ids, function(id, i) {
|
conditions: data.ids.map(function(id) {
|
||||||
return {
|
return {
|
||||||
key: 'id',
|
key: 'id',
|
||||||
value: 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.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info(data.ids[0]));
|
||||||
pandora.api.find({
|
pandora.api.find({
|
||||||
query: {
|
query: {
|
||||||
conditions: $.map(data.ids, function(id, i) {
|
conditions: data.ids.map(function(id) {
|
||||||
return {
|
return {
|
||||||
key: 'id',
|
key: 'id',
|
||||||
value: id,
|
value: id,
|
||||||
|
|
|
@ -67,7 +67,7 @@ pandora.ui.mainMenu = function() {
|
||||||
] },
|
] },
|
||||||
{ id: 'viewMenu', title: 'View', items: [
|
{ id: 'viewMenu', title: 'View', items: [
|
||||||
{ id: 'movies', title: 'View ' + pandora.site.itemName.plural, 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({
|
return Ox.extend({
|
||||||
checked: pandora.user.ui.lists[pandora.user.ui.list].listView == view.id,
|
checked: pandora.user.ui.lists[pandora.user.ui.list].listView == view.id,
|
||||||
}, view);
|
}, view);
|
||||||
|
@ -88,7 +88,7 @@ pandora.ui.mainMenu = function() {
|
||||||
]},
|
]},
|
||||||
{},
|
{},
|
||||||
{ id: 'openmovie', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], items: [
|
{ 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({
|
return Ox.extend({
|
||||||
checked: pandora.user.ui.itemView == view.id,
|
checked: pandora.user.ui.itemView == view.id,
|
||||||
}, view);
|
}, view);
|
||||||
|
@ -114,7 +114,7 @@ pandora.ui.mainMenu = function() {
|
||||||
]},
|
]},
|
||||||
{ id: 'sortMenu', title: 'Sort', items: [
|
{ id: 'sortMenu', title: 'Sort', items: [
|
||||||
{ id: 'sortmovies', title: 'Sort ' + pandora.site.itemName.plural + ' by', 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({
|
return Ox.extend({
|
||||||
checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id
|
checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id
|
||||||
}, key);
|
}, key);
|
||||||
|
|
|
@ -17,7 +17,7 @@ pandora.ui.placesDialog = function() {
|
||||||
content: pandora.$ui.placesElement = Ox.ListMap({
|
content: pandora.$ui.placesElement = Ox.ListMap({
|
||||||
height: height - 48,
|
height: height - 48,
|
||||||
places: function(data, callback) {
|
places: function(data, callback) {
|
||||||
return pandora.api.findPlaces($.extend({
|
return pandora.api.findPlaces(Ox.extend({
|
||||||
query: {conditions: [], operator: ''}
|
query: {conditions: [], operator: ''}
|
||||||
}, data), callback);
|
}, data), callback);
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
pandora.ui.sortSelect = function() {
|
pandora.ui.sortSelect = function() {
|
||||||
var that = Ox.Select({
|
var that = Ox.Select({
|
||||||
id: 'sortSelect',
|
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)
|
//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,
|
checked: pandora.user.ui.lists[pandora.user.ui.list].sort[0].key == key.id,
|
||||||
title: 'Sort by ' + key.title
|
title: 'Sort by ' + key.title
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,12 +3,12 @@ pandora.ui.viewSelect = function() {
|
||||||
var that = Ox.Select({
|
var that = Ox.Select({
|
||||||
id: 'viewSelect',
|
id: 'viewSelect',
|
||||||
items: !pandora.user.ui.item ? pandora.site.listViews.map(function(view) {
|
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,
|
checked: pandora.user.ui.lists[pandora.user.ui.list].listView == view.id,
|
||||||
title: 'View ' + view.title
|
title: 'View ' + view.title
|
||||||
});
|
});
|
||||||
}) : pandora.site.itemViews.map(function(view) {
|
}) : pandora.site.itemViews.map(function(view) {
|
||||||
return $.extend($.extend({}, view), {
|
return Ox.extend(Ox.extend({}, view), {
|
||||||
checked: pandora.user.ui.itemView == view.id,
|
checked: pandora.user.ui.itemView == view.id,
|
||||||
title: 'View: ' + view.title
|
title: 'View: ' + view.title
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue