forked from 0x2620/pandora
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')
|
.addClass('OxMedia')
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
copy: function() {
|
copy: function() {
|
||||||
Ox.Clipboard.copy(pandora.user.ui.item, 'item');
|
pandora.clipboard.copy(pandora.user.ui.item, 'item');
|
||||||
},
|
},
|
||||||
copyadd: function() {
|
copyadd: function() {
|
||||||
Ox.Clipboard.add(pandora.user.ui.item, 'item');
|
pandora.clipboard.add(pandora.user.ui.item, 'item');
|
||||||
},
|
},
|
||||||
gainfocus: function() {
|
gainfocus: function() {
|
||||||
pandora.$ui.mainMenu.replaceItemMenu();
|
pandora.$ui.mainMenu.replaceItemMenu();
|
||||||
|
|
|
@ -119,7 +119,7 @@ pandora.ui.clipList = function(videoRatio) {
|
||||||
annotation = that.value(id, 'annotations')[0].id;
|
annotation = that.value(id, 'annotations')[0].id;
|
||||||
return annotation || item + '/' + that.value(id, 'in') + '-' + that.value(id, 'out');
|
return annotation || item + '/' + that.value(id, 'in') + '-' + that.value(id, 'out');
|
||||||
})
|
})
|
||||||
Ox.Clipboard.copy(items, 'clip');
|
pandora.clipboard.copy(items, 'clip');
|
||||||
},
|
},
|
||||||
copyadd: function(data) {
|
copyadd: function(data) {
|
||||||
var items = data.ids.map(function(id) {
|
var items = data.ids.map(function(id) {
|
||||||
|
@ -127,7 +127,7 @@ pandora.ui.clipList = function(videoRatio) {
|
||||||
annotation = that.value(id, 'annotations')[0].id;
|
annotation = that.value(id, 'annotations')[0].id;
|
||||||
return annotation || item + '/' + that.value(id, 'in') + '-' + that.value(id, 'out');
|
return annotation || item + '/' + that.value(id, 'in') + '-' + that.value(id, 'out');
|
||||||
})
|
})
|
||||||
Ox.Clipboard.add(items, 'clip');
|
pandora.clipboard.add(items, 'clip');
|
||||||
},
|
},
|
||||||
gainfocus: function() {
|
gainfocus: function() {
|
||||||
pandora.$ui.mainMenu.replaceItemMenu();
|
pandora.$ui.mainMenu.replaceItemMenu();
|
||||||
|
|
|
@ -109,20 +109,20 @@ pandora.ui.editPanel = function() {
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
copy: function(data) {
|
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);
|
var clip = Ox.getObjectById(edit.clips, id);
|
||||||
return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out;
|
return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out;
|
||||||
}), 'clip');
|
}), 'clip');
|
||||||
},
|
},
|
||||||
copyadd: function(data) {
|
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);
|
var clip = Ox.getObjectById(edit.clips, id);
|
||||||
return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out;
|
return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out;
|
||||||
}), 'clip');
|
}), 'clip');
|
||||||
},
|
},
|
||||||
cut: function(data) {
|
cut: function(data) {
|
||||||
if (edit.editable) {
|
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);
|
var clip = Ox.getObjectById(edit.clips, id);
|
||||||
return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out;
|
return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out;
|
||||||
}), 'clip');
|
}), 'clip');
|
||||||
|
@ -134,7 +134,7 @@ pandora.ui.editPanel = function() {
|
||||||
},
|
},
|
||||||
cutadd: function(data) {
|
cutadd: function(data) {
|
||||||
if (edit.editable) {
|
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);
|
var clip = Ox.getObjectById(edit.clips, id);
|
||||||
return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out;
|
return clip.annotation || clip.item + '/' + clip['in'] + '-' + clip.out;
|
||||||
}), 'clip');
|
}), 'clip');
|
||||||
|
@ -199,8 +199,8 @@ pandora.ui.editPanel = function() {
|
||||||
},
|
},
|
||||||
paste: function() {
|
paste: function() {
|
||||||
var clips;
|
var clips;
|
||||||
if (Ox.Clipboard.type() == 'clip') {
|
if (pandora.clipboard.type() == 'clip') {
|
||||||
clips = Ox.Clipboard.paste().map(function(clip) {
|
clips = pandora.clipboard.paste().map(function(clip) {
|
||||||
var split = clip.split('/'),
|
var split = clip.split('/'),
|
||||||
item = split[0],
|
item = split[0],
|
||||||
points = split[1].split('-');
|
points = split[1].split('-');
|
||||||
|
|
|
@ -109,12 +109,12 @@ pandora.ui.editor = function(data) {
|
||||||
pandora.URL.push(pandora.site.cantPlay.link);
|
pandora.URL.push(pandora.site.cantPlay.link);
|
||||||
},
|
},
|
||||||
copy: function(data) {
|
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
|
return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out
|
||||||
}), 'clip');
|
}), 'clip');
|
||||||
},
|
},
|
||||||
copyadd: function(data) {
|
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
|
return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out
|
||||||
}), 'clip');
|
}), 'clip');
|
||||||
},
|
},
|
||||||
|
|
|
@ -392,15 +392,15 @@ pandora.ui.list = function() {
|
||||||
delete pandora.$ui.previewDialog;
|
delete pandora.$ui.previewDialog;
|
||||||
},
|
},
|
||||||
copy: function(data) {
|
copy: function(data) {
|
||||||
Ox.Clipboard.copy(data.ids, 'item');
|
pandora.clipboard.copy(data.ids, 'item');
|
||||||
},
|
},
|
||||||
copyadd: function(data) {
|
copyadd: function(data) {
|
||||||
Ox.Clipboard.add(data.ids, 'item');
|
pandora.clipboard.add(data.ids, 'item');
|
||||||
},
|
},
|
||||||
cut: function(data) {
|
cut: function(data) {
|
||||||
var listData = pandora.getListData();
|
var listData = pandora.getListData();
|
||||||
if (listData.editable && listData.type == 'static') {
|
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.doHistory('cut', data.ids, pandora.user.ui._list, function() {
|
||||||
pandora.UI.set({listSelection: []});
|
pandora.UI.set({listSelection: []});
|
||||||
pandora.reloadList();
|
pandora.reloadList();
|
||||||
|
@ -410,7 +410,7 @@ pandora.ui.list = function() {
|
||||||
cutadd: function(data) {
|
cutadd: function(data) {
|
||||||
var listData = pandora.getListData();
|
var listData = pandora.getListData();
|
||||||
if (listData.editable && listData.type == 'static') {
|
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.doHistory('cut', data.ids, pandora.user.ui._list, function() {
|
||||||
pandora.UI.set({listSelection: []});
|
pandora.UI.set({listSelection: []});
|
||||||
pandora.reloadList();
|
pandora.reloadList();
|
||||||
|
@ -475,8 +475,8 @@ pandora.ui.list = function() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
paste: function(data) {
|
paste: function(data) {
|
||||||
var items = Ox.Clipboard.paste();
|
var items = pandora.clipboard.paste();
|
||||||
if (items.length && Ox.Clipboard.type() == 'item' && pandora.getListData().editable) {
|
if (items.length && pandora.clipboard.type() == 'item' && pandora.getListData().editable) {
|
||||||
pandora.doHistory('paste', items, pandora.user.ui._list, function() {
|
pandora.doHistory('paste', items, pandora.user.ui._list, function() {
|
||||||
pandora.UI.set({listSelection: items});
|
pandora.UI.set({listSelection: items});
|
||||||
pandora.reloadList();
|
pandora.reloadList();
|
||||||
|
|
|
@ -366,7 +366,7 @@ pandora.ui.mainMenu = function() {
|
||||||
} else if (data.id == 'cut' || data.id == 'cutadd') {
|
} else if (data.id == 'cut' || data.id == 'cutadd') {
|
||||||
var action = data.id == 'cut' ? 'copy' : 'add';
|
var action = data.id == 'cut' ? 'copy' : 'add';
|
||||||
fromMenu = true;
|
fromMenu = true;
|
||||||
Ox.Clipboard[action](ui.listSelection, 'item');
|
pandora.clipboard[action](ui.listSelection, 'item');
|
||||||
pandora.doHistory('cut', ui.listSelection, ui._list, function() {
|
pandora.doHistory('cut', ui.listSelection, ui._list, function() {
|
||||||
pandora.UI.set({listSelection: []});
|
pandora.UI.set({listSelection: []});
|
||||||
pandora.reloadList();
|
pandora.reloadList();
|
||||||
|
@ -374,25 +374,25 @@ pandora.ui.mainMenu = function() {
|
||||||
} else if (data.id == 'copy' || data.id == 'copyadd') {
|
} else if (data.id == 'copy' || data.id == 'copyadd') {
|
||||||
var action = data.id == 'copy' ? 'copy' : 'add';
|
var action = data.id == 'copy' ? 'copy' : 'add';
|
||||||
fromMenu = true;
|
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,
|
annotation: ui.videoPoints[ui.item].annotation,
|
||||||
'in': pandora.user.ui.videoPoints[ui.item]['in'],
|
'in': pandora.user.ui.videoPoints[ui.item]['in'],
|
||||||
item: ui.item,
|
item: ui.item,
|
||||||
out: ui.videoPoints[ui.item].out
|
out: ui.videoPoints[ui.item].out
|
||||||
}], 'clip')
|
}], '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'
|
pandora.$ui.clipList.options('selected'), 'clip'
|
||||||
)
|
)
|
||||||
: Ox.Clipboard[action](ui.listSelection, 'item');
|
: pandora.clipboard[action](ui.listSelection, 'item');
|
||||||
} else if (data.id == 'paste') {
|
} else if (data.id == 'paste') {
|
||||||
fromMenu = true;
|
fromMenu = true;
|
||||||
var items = Ox.Clipboard.paste();
|
var items = pandora.clipboard.paste();
|
||||||
pandora.doHistory('paste', items, ui._list, function() {
|
pandora.doHistory('paste', items, ui._list, function() {
|
||||||
pandora.UI.set({listSelection: items});
|
pandora.UI.set({listSelection: items});
|
||||||
pandora.reloadList();
|
pandora.reloadList();
|
||||||
});
|
});
|
||||||
} else if (data.id == 'clearclipboard') {
|
} else if (data.id == 'clearclipboard') {
|
||||||
Ox.Clipboard.clear();
|
pandora.clipboard.clear();
|
||||||
} else if (data.id == 'delete') {
|
} else if (data.id == 'delete') {
|
||||||
pandora.doHistory('delete', ui.listSelection, ui._list, function() {
|
pandora.doHistory('delete', ui.listSelection, ui._list, function() {
|
||||||
pandora.UI.set({listSelection: []});
|
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) {
|
if (Ox.contains(['add', 'copy', 'paste'], event) && !fromMenu) {
|
||||||
that.highlightMenu('itemMenu');
|
that.highlightMenu('itemMenu');
|
||||||
}
|
}
|
||||||
|
@ -819,8 +819,8 @@ pandora.ui.mainMenu = function() {
|
||||||
: isClipView ? (selectionItems == 1 ? 'Clip' : 'Clips')
|
: isClipView ? (selectionItems == 1 ? 'Clip' : 'Clips')
|
||||||
: pandora.site.itemName[selectionItems == 1 ? 'singular' : 'plural']
|
: pandora.site.itemName[selectionItems == 1 ? 'singular' : 'plural']
|
||||||
),
|
),
|
||||||
clipboardItems = Ox.Clipboard.items(),
|
clipboardItems = pandora.clipboard.items(),
|
||||||
clipboardType = Ox.Clipboard.type(),
|
clipboardType = pandora.clipboard.type(),
|
||||||
clipboardItemName = clipboardItems == 0 ? ''
|
clipboardItemName = clipboardItems == 0 ? ''
|
||||||
: (clipboardItems > 1 ? Ox.formatNumber(clipboardItems) + ' ' : '') + Ox._(
|
: (clipboardItems > 1 ? Ox.formatNumber(clipboardItems) + ' ' : '') + Ox._(
|
||||||
clipboardType == 'item' ? pandora.site.itemName[clipboardItems == 1 ? 'singular' : 'plural']
|
clipboardType == 'item' ? pandora.site.itemName[clipboardItems == 1 ? 'singular' : 'plural']
|
||||||
|
@ -833,7 +833,7 @@ pandora.ui.mainMenu = function() {
|
||||||
: !!ui.listSelection.length,
|
: !!ui.listSelection.length,
|
||||||
canAdd = canCopy && clipboardItems > 0 && ((clipboardType == 'item') == (!isVideoView && !isClipView)),
|
canAdd = canCopy && clipboardItems > 0 && ((clipboardType == 'item') == (!isVideoView && !isClipView)),
|
||||||
canPaste = !ui.item && !isClipView && !isVideoView
|
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
|
canCut = canCopy && !ui.item && !isClipView && !isVideoView
|
||||||
&& listData.editable && listData.type == 'static',
|
&& listData.editable && listData.type == 'static',
|
||||||
historyItems = pandora.history.items(),
|
historyItems = pandora.history.items(),
|
||||||
|
|
|
@ -366,6 +366,7 @@ appPanel
|
||||||
}
|
}
|
||||||
|
|
||||||
function initPandoraApp() {
|
function initPandoraApp() {
|
||||||
|
pandora.clipboard = Ox.Clipboard();
|
||||||
pandora.history = Ox.History();
|
pandora.history = Ox.History();
|
||||||
pandora.$ui.appPanel = pandora.ui.appPanel().display();
|
pandora.$ui.appPanel = pandora.ui.appPanel().display();
|
||||||
pandora.$ui.loadingIcon.update(Ox.Request.requests());
|
pandora.$ui.loadingIcon.update(Ox.Request.requests());
|
||||||
|
|
|
@ -72,12 +72,12 @@ pandora.ui.player = function(data) {
|
||||||
pandora.URL.push(pandora.site.cantPlay.link);
|
pandora.URL.push(pandora.site.cantPlay.link);
|
||||||
},
|
},
|
||||||
copy: function(data) {
|
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;
|
return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out;
|
||||||
}), 'clip');
|
}), 'clip');
|
||||||
},
|
},
|
||||||
copyadd: function(data) {
|
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;
|
return clip.annotation || ui.item + '/' + clip['in'] + '-' + clip.out;
|
||||||
}), 'clip');
|
}), 'clip');
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue