cleanup, fix double close button

This commit is contained in:
rolux 2012-06-18 13:06:24 +02:00
parent f1d8fcbe36
commit af8f7e2842

View file

@ -3,11 +3,11 @@
pandora.ui.uploadDialog = function(data) { pandora.ui.uploadDialog = function(data) {
var actionButton, var cancelled = false,
cancelled = false,
closeButton,
file, file,
selectFile, selectFile,
$actionButton,
$closeButton,
$content = Ox.Element().css({margin: '16px'}), $content = Ox.Element().css({margin: '16px'}),
$info = $('<div>').css({padding: '4px'}) $info = $('<div>').css({padding: '4px'})
.html('Please select the video file you want to upload.'), .html('Please select the video file you want to upload.'),
@ -15,7 +15,7 @@ pandora.ui.uploadDialog = function(data) {
$status = $('<div>').css({padding: '4px', paddingTop: '8px'}), $status = $('<div>').css({padding: '4px', paddingTop: '8px'}),
that = Ox.Dialog({ that = Ox.Dialog({
buttons: [ buttons: [
closeButton = Ox.Button({ $closeButton = Ox.Button({
id: 'close', id: 'close',
title: 'Close' title: 'Close'
}).bindEvent({ }).bindEvent({
@ -23,26 +23,24 @@ pandora.ui.uploadDialog = function(data) {
that.triggerEvent('close'); that.triggerEvent('close');
} }
}), }),
actionButton = Ox.Button({ $actionButton = Ox.Button({
id: 'action', id: 'action',
title: 'Select Video' title: 'Select Video'
}).bindEvent({ }).bindEvent({
click: function() { click: function() {
if (actionButton.options('title') == 'Select Video') { if ($actionButton.options('title') == 'Select Video') {
if (selectVideo()) { if (selectVideo()) {
actionButton.options('title', 'Upload'); $actionButton.options('title', 'Upload');
} }
} else if (actionButton.options('title') == 'Close') { } else if ($actionButton.options('title') == 'Cancel') {
that.close();
} else if (actionButton.options('title') == 'Cancel') {
cancelled = true; cancelled = true;
pandora.firefogg && pandora.firefogg.cancel(); pandora.firefogg && pandora.firefogg.cancel();
pandora.$ui.upload && pandora.$ui.upload.abort(); pandora.$ui.upload && pandora.$ui.upload.abort();
actionButton.options('title', 'Select Video'); $actionButton.options('title', 'Select Video');
closeButton.show(); $closeButton.show();
} else { } else {
actionButton.options('title', 'Cancel'); $actionButton.options('title', 'Cancel');
closeButton.hide(); $closeButton.hide();
encode(); encode();
} }
} }
@ -97,14 +95,14 @@ pandora.ui.uploadDialog = function(data) {
}) })
.appendTo($content); .appendTo($content);
*/ */
actionButton.options({title: 'Close'}); $info.html(
$info.css({paddingTop: '16px', paddingBottom: '16px'}).html(
'Currently, video upload is only supported in ' 'Currently, video upload is only supported in '
+ '<a target="_new" href="http://mozilla.org/firefox/">Firefox</a> with ' + '<a target="_new" href="http://mozilla.org/firefox/">Firefox</a>, with '
+ '<a target="_new" href="http://firefogg.org/">Firefogg</a> installed.<br><br>' + '<a target="_new" href="http://firefogg.org/">Firefogg</a> installed.<br><br>'
+ 'Alternatively, you can use ' + 'Alternatively, you can use '
+ '<a target="_new" href="https://wiki.0x2620.org/wiki/pandora_client">pandora_client</a>.' + '<a target="_new" href="https://wiki.0x2620.org/wiki/pandora_client">pandora_client</a>.'
); );
$actionButton.hide();
} }
$content.append($info); $content.append($info);
$content.append($status); $content.append($status);