instantiate Ox.Clipboard as pandora.clipboard; use pandora.clipboard
This commit is contained in:
parent
d25368b6b6
commit
cf378611c8
8 changed files with 31 additions and 30 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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('-');
|
||||
|
|
|
@ -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');
|
||||
},
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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');
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue