clean up embedVideoDialog

This commit is contained in:
rolux 2013-04-26 10:43:46 +02:00
parent 0ad49ad303
commit c36dc677f5

View file

@ -1,11 +1,40 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript // vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict'; 'use strict';
pandora.ui.embedDialog = function(data) { pandora.ui.embedVideoDialog = function() {
var content = Ox.Element().css({margin: '16px'}), var width = 640,
height = 360, height = 360,
width = 640, url = document.location.href + (
document.location.hash ? '?embed=true' : '#?embed=true'
),
$content = Ox.Element()
.css({margin: '16px'})
.html('To embed this clip, use the following HTML:<br>'),
$embed = $('<textarea>')
.css({
width: '336px',
height: '64px',
marginTop: '8px'
})
.val(
'<iframe width="' + width
+ '" height="' + height
+ '" src="' + url
+ '" frameborder="0" '
+ 'webkitAllowFullScreen mozallowfullscreen allowFullScreen'
+ '></iframe>'
)
.on({
click: function() {
this.focus();
this.select();
}
})
.appendTo($content),
that = Ox.Dialog({ that = Ox.Dialog({
buttons: [ buttons: [
Ox.Button({ Ox.Button({
@ -18,53 +47,15 @@ pandora.ui.embedDialog = function(data) {
}) })
], ],
closeButton: true, closeButton: true,
content: content, content: $content,
height: 120, fixedSize: true,
keys: { height: 128,
'escape': 'close' keys: {escape: 'close'},
},
removeOnClose: true, removeOnClose: true,
title: 'Embed Video', title: 'Embed Video',
width: 600 width: 368
})
.bindEvent({
close: function(data) {
}
}); });
data.view = 'player';
content.html('To embed this video use this code on your page:<br>');
content.append(
$('<textarea>')
.css({
width: '520px',
marginLeft: '16px',
marginRight: '16px',
marginTop: '8px',
height: '50px'
}).val(
'<iframe width="' + width
+ '" height="' + height
+ '" src="' + constructURL(data)
+ '" frameborder="0" '
+ 'webkitAllowFullScreen mozallowfullscreen allowFullScreen'
+ '></iframe>'
).on({
click: function() {
this.focus();
this.select();
}
})
);
function constructURL(data) {
var url = document.location.href + (
document.location.hash ? '?embed=true' : '#?embed=true'
);
return url;
}
return that; return that;
}; };