Commit d5ed6406 authored by stephane's avatar stephane

généralisation du module vidéo aux autres instances que peertube.cpy.re

parent a87fe19b
......@@ -17,6 +17,10 @@ $(document).ready(function () {
return (url.split('/')[3])
}
}
getInstance = function (url) {
return(url.split('/')[2])
}
$('.editVideoModal').modal()
$('.editVideoForm').submit(function (e) {
e.preventDefault()
......@@ -25,16 +29,19 @@ $(document).ready(function () {
let videoUrl = $('#editVideoForm-' + sectionId + " input[name=videoUrl]").val()
let videoId = getVideoId(videoType, videoUrl)
let instance = getInstance(videoUrl)
if(videoType === 'youtube'){
$('#videoContainer-'+sectionId).html('<iframe width="560" height="315" src="//www.youtube.com/embed/' + videoId + '" frameborder="0" allowfullscreen></iframe>');
}else if(videoType === 'peertube'){
$('#videoContainer-'+sectionId).html('<iframe width="560" height="315" src="https://peertube.cpy.re/videos/embed/' + videoId + '" frameborder="0" allowfullscreen></iframe>');
//let instance = getInstance(videoUrl)
$('#videoContainer-'+sectionId).html('<iframe width="560" height="315" src="https://' + instance + '/videos/embed/' + videoId + '" frameborder="0" allowfullscreen></iframe>');
}else if(videoType === "vimeo"){
$('#videoContainer-'+sectionId).html('<iframe src="https://player.vimeo.com/video/' + videoId + '" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>');
}
$('#uglyForm input[name=uglyForm-' + sectionId + '-videoType]').val(videoType)
$('#uglyForm input[name=uglyForm-' + sectionId + '-videoId]').val(videoId)
$('#uglyForm input[name=uglyForm-' + sectionId + '-instance]').val(instance)
// $('#videoTypeModuleVideo-'+sectionId).html(label)
// $('#videoModuleBtn-'+sectionId).attr('href', videoUrl)
$('.editVideoModal').modal('close')
......
......@@ -20,6 +20,10 @@
"content": {
"type": "text",
"value": "<p>Cette vidéo tutoriel vous guidera dans vos premiers pas avec Noemie CMS</p>"
},
"instance": {
"type": "text",
"value": "peertube.cpy.re"
}
}
}
......@@ -27,7 +27,7 @@
<iframe width="560" height="315" src="//www.youtube.com/embed/{{@fields['videoId']['value']}}" frameborder="0" allowfullscreen></iframe>
</check>
<check if="{{ @fields['videoType']['value'] == 'peertube' }}">
<iframe width="560" height="315" src="https://peertube.cpy.re/videos/embed/{{@fields['videoId']['value']}}" frameborder="0" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://{{@fields['instance']['value']}}/videos/embed/{{@fields['videoId']['value']}}" frameborder="0" allowfullscreen></iframe>
</check>
<check if="{{ @fields['videoType']['value'] == 'vimeo' }}">
<iframe src="https://player.vimeo.com/video/{{@fields['videoId']['value']}}" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment