From cf378611c8f72ec6a610cfcb1eca8c9aac586f56 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 3 Aug 2013 15:01:47 +0000 Subject: [PATCH] instantiate Ox.Clipboard as pandora.clipboard; use pandora.clipboard --- static/js/browser.js | 4 ++-- static/js/clipList.js | 4 ++-- static/js/editPanel.js | 12 ++++++------ static/js/editor.js | 4 ++-- static/js/list.js | 12 ++++++------ static/js/mainMenu.js | 20 ++++++++++---------- static/js/pandora.js | 1 + static/js/player.js | 4 ++-- 8 files changed, 31 insertions(+), 30 deletions(-) diff --git a/static/js/browser.js b/static/js/browser.js index d33cb157..5146f1d9 100644 --- a/static/js/browser.js +++ b/static/js/browser.js @@ -128,10 +128,10 @@ pandora.ui.browser = function() { .addClass('OxMedia') .bindEvent({ copy: function() { - Ox.Clipboard.copy(pandora.user.ui.item, 'item'); + pandora.clipboard.copy(pandora.user.ui.item, 'item'); }, copyadd: function() { - Ox.Clipboard.add(pandora.user.ui.item, 'item'); + pandora.clipboard.add(pandora.user.ui.item, 'item'); }, gainfocus: function() { pandora.$ui.mainMenu.replaceItemMenu(); diff --git a/static/js/clipList.js b/static/js/clipList.js index a9dc769c..0373902b 100644 --- a/static/js/clipList.js +++ b/static/js/clipList.js @@ -119,7 +119,7 @@ pandora.ui.clipList = function(videoRatio) { annotation = that.value(id, 'annotations')[0].id; return annotation || item + '/' + that.value(id, 'in') + '-' + that.value(id, 'out'); }) - Ox.Clipboard.copy(items, 'clip'); + pandora.clipboard.copy(items, 'clip'); }, copyadd: function(data) { var items = data.ids.map(function(id) { @@ -127,7 +127,7 @@ pandora.ui.clipList = function(videoRatio) { annotation = that.value(id, 'annotations')[0].id; return annotation || item + '/' + that.value(id, 'in') + '-' + that.value(id, 'out'); }) - Ox.Clipboard.add(items, 'clip'); + pandora.clipboard.add(items, 'clip'); }, gainfocus: function() { pandora.$ui.mainMenu.replaceItemMenu(); diff --git a/static/js/editPanel.js b/static/js/editPanel.js index 2093ae65..7fe3ff57 100644 --- a/static/js/editPanel.js +++ b/static/js/editPanel.js @@ -109,20 +109,20 @@ pandora.ui.editPanel = function() { }) .bindEvent({ copy: function(data) { - Ox.Clipboard.copy(data.ids.map(function(id) { + pandora.clipboard.copy(data.ids.map(function(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) { + pandora.clipboard.add(data.ids.map(function(id) { var clip = Ox.getObjectById(edit.clips, id); return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out; }), 'clip'); }, cut: function(data) { if (edit.editable) { - Ox.Clipboard.copy(data.ids.map(function(id) { + pandora.clipboard.copy(data.ids.map(function(id) { var clip = Ox.getObjectById(edit.clips, id); return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out; }), 'clip'); @@ -134,7 +134,7 @@ pandora.ui.editPanel = function() { }, cutadd: function(data) { if (edit.editable) { - Ox.Clipboard.add(data.ids.map(function(id) { + pandora.clipboard.add(data.ids.map(function(id) { var clip = Ox.getObjectById(edit.clips, id); return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out; }), 'clip'); @@ -199,8 +199,8 @@ pandora.ui.editPanel = function() { }, paste: function() { var clips; - if (Ox.Clipboard.type() == 'clip') { - clips = Ox.Clipboard.paste().map(function(clip) { + if (pandora.clipboard.type() == 'clip') { + clips = pandora.clipboard.paste().map(function(clip) { var split = clip.split('/'), item = split[0], points = split[1].split('-'); diff --git a/static/js/editor.js b/static/js/editor.js index 6c1b0547..1b20520b 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -109,12 +109,12 @@ pandora.ui.editor = function(data) { pandora.URL.push(pandora.site.cantPlay.link); }, copy: function(data) { - Ox.Clipboard.copy(data.map(function(clip) { + pandora.clipboard.copy(data.map(function(clip) { return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out }), 'clip'); }, copyadd: function(data) { - Ox.Clipboard.add(data.map(function(clip) { + pandora.clipboard.add(data.map(function(clip) { return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out }), 'clip'); }, diff --git a/static/js/list.js b/static/js/list.js index e3715e6a..bb355fd1 100644 --- a/static/js/list.js +++ b/static/js/list.js @@ -392,15 +392,15 @@ pandora.ui.list = function() { delete pandora.$ui.previewDialog; }, copy: function(data) { - Ox.Clipboard.copy(data.ids, 'item'); + pandora.clipboard.copy(data.ids, 'item'); }, copyadd: function(data) { - Ox.Clipboard.add(data.ids, 'item'); + pandora.clipboard.add(data.ids, 'item'); }, cut: function(data) { var listData = pandora.getListData(); if (listData.editable && listData.type == 'static') { - Ox.Clipboard.copy(data.ids, 'item'); + pandora.clipboard.copy(data.ids, 'item'); pandora.doHistory('cut', data.ids, pandora.user.ui._list, function() { pandora.UI.set({listSelection: []}); pandora.reloadList(); @@ -410,7 +410,7 @@ pandora.ui.list = function() { cutadd: function(data) { var listData = pandora.getListData(); if (listData.editable && listData.type == 'static') { - Ox.Clipboard.add(data.ids, 'item'); + pandora.clipboard.add(data.ids, 'item'); pandora.doHistory('cut', data.ids, pandora.user.ui._list, function() { pandora.UI.set({listSelection: []}); pandora.reloadList(); @@ -475,8 +475,8 @@ pandora.ui.list = function() { } }, paste: function(data) { - var items = Ox.Clipboard.paste(); - if (items.length && Ox.Clipboard.type() == 'item' && pandora.getListData().editable) { + var items = pandora.clipboard.paste(); + if (items.length && pandora.clipboard.type() == 'item' && pandora.getListData().editable) { pandora.doHistory('paste', items, pandora.user.ui._list, function() { pandora.UI.set({listSelection: items}); pandora.reloadList(); diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index cd55c999..afda56a2 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -366,7 +366,7 @@ pandora.ui.mainMenu = function() { } else if (data.id == 'cut' || data.id == 'cutadd') { var action = data.id == 'cut' ? 'copy' : 'add'; fromMenu = true; - Ox.Clipboard[action](ui.listSelection, 'item'); + pandora.clipboard[action](ui.listSelection, 'item'); pandora.doHistory('cut', ui.listSelection, ui._list, function() { pandora.UI.set({listSelection: []}); pandora.reloadList(); @@ -374,25 +374,25 @@ pandora.ui.mainMenu = function() { } else if (data.id == 'copy' || data.id == 'copyadd') { var action = data.id == 'copy' ? 'copy' : 'add'; fromMenu = true; - pandora.isVideoView() && !pandora.$ui.browser.hasFocus() ? Ox.Clipboard[action]([{ + pandora.isVideoView() && !pandora.$ui.browser.hasFocus() ? pandora.clipboard[action]([{ annotation: ui.videoPoints[ui.item].annotation, 'in': pandora.user.ui.videoPoints[ui.item]['in'], item: ui.item, out: ui.videoPoints[ui.item].out }], 'clip') - : pandora.isClipView() && !pandora.$ui.browser.hasFocus() ? Ox.Clipboard[action]( + : pandora.isClipView() && !pandora.$ui.browser.hasFocus() ? pandora.clipboard[action]( pandora.$ui.clipList.options('selected'), 'clip' ) - : Ox.Clipboard[action](ui.listSelection, 'item'); + : pandora.clipboard[action](ui.listSelection, 'item'); } else if (data.id == 'paste') { fromMenu = true; - var items = Ox.Clipboard.paste(); + var items = pandora.clipboard.paste(); pandora.doHistory('paste', items, ui._list, function() { pandora.UI.set({listSelection: items}); pandora.reloadList(); }); } else if (data.id == 'clearclipboard') { - Ox.Clipboard.clear(); + pandora.clipboard.clear(); } else if (data.id == 'delete') { pandora.doHistory('delete', ui.listSelection, ui._list, function() { pandora.UI.set({listSelection: []}); @@ -735,7 +735,7 @@ pandora.ui.mainMenu = function() { } }); - Ox.Clipboard.bindEvent(function(data, event) { + pandora.clipboard.bindEvent(function(data, event) { if (Ox.contains(['add', 'copy', 'paste'], event) && !fromMenu) { that.highlightMenu('itemMenu'); } @@ -819,8 +819,8 @@ pandora.ui.mainMenu = function() { : isClipView ? (selectionItems == 1 ? 'Clip' : 'Clips') : pandora.site.itemName[selectionItems == 1 ? 'singular' : 'plural'] ), - clipboardItems = Ox.Clipboard.items(), - clipboardType = Ox.Clipboard.type(), + clipboardItems = pandora.clipboard.items(), + clipboardType = pandora.clipboard.type(), clipboardItemName = clipboardItems == 0 ? '' : (clipboardItems > 1 ? Ox.formatNumber(clipboardItems) + ' ' : '') + Ox._( clipboardType == 'item' ? pandora.site.itemName[clipboardItems == 1 ? 'singular' : 'plural'] @@ -833,7 +833,7 @@ pandora.ui.mainMenu = function() { : !!ui.listSelection.length, canAdd = canCopy && clipboardItems > 0 && ((clipboardType == 'item') == (!isVideoView && !isClipView)), canPaste = !ui.item && !isClipView && !isVideoView - && listData.editable && listData.type == 'static' && Ox.Clipboard.type() == 'item', + && listData.editable && listData.type == 'static' && pandora.clipboard.type() == 'item', canCut = canCopy && !ui.item && !isClipView && !isVideoView && listData.editable && listData.type == 'static', historyItems = pandora.history.items(), diff --git a/static/js/pandora.js b/static/js/pandora.js index efb0fb59..2c9e8495 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -366,6 +366,7 @@ appPanel } function initPandoraApp() { + pandora.clipboard = Ox.Clipboard(); pandora.history = Ox.History(); pandora.$ui.appPanel = pandora.ui.appPanel().display(); pandora.$ui.loadingIcon.update(Ox.Request.requests()); diff --git a/static/js/player.js b/static/js/player.js index e1af6559..09abe245 100644 --- a/static/js/player.js +++ b/static/js/player.js @@ -72,12 +72,12 @@ pandora.ui.player = function(data) { pandora.URL.push(pandora.site.cantPlay.link); }, copy: function(data) { - Ox.Clipboard.copy(data.map(function(clip) { + pandora.clipboard.copy(data.map(function(clip) { return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out; }), 'clip'); }, copyadd: function(data) { - Ox.Clipboard.add(data.map(function(clip) { + pandora.clipboard.add(data.map(function(clip) { return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out; }), 'clip'); },