edits: handle position urls

This commit is contained in:
rolux 2013-07-14 14:30:51 +00:00
parent 744019b28b
commit 163b3ff557
3 changed files with 52 additions and 16 deletions

View file

@ -54,6 +54,16 @@ pandora.URL = (function() {
: []
);
}
} else if (pandora.user.ui.section == 'edits') {
var editPoints = pandora.user.ui.editPoints[state.item] || {};
state.span = editPoints.clip || [].concat(
editPoints.position
? editPoints.position
: [],
editPoints['in'] || editPoints.out
? [editPoints['in'], editPoints.out]
: []
);
} else if (pandora.user.ui.section == 'texts') {
var position = pandora.user.ui.textPositions[pandora.user.ui.text];
if (position) {
@ -183,10 +193,30 @@ pandora.URL = (function() {
}
}
} else if (state.type == 'edits') {
if (state.span) {
if (Ox.isArray(state.span)) {
set['editPoints.' + state.item.replace(/\./g, '\\.')] = {
clip: '',
'in': state.span[state.span.length - 2] || 0,
out: state.span.length == 1 ? 0 : Math.max(
state.span[state.span.length - 2],
state.span[state.span.length - 1]
),
position: state.span[0]
}
} else {
set['editPoints.' + state.item.replace(/\./g, '\\.') + '.clip'] = state.span;
}
}
} else if (state.type == 'texts') {
if (state.span) {
set['textPositions.' + state.item] = state.span;
}
}
Ox.Request.cancel();
@ -294,6 +324,20 @@ pandora.URL = (function() {
}
};
// Edits
views['edits'] = {
list: [],
item: ['edit']
};
spanType['edits'] = {
list: [],
item: {edit: 'duration'}
};
sortKeys['edits'] = {
list: {},
item: {}
};
// Texts
views['texts'] = {
list: [],
@ -308,20 +352,6 @@ pandora.URL = (function() {
item: {}
};
// Edits
views['edits'] = {
list: [],
item: ['edit']
};
spanType['edits'] = {
list: [],
item: {edit: 'number'}
};
sortKeys['edits'] = {
list: {},
item: {}
};
findKeys = [{id: 'list', type: 'string'}].concat(pandora.site.itemKeys);
self.URL = Ox.URL({

View file

@ -187,7 +187,6 @@ pandora.ui.editPanel = function() {
},
sort: function(data) {
if (data[0] && data[0].key) {
console.log('S!!!sort', data);
pandora.UI.set('clipSort', data);
pandora.api.sortClips({
edit: edit.id,

View file

@ -1167,7 +1167,14 @@ pandora.getSpan = function(state, val, callback) {
}
});
}
} else if (type == 'texts') {
} else if (state.type == 'edits') {
pandora.api.getEdit({id: state.item, keys: ['duration']}, function(result) {
state.span = val.map(function(number) {
return Math.min(number, result.data.duration);
});
callback();
});
} else if (state.type == 'texts') {
state.span = val;
callback();
}