forked from 0x2620/pandora
clean up embedVideoDialog
This commit is contained in:
parent
0ad49ad303
commit
c36dc677f5
1 changed files with 37 additions and 46 deletions
|
@ -1,11 +1,40 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||
'use strict';
|
||||
|
||||
pandora.ui.embedDialog = function(data) {
|
||||
pandora.ui.embedVideoDialog = function() {
|
||||
|
||||
var content = Ox.Element().css({margin: '16px'}),
|
||||
var width = 640,
|
||||
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({
|
||||
buttons: [
|
||||
Ox.Button({
|
||||
|
@ -18,53 +47,15 @@ pandora.ui.embedDialog = function(data) {
|
|||
})
|
||||
],
|
||||
closeButton: true,
|
||||
content: content,
|
||||
height: 120,
|
||||
keys: {
|
||||
'escape': 'close'
|
||||
},
|
||||
content: $content,
|
||||
fixedSize: true,
|
||||
height: 128,
|
||||
keys: {escape: 'close'},
|
||||
removeOnClose: true,
|
||||
title: 'Embed Video',
|
||||
width: 600
|
||||
})
|
||||
.bindEvent({
|
||||
close: function(data) {
|
||||
}
|
||||
width: 368
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
};
|
Loading…
Reference in a new issue