From 42a397d84a4af84368f0a1fd2247850178033df7 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 2 Aug 2013 19:38:18 +0000 Subject: [PATCH] store clipboard clips as strings --- static/js/clipList.js | 14 ++------------ static/js/editPanel.js | 23 +++++++++++++++-------- static/js/editor.js | 4 ++-- static/js/player.js | 4 ++-- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/static/js/clipList.js b/static/js/clipList.js index d9a67ec5..a9dc769c 100644 --- a/static/js/clipList.js +++ b/static/js/clipList.js @@ -117,12 +117,7 @@ pandora.ui.clipList = function(videoRatio) { var items = data.ids.map(function(id) { var item = !ui.item ? id.split('/')[0] : ui.item, annotation = that.value(id, 'annotations')[0].id; - return { - annotation: annotation, - 'in': that.value(id, 'in'), - item: item, - out: that.value(id, 'out') - } + return annotation || item + '/' + that.value(id, 'in') + '-' + that.value(id, 'out'); }) Ox.Clipboard.copy(items, 'clip'); }, @@ -130,12 +125,7 @@ pandora.ui.clipList = function(videoRatio) { var items = data.ids.map(function(id) { var item = !ui.item ? id.split('/')[0] : ui.item, annotation = that.value(id, 'annotations')[0].id; - return { - annotation: annotation, - 'in': that.value(id, 'in'), - item: item, - out: that.value(id, 'out') - } + return annotation || item + '/' + that.value(id, 'in') + '-' + that.value(id, 'out'); }) Ox.Clipboard.add(items, 'clip'); }, diff --git a/static/js/editPanel.js b/static/js/editPanel.js index 8a8c7f23..be9d73c5 100644 --- a/static/js/editPanel.js +++ b/static/js/editPanel.js @@ -110,12 +110,14 @@ pandora.ui.editPanel = function() { .bindEvent({ copy: function(data) { Ox.Clipboard.copy(data.ids.map(function(id) { - return Ox.getObjectById(edit.clips, id); + var clip = Ox.getObjectById(edit.clips, id); + return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out; }), 'clip'); }, copyadd: function(data) { Ox.Clipboard.add(data.ids.map(function(id) { - return Ox.getObjectById(edit.clips, id); + var clip = Ox.getObjectById(edit.clips, id); + return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out; }), 'clip'); }, edit: function(data) { @@ -167,12 +169,17 @@ pandora.ui.editPanel = function() { if (Ox.Clipboard.type() == 'clip') { pandora.api.addClips({ clips: Ox.Clipboard.paste().map(function(clip) { - return { - annotation: clip.annotation, - 'in': clip['in'], - item: clip.item, - out: clip.out - }; + var split = clip.split('/'), + item = split[0], + points = split[1].split('-'); + return Ox.extend({ + item: item + }, points.length == 1 ? { + annotation: points[0] + } : { + 'in': parseFloat(points[0]), + out: parseFloat(points[1]) + }); }), edit: ui.edit }, function(result) { diff --git a/static/js/editor.js b/static/js/editor.js index 60b22329..6c1b0547 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -110,12 +110,12 @@ pandora.ui.editor = function(data) { }, copy: function(data) { Ox.Clipboard.copy(data.map(function(clip) { - return Ox.extend(clip, {item: ui.item}); + return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out }), 'clip'); }, copyadd: function(data) { Ox.Clipboard.add(data.map(function(clip) { - return Ox.extend(clip, {item: ui.item}); + return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out }), 'clip'); }, define: function(data) { diff --git a/static/js/player.js b/static/js/player.js index 95733a2d..e1af6559 100644 --- a/static/js/player.js +++ b/static/js/player.js @@ -73,12 +73,12 @@ pandora.ui.player = function(data) { }, copy: function(data) { Ox.Clipboard.copy(data.map(function(clip) { - return Ox.extend(clip, {item: ui.item}); + return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out; }), 'clip'); }, copyadd: function(data) { Ox.Clipboard.add(data.map(function(clip) { - return Ox.extend(clip, {item: ui.item}); + return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out; }), 'clip'); }, downloadvideo: function(data) {