embeds
This commit is contained in:
parent
d7694c1ae0
commit
2d6621ee06
1 changed files with 22 additions and 17 deletions
|
@ -24,21 +24,23 @@ function getEmbedURL(id, videoURL) {
|
||||||
+ '&in=' + inPoint + '&out=' + outPoint
|
+ '&in=' + inPoint + '&out=' + outPoint
|
||||||
+ '&paused=false&showCloseButton=true';
|
+ '&paused=false&showCloseButton=true';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVideoOverlay(page) {
|
function getVideoOverlay(page) {
|
||||||
return (editable || links[page]) ? {
|
var links = embeds.filter(function(embed) {
|
||||||
|
return embed.page == page && embed.type =='inline';
|
||||||
|
});
|
||||||
|
return (editable || links.length) ? {
|
||||||
beginLayout: function() {
|
beginLayout: function() {
|
||||||
this.counter = 0;
|
this.counter = 0;
|
||||||
//console.log('lets beging');
|
|
||||||
},
|
},
|
||||||
endLayout: function() {
|
endLayout: function() {
|
||||||
//console.log('lets end it here');
|
|
||||||
},
|
},
|
||||||
appendImage: function(image) {
|
appendImage: function(image) {
|
||||||
var id = ++this.counter,
|
var id = ++this.counter,
|
||||||
hasVideo = links[page] && links[page][id],
|
video = links.filter(function(embed) {
|
||||||
|
return embed.id == id;
|
||||||
|
})[0],
|
||||||
$interface, $playButton, $editButton;
|
$interface, $playButton, $editButton;
|
||||||
if (editable || hasVideo) {
|
if (editable || video) {
|
||||||
$interface = Ox.$('<div>')
|
$interface = Ox.$('<div>')
|
||||||
.addClass('interface')
|
.addClass('interface')
|
||||||
.css({
|
.css({
|
||||||
|
@ -66,7 +68,7 @@ function getVideoOverlay(page) {
|
||||||
if (editable) {
|
if (editable) {
|
||||||
$editButton.show();
|
$editButton.show();
|
||||||
}
|
}
|
||||||
if (hasVideo) {
|
if (video) {
|
||||||
enableVideoUI();
|
enableVideoUI();
|
||||||
}
|
}
|
||||||
this.div.appendChild($interface[0]);
|
this.div.appendChild($interface[0]);
|
||||||
|
@ -78,7 +80,7 @@ function getVideoOverlay(page) {
|
||||||
$iframe = Ox.$('<iframe>')
|
$iframe = Ox.$('<iframe>')
|
||||||
.attr({
|
.attr({
|
||||||
id: videoId,
|
id: videoId,
|
||||||
src: getEmbedURL(videoId, links[page][id]),
|
src: getEmbedURL(videoId, video.src),
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
frameborder: 0
|
frameborder: 0
|
||||||
|
@ -92,21 +94,24 @@ function getVideoOverlay(page) {
|
||||||
var url;
|
var url;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (!links[page]) {
|
|
||||||
links[page] = {}
|
|
||||||
}
|
|
||||||
if (!links[page][id]) {
|
|
||||||
links[page][id] = '';
|
|
||||||
}
|
|
||||||
url = prompt(
|
url = prompt(
|
||||||
'Please enter a pan.do/ra video URL, like\n'
|
'Please enter a pan.do/ra video URL, like\n'
|
||||||
+ 'https://0xdb.org/0315594/00:13:37,00:23:42 or\n'
|
+ 'https://0xdb.org/0315594/00:13:37,00:23:42 or\n'
|
||||||
+ 'http://pad.ma/A/editor/00:00:00,00:01:00,00:02:00'
|
+ 'http://pad.ma/A/editor/00:00:00,00:01:00,00:02:00'
|
||||||
+ (links[page][id] ? '\n\nTo remove the video, just remove the URL.' : ''),
|
+ (video ? '\n\nTo remove the video, just remove the URL.' : ''),
|
||||||
links[page][id]
|
video.src
|
||||||
);
|
);
|
||||||
if (url !== null) {
|
if (url !== null) {
|
||||||
links[page][id] = url;
|
if(!video) {
|
||||||
|
video = {
|
||||||
|
page: page,
|
||||||
|
id: id,
|
||||||
|
src: ''
|
||||||
|
};
|
||||||
|
embeds.push(video);
|
||||||
|
}
|
||||||
|
video.src = url
|
||||||
saveVideoOverlay();
|
saveVideoOverlay();
|
||||||
url !== '' ? enableVideoUI() : disableVideoUI()
|
url !== '' ? enableVideoUI() : disableVideoUI()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue