- add RuTube servise
This commit is contained in:
Alexandrina-Kuzeleva
2025-11-10 17:00:10 +03:00
parent 0cb8d21290
commit 25c640fabb
9 changed files with 102 additions and 0 deletions

View File

@@ -9,6 +9,16 @@
allowfullscreen
></iframe>
</div>
<div v-if="rutube">
<iframe
class="rutube-video"
:src="getRutubeVideoSource(rutube.split('/').pop())"
width="100%"
:height="screenSize.width < 640 ? 200 : 400"
frameborder="0"
allowfullscreen
></iframe>
</div>
<div v-for="block in content?.split('\n\n')">
<div v-if="block.includes('{{ YouTubeVideo')">
<iframe
@@ -20,6 +30,16 @@
allowfullscreen
></iframe>
</div>
<div v-else-if="block.includes('{{ RutubeVideo')">
<iframe
class="rutube-video"
:src="getRutubeVideoSource(block)"
width="100%"
:height="screenSize.width < 640 ? 200 : 400"
frameborder="0"
allowfullscreen
></iframe>
</div>
<div v-else-if="block.includes('{{ Quiz')">
<Quiz :quiz="getId(block)" />
</div>
@@ -97,6 +117,13 @@ const getYouTubeVideoSource = (block) => {
return `https://www.youtube.com/embed/${block}`
}
const getRutubeVideoSource = (block) => {
if (block.includes('{{')) {
block = getId(block)
}
return `https://rutube.ru/play/embed/${block}`
}
const getPDFSource = (block) => {
return `${getId(block)}#toolbar=0`
}
@@ -105,3 +132,11 @@ const getId = (block) => {
return block.match(/\(["']([^"']+?)["']\)/)[1]
}
</script>
<style scoped>
.youtube-video,
.rutube-video {
display: block;
margin: 0 auto;
}
</style>