diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index 4e6e3ce62..80786fa7d 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -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({ diff --git a/static/js/pandora/editPanel.js b/static/js/pandora/editPanel.js index 229243f60..e4fb69fdd 100644 --- a/static/js/pandora/editPanel.js +++ b/static/js/pandora/editPanel.js @@ -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, diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index 8961d798e..e0428fe12 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -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(); }