This commit is contained in:
rolux 2012-06-10 20:31:02 +02:00
parent 41cd72d37e
commit 453f83e067
15 changed files with 108 additions and 93 deletions

View file

@ -26,9 +26,10 @@ var app = new Ox.App({
app.api.api({docs: true, code: true}, function(results) {
app.actions = results.data.actions;
if (document.location.hash) {
app.$ui.actionList.triggerEvent('select', {ids: document.location.hash.substring(1).split(',')});
app.$ui.actionList.triggerEvent('select', {
ids: document.location.hash.substring(1).split(',')
});
}
});
@ -84,11 +85,7 @@ function constructList() {
id: 'actionList',
items: function(data, callback) {
function _sort(a, b) {
if(a.name > b.name)
return 1;
else if(a.name == b.name)
return 0;
return -1;
return a.name > b.name ? 1 : a.name == b.name ? 0 : -1;
}
if (!data.keys) {
app.api.api(function(results) {
@ -126,7 +123,7 @@ function constructList() {
if (data.ids.length)
data.ids.forEach(function(id) {
info.append(
$("<h2>")
$('<h2>')
.html(id)
.css({
marginBottom: '8px'

View file

@ -57,8 +57,10 @@ Ox.load('UI', {
Ox.UI.hideLoadingScreen();
function checkRange(data) {
if(data.position < options['in'] - 0.04
|| data.position > options.out) {
if (
data.position < options['in'] - 0.04
|| data.position > options.out
) {
if (!pandora.player.options('paused')) {
pandora.player.togglePaused();
}

View file

@ -323,9 +323,9 @@ appPanel
if (localStorage && localStorage['pandora.onload']) {
try {
eval(localStorage['pandora.onload'])
} catch(e) {
}
} catch(e) {}
}
});
}

View file

@ -2,6 +2,7 @@
'use strict';
pandora.ui.embedDialog = function(data) {
var content = Ox.Element().css({margin: '16px'}),
height = 360,
width = 640,
@ -33,18 +34,6 @@ pandora.ui.embedDialog = function(data) {
data.view = 'video';
function constructUrl(data) {
var url = document.location.protocol
+ '//' + document.location.host
+ '/' + pandora.user.ui.item + '/embed?',
query = [];
Ox.forEach(data, function(value, key) {
if(key[0] != '_') {
query.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
}
});
return url + query.join('&');
}
content.html('To embed this video use this code on your page:<br>');
content.append(
$('<textarea>')
@ -55,7 +44,7 @@ pandora.ui.embedDialog = function(data) {
}).val(
'<iframe width="' + width
+ '" height="' + height
+ '" src="' + constructUrl(data)
+ '" src="' + constructURL(data)
+ '" frameborder="0" allowfullscreen></iframe>'
).on({
click: function() {
@ -64,5 +53,22 @@ pandora.ui.embedDialog = function(data) {
}
})
);
function constructURL(data) {
var url = document.location.protocol
+ '//' + document.location.host
+ '/' + pandora.user.ui.item + '/embed?',
query = [];
Ox.forEach(data, function(value, key) {
if (key[0] != '_') {
query.push(
encodeURIComponent(key) + '=' + encodeURIComponent(value)
);
}
});
return url + query.join('&');
}
return that;
};

View file

@ -220,7 +220,6 @@ pandora.ui.filesView = function(options, self) {
return self.$filesList.value(id, 'instances').length == 0;
});
if (ids.length > 0 && pandora.user.level == 'admin') {
Ox.print('delete', ids);
pandora.api.removeFiles({
ids: ids
}, function(result) {
@ -439,7 +438,10 @@ pandora.ui.filesView = function(options, self) {
data[key] = self['$' + key + 'Input'].value();
});
pandora.api.moveFiles(data, function(result) {
if(pandora.user.ui.item == self.options.id && pandora.user.ui.itemView == 'files') {
if (
pandora.user.ui.item == self.options.id
&& pandora.user.ui.itemView == 'files'
) {
Ox.Request.clearCache(); // fixme: remove
if (self.$checkbox.value()) {
pandora.UI.set({item: result.data.itemId});

View file

@ -64,9 +64,10 @@ pandora.ui.importAnnotations = function(data) {
.replace(/<br[ /]*?>\n/g, '\n')
.replace(/\n\n/g, '<br>\n')
.replace(/\n/g, '<br>\n');
$status.html(Ox.formatDuration(data['in'])
+ ' to ' + Ox.formatDuration(data.out) + '<br>\n'
+ data.text);
$status.html(
Ox.formatDuration(data['in']) + ' to '
+ Ox.formatDuration(data.out) + '<br>\n' + data.text
);
pandora.api.addAnnotation({
'in': data['in'],
out: data.out,
@ -119,12 +120,11 @@ pandora.ui.importAnnotations = function(data) {
reader.onloadend = function(event) {
srt = Ox.parseSRT(this.result);
total = srt.length;
if(total) {
importButton.options({
disabled: false
});
}
$status.html('File contains '+ total + ' annotations.');
total && importButton.options({disabled: false});
$status.html(
'File contains ' + total + ' annotation'
+ (total == 1 ? '' : 's') + '.'
);
};
reader.readAsText(file);
} else {

View file

@ -552,7 +552,8 @@ pandora.ui.infoView = function(data) {
['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length]
) : '';
} else if (key == 'duration') {
return value < 60 ? Math.round(value) + ' sec' : Math.round(value / 60) + ' min';
return value < 60 ? Math.round(value) + ' sec'
: Math.round(value / 60) + ' min';
}
return (Ox.isArray(value) ? value : [value]).map(function(value) {
return key ?

View file

@ -3,7 +3,7 @@
pandora.ui.uploadDialog = function(data) {
var content = Ox.Element().css({margin: '16px'}),
canceled = false,
cancelled = false,
file,
closeButton,
actionButton,
@ -30,7 +30,7 @@ pandora.ui.uploadDialog = function(data) {
} else if (actionButton.options('title') == 'Close') {
that.close();
} else if (actionButton.options('title') == 'Cancel') {
canceled = true;
cancelled = true;
pandora.firefogg && pandora.firefogg.cancel();
pandora.$ui.upload && pandora.$ui.upload.abort();
actionButton.options('title', 'Select Video');
@ -166,8 +166,8 @@ pandora.ui.uploadDialog = function(data) {
function(result, file) {
result = JSON.parse(result);
if (result.progress != 1) {
if(canceled) {
$status.html('Encoding canceled.');
if (cancelled) {
$status.html('Encoding cancelled.');
} else {
$status.html('Encoding failed.');
}
@ -296,12 +296,14 @@ pandora.ui.uploadDialog = function(data) {
options.noUpscaling = true;
if((!info.video.length || (info.video[0].codec == options.videoCodec
&& info.video[0].height <= options.height))
&& (!info.audio.length || info.audio[0].codec == options.audioCodec)) {
options = {
passthrough: true
};
if (
(!info.video.length || (
info.video[0].codec == options.videoCodec
&& info.video[0].height <= options.height
))
&& (!info.audio.length || info.audio[0].codec == options.audioCodec)
) {
options = {passthrough: true};
}
return JSON.stringify(options);
}
@ -314,7 +316,10 @@ pandora.ui.uploadDialog = function(data) {
var video = info.video[0];
html += video.width + 'x' + video.height + ' (' + video.codec + ')';
}
if(info.video && info.video.length>0 && info.audio && info.audio.length>0) {
if (
info.video && info.video.length > 0
&& info.audio && info.audio.length > 0
) {
html += ' / ';
}
if (info.audio && info.audio.length > 0) {
@ -335,7 +340,7 @@ pandora.ui.uploadDialog = function(data) {
}
function selectVideo() {
canceled = false;
cancelled = false;
pandora.firefogg = new Firefogg();
pandora.firefogg.setFormat(pandora.site.video.formats[0]);
if (pandora.firefogg.selectVideo()) {
@ -350,7 +355,9 @@ pandora.ui.uploadDialog = function(data) {
},
keys: ['id', 'available']
}, function(result) {
if(result.data.items.length === 0 || !result.data.items[0].available) {
if (
result.data.items.length === 0 || !result.data.items[0].available
) {
$info.html(formatInfo(info));
$status.html(
options.passthrough