make smaller getEdit calls

This commit is contained in:
j 2015-03-19 19:36:25 +05:30
parent 1e85b9d480
commit 0fadccfe35

View file

@ -94,7 +94,7 @@ pandora.addFolderItem = function(section) {
} }
}); });
} else { } else {
pandora.api.getEdit({id: list}, function(result) { pandora.api.getEdit({id: list, keys: ['clips']}, function(result) {
data.clips = result.data.clips.map(function(clip) { data.clips = result.data.clips.map(function(clip) {
return Ox.extend({ return Ox.extend({
item: clip.item item: clip.item
@ -123,7 +123,7 @@ pandora.addFolderItem = function(section) {
sortKey = Ox.getObjectById(pandora.site.itemKeys, 'votes') sortKey = Ox.getObjectById(pandora.site.itemKeys, 'votes')
? 'votes' : 'timesaccessed'; ? 'votes' : 'timesaccessed';
if (!isDuplicate) { if (!isDuplicate) {
(isItems ? Ox.noop : pandora.api.getEdit)({id: newList}, function(result) { (isItems ? Ox.noop : pandora.api.getEdit)({id: newList, keys: ['clips']}, function(result) {
query = isItems ? { query = isItems ? {
conditions: [{key: 'list', value: newList, operator: '=='}], conditions: [{key: 'list', value: newList, operator: '=='}],
operator: '&' operator: '&'
@ -1188,7 +1188,7 @@ pandora.getItem = function(state, str, callback) {
} }
}); });
} else if (state.type == 'edits') { } else if (state.type == 'edits') {
pandora.api.getEdit({id: str}, function(result) { pandora.api.getEdit({id: str, keys: ['id']}, function(result) {
if (result.status.code == 200) { if (result.status.code == 200) {
state.item = result.data.id; state.item = result.data.id;
callback(); callback();
@ -1543,7 +1543,7 @@ pandora.getSort = function(state, val, callback) {
callback(); callback();
} else if (state.type == 'edits') { } else if (state.type == 'edits') {
if (val[0].key == 'index') { if (val[0].key == 'index') {
pandora.api.getEdit({id: state.item}, function(result) { pandora.api.getEdit({id: state.item, keys: ['id', 'type']}, function(result) {
if (result.data.type == 'smart') { if (result.data.type == 'smart') {
if (state.sort.length > 1) { if (state.sort.length > 1) {
state.sort = [state.sort[1]]; state.sort = [state.sort[1]];
@ -1675,7 +1675,7 @@ pandora.getSpan = function(state, val, callback) {
} }
} else if (state.type == 'edits') { } else if (state.type == 'edits') {
if (isArray) { if (isArray) {
pandora.api.getEdit({id: state.item}, function(result) { pandora.api.getEdit({id: state.item, keys: ['duration']}, function(result) {
state.span = val.map(function(number) { state.span = val.map(function(number) {
return Math.min(number, result.data.duration); return Math.min(number, result.data.duration);
}); });