2014-04-12 11:33:28 +00:00
|
|
|
//open User->Preferences->Advanced->Run Script on Load and paste this script
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
playlist([
|
2017-04-15 17:44:57 +00:00
|
|
|
[function() { info('A'); }, 10.000],
|
|
|
|
[function() { edit('ashok:Photomontage'); }, 100.000],
|
|
|
|
//[function() { info('A'); }, 30.000],
|
|
|
|
//[function() { play('B', 3); }, 10],
|
2014-04-12 11:33:28 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
//helper functions
|
|
|
|
function playlist(playlist) {
|
|
|
|
var current = 0;
|
|
|
|
pandora.$ui.home && pandora.$ui.home.fadeOutScreen();
|
|
|
|
clearTimeout(pandora.playlist);
|
|
|
|
next();
|
|
|
|
function next() {
|
|
|
|
if(current >= playlist.length) {
|
|
|
|
window.location.reload();
|
|
|
|
current = 0;
|
|
|
|
} else {
|
|
|
|
playlist[current][0]();
|
|
|
|
clearTimeout(pandora.playlist);
|
|
|
|
|
|
|
|
var duration = playlist[current][1];
|
|
|
|
if(Ox.isString(duration)) {
|
|
|
|
duration = Ox.parseDuration(duration);
|
|
|
|
}
|
|
|
|
pandora.playlist = setTimeout(next, Math.round(duration * 1000));
|
|
|
|
current += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function sitePage(page) {
|
|
|
|
//if there is a player, pause it
|
|
|
|
pandora.$ui.player && pandora.$ui.player.options('paused', true);
|
|
|
|
//back to results view
|
2017-04-15 17:44:57 +00:00
|
|
|
pandora.UI.set({item: '', section: 'items'});
|
2014-04-12 11:33:28 +00:00
|
|
|
//open about page
|
|
|
|
pandora.UI.set({page: page});
|
|
|
|
}
|
2017-04-15 17:44:57 +00:00
|
|
|
|
|
|
|
function edit(edit, position) {
|
|
|
|
var resolution = [1920, 1080],
|
|
|
|
annotationsSize = resolution[0] - (resolution[1] * 4/3),
|
|
|
|
tvUI = {
|
|
|
|
annotationsSize: annotationsSize,
|
|
|
|
annotationsRange: 'position',
|
|
|
|
editView: 'annotations',
|
|
|
|
section: 'edits',
|
|
|
|
showAnnotations: true,
|
|
|
|
showTimeline: false, //fixme to enable recalculate aspect
|
|
|
|
showSidebar: false,
|
|
|
|
//videoLoop: true,
|
|
|
|
videoScale: 'fit'
|
|
|
|
};
|
|
|
|
position = position || 0;
|
|
|
|
pandora.UI.set(Ox.extend({
|
|
|
|
edit: edit
|
|
|
|
}, tvUI, 'edits.' + edit + '.position', position));
|
|
|
|
waitForPlayer(function(player) {
|
|
|
|
player.options({
|
|
|
|
paused: false,
|
|
|
|
position: position
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2014-04-12 11:33:28 +00:00
|
|
|
function editor(item, start) {
|
|
|
|
playItem(item, 'editor', start);
|
|
|
|
}
|
|
|
|
function info(item) {
|
2017-04-15 17:44:57 +00:00
|
|
|
pandora.UI.set({section: 'items'});
|
2014-04-12 11:33:28 +00:00
|
|
|
pandora.UI.set({page: ''});
|
|
|
|
pandora.UI.set({itemView: 'info'});
|
|
|
|
pandora.UI.set({item: item});
|
|
|
|
}
|
|
|
|
function play(item, position, layers) {
|
|
|
|
playItem(item, 'player', position, layers);
|
|
|
|
}
|
|
|
|
|
|
|
|
function timeline(item, position, layers) {
|
2015-12-08 11:34:13 +00:00
|
|
|
playItem(item, 'timeline', position, layers);
|
2014-04-12 11:33:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function playItem(item, view, position, layers) {
|
2017-04-15 17:44:57 +00:00
|
|
|
pandora.UI.set({section: 'items'});
|
2014-04-12 11:33:28 +00:00
|
|
|
showLayers(layers);
|
|
|
|
position = position || 0;
|
|
|
|
if(Ox.isString(position)) {
|
|
|
|
position = Ox.parseDuration(position);
|
|
|
|
}
|
|
|
|
pandora.UI.set({page: ''});
|
|
|
|
pandora.UI.set('videoPoints.' + item, {
|
|
|
|
'annotation': '',
|
|
|
|
'in': position,
|
|
|
|
out: position,
|
|
|
|
position: position
|
|
|
|
});
|
|
|
|
if(item != pandora.user.ui.item || pandora.user.ui.itemView != view) {
|
|
|
|
delete pandora.$ui[view];
|
|
|
|
pandora.UI.set({itemView: view});
|
|
|
|
pandora.UI.set({item: item});
|
|
|
|
}
|
|
|
|
startPlayback();
|
|
|
|
function startPlayback() {
|
|
|
|
if(pandora.$ui[view]) {
|
|
|
|
pandora.$ui[view].options({paused: false});
|
|
|
|
} else {
|
|
|
|
setTimeout(startPlayback, 500);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function find(query, view) {
|
|
|
|
view = view || 'grid';
|
2017-04-15 17:44:57 +00:00
|
|
|
pandora.UI.set({item: '', page: '', listView: view, section: 'items'});
|
2014-04-12 11:33:28 +00:00
|
|
|
pandora.$ui.findInput.value(query);
|
|
|
|
pandora.UI.set({find: {conditions: [{key: '*', value: query, operator: '='}], operator: '&'}});
|
|
|
|
}
|
|
|
|
|
|
|
|
function showLayers(layers) {
|
|
|
|
layers = layers || Object.keys(pandora.site.user.ui.showLayers).filter(function(layer) {
|
|
|
|
return pandora.site.user.ui.showLayers[layer];
|
|
|
|
});
|
|
|
|
pandora.UI.set('showLayers', Ox.map(pandora.site.user.ui.showLayers, function(value, layer) {
|
|
|
|
return layers.indexOf(layer) > -1;
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2017-04-15 17:44:57 +00:00
|
|
|
function waitForPlayer(callback) {
|
|
|
|
var $player, player;
|
|
|
|
if (pandora.$ui.editPanel) {
|
|
|
|
$player = $('.OxVideoPlayer').not('.OxBar');
|
|
|
|
if($player.data('oxid') && Ox.$elements[$player.data('oxid')]) {
|
|
|
|
player = Ox.$elements[$player.data('oxid')];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (player) {
|
|
|
|
setTimeout(function() {
|
|
|
|
callback(player, $player);
|
|
|
|
}, 250);
|
|
|
|
} else {
|
|
|
|
setTimeout(function() { waitForPlayer(callback); }, 250);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-12 11:33:28 +00:00
|
|
|
function openDocument(id) {
|
|
|
|
//if there is a player, pause it
|
|
|
|
pandora.$ui.player && pandora.$ui.player.options('paused', true);
|
|
|
|
pandora.URL.push('/documents/' + id);
|
|
|
|
}
|
|
|
|
|
|
|
|
function closeDocument() {
|
|
|
|
pandora.$ui.documentDialog.close();
|
|
|
|
}
|
|
|
|
})();
|