Compare commits
4 Commits
main
...
mp860cx-#2
Author | SHA1 | Date | |
---|---|---|---|
28468a596f | |||
d68e0f14c7 | |||
0a1286a905 | |||
39bfe5dcfe |
@ -53,7 +53,6 @@ async function fetchVideoUrl(word) {
|
|||||||
return data.video_url;
|
return data.video_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Function to load video sequence by words using Supabase
|
// Function to load video sequence by words using Supabase
|
||||||
async function loadVideoSequenceByWords() {
|
async function loadVideoSequenceByWords() {
|
||||||
const words = inputText.value.trim().split(' ');
|
const words = inputText.value.trim().split(' ');
|
||||||
@ -104,6 +103,29 @@ async function loadVideoSequenceByLetters() {
|
|||||||
currentIndex = 0;
|
currentIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to highlight the current word or letter in the textarea
|
||||||
|
function highlightCurrentText(index) {
|
||||||
|
let wordsOrLetters = currentTranslationMode === 'words' ? inputText.value.trim().split(' ') : inputText.value.trim().split('');
|
||||||
|
|
||||||
|
// Reset the highlighted text in the textarea
|
||||||
|
inputText.value = '';
|
||||||
|
inputText.setSelectionRange(0, 0);
|
||||||
|
|
||||||
|
let startIndex = 0;
|
||||||
|
wordsOrLetters.forEach((item, i) => {
|
||||||
|
if (i < index) {
|
||||||
|
startIndex += item.length + (currentTranslationMode === 'words' ? 1 : 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let endIndex = startIndex + wordsOrLetters[index].length;
|
||||||
|
inputText.value = wordsOrLetters.join(currentTranslationMode === 'words' ? ' ' : '');
|
||||||
|
|
||||||
|
// Highlight the current word or letter
|
||||||
|
inputText.setSelectionRange(startIndex, endIndex);
|
||||||
|
inputText.focus();
|
||||||
|
}
|
||||||
|
|
||||||
// Function to play video at a specific index
|
// Function to play video at a specific index
|
||||||
function playVideoAtIndex(index) {
|
function playVideoAtIndex(index) {
|
||||||
if (index < 0 || index >= videoSequence.length) return;
|
if (index < 0 || index >= videoSequence.length) return;
|
||||||
@ -112,6 +134,9 @@ function playVideoAtIndex(index) {
|
|||||||
videoPlayer.play();
|
videoPlayer.play();
|
||||||
currentIndex = index;
|
currentIndex = index;
|
||||||
|
|
||||||
|
// Highlight the current word or letter
|
||||||
|
highlightCurrentText(currentIndex);
|
||||||
|
|
||||||
// Update the title with the current word or letter
|
// Update the title with the current word or letter
|
||||||
const currentLabel = videoSequence[index].split('/').pop().split('.')[0];
|
const currentLabel = videoSequence[index].split('/').pop().split('.')[0];
|
||||||
document.getElementById('currentLetter').innerText = currentLabel.toUpperCase();
|
document.getElementById('currentLetter').innerText = currentLabel.toUpperCase();
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
from supabase import create_client, Client
|
|
||||||
|
|
||||||
# RLS policy permissions required:
|
|
||||||
# buckets table permissions: select
|
|
||||||
# objects table permissions: none
|
|
||||||
|
|
||||||
url: str = ""
|
|
||||||
key: str = ""
|
|
||||||
supabase: Client = create_client(url, key)
|
|
||||||
|
|
||||||
|
|
||||||
# List all objects in the 'video' bucket
|
|
||||||
# .from("bucket_name")
|
|
||||||
# .list("folder_name")
|
|
||||||
response = supabase.storage.from_("video").list("",{"limit": 1000})
|
|
||||||
|
|
||||||
|
|
||||||
for video in response:
|
|
||||||
video_name = video['name'].replace('.mp4', '')
|
|
||||||
video_url = f"{url}/storage/v1/object/public/video/{video_name}.mp4"
|
|
||||||
|
|
||||||
# print the video name and url with tabs
|
|
||||||
print(video_name, video_url, sep="\t")
|
|
||||||
|
|
||||||
response = (
|
|
||||||
# .table("table_name")
|
|
||||||
# .insert({"column_name": value})
|
|
||||||
# .execute SQL query
|
|
||||||
supabase.table("Videa")
|
|
||||||
.insert({"label": video_name, "video_url": video_url})
|
|
||||||
.execute()
|
|
||||||
)
|
|
||||||
# print(response)
|
|
||||||
|
|
@ -153,6 +153,13 @@ h1 {
|
|||||||
background-color: #357ae8;
|
background-color: #357ae8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Zvýraznenie pre aktuálne slovo/písmeno */
|
||||||
|
.highlight {
|
||||||
|
background-color: #ffeb3b; /* Svetložltá farba na zvýraznenie */
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
.video {
|
.video {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 45%;
|
width: 45%;
|
||||||
|
Loading…
Reference in New Issue
Block a user