pandora/static/js/pandora/embedDialog.js

71 lines
1.8 KiB
JavaScript
Raw Normal View History

2012-01-30 23:29:04 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict';
pandora.ui.embedDialog = function(data) {
2012-06-10 18:31:02 +00:00
2012-01-30 23:29:04 +00:00
var content = Ox.Element().css({margin: '16px'}),
2012-02-14 18:48:08 +00:00
height = 360,
width = 640,
2012-01-30 23:29:04 +00:00
that = Ox.Dialog({
buttons: [
Ox.Button({
id: 'close',
title: 'Close'
}).bindEvent({
click: function() {
that.close();
}
})
],
closeButton: true,
content: content,
2012-02-15 09:23:30 +00:00
height: 120,
2012-01-30 23:29:04 +00:00
keys: {
'escape': 'close'
},
2012-02-15 09:23:30 +00:00
removeOnClose: true,
2012-01-30 23:29:04 +00:00
title: 'Embed Video',
2012-02-15 09:23:30 +00:00
width: 600
2012-01-30 23:29:04 +00:00
})
.bindEvent({
close: function(data) {
}
2012-02-15 06:26:41 +00:00
});
2012-06-25 14:49:39 +00:00
data.view = 'player';
2012-02-15 06:26:41 +00:00
2012-06-10 18:31:02 +00:00
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'
2012-06-10 18:31:02 +00:00
}).val(
'<iframe width="' + width
+ '" height="' + height
+ '" src="' + constructURL(data)
2012-12-20 18:29:07 +00:00
+ '" frameborder="0" '
+ 'webkitAllowFullScreen mozallowfullscreen allowFullScreen'
+ '></iframe>'
2012-06-10 18:31:02 +00:00
).on({
click: function() {
this.focus();
this.select();
}
})
);
function constructURL(data) {
2013-02-20 10:46:36 +00:00
var url = document.location.href + (
document.location.hash ? '?embed=true' : '#?embed=true'
);
return url;
2012-02-15 06:26:41 +00:00
}
2012-06-10 18:31:02 +00:00
2012-01-30 23:29:04 +00:00
return that;
2012-06-10 18:31:02 +00:00
2012-01-30 23:29:04 +00:00
};