-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
88 lines (80 loc) · 4.26 KB
/
index.html
File metadata and controls
88 lines (80 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lingo Youtube Audio Translator</title>
<!-- Favicon -->
<link rel="icon" href="salriologo_transparent.png" type="image/x-icon">
<!--Bootstrap CSS-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-LN+7fdVzj6u52u30Kp6M/trliBMCMKTyK833zpbD+pXdCLuTusPj697FH4R/5mcr" crossorigin="anonymous">
<!-- Your custom CSS should come after Bootstrap -->
<link rel="stylesheet" href="style.css">
</head>
<body>
<!--Navigation bar-->
<div class="nav-bar">
<ul id="nav-links">
<li><a href="index.html">Lingo</a></li>
</ul>
</div>
<!--container for youtube-->
<div class="container">
<div class="row">
<div class="col">
<h3 id="">Youtube Video</h3>
<input id="user_website_enter_form" placeholder="Enter video URL here" type="text" class="form-control">
<iframe id="youtube_iframe" src="" frameborder="0"></iframe>
<button id="load_video_btn" class="load_video_btn">Load Video</button>
<!--Drop down button to choose language to translate it to and from-->
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1"
data-bs-toggle="dropdown" aria-expanded="false">
Select Language
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
<li><a id="English" class="dropdown-item" href="#" onclick="show_language(event)">English</a>
</li>
<li><a id="Spanish" class="dropdown-item" href="#" onclick="show_language(event)">Spanish</a>
</li>
<li><a id="French" class="dropdown-item" href="#" onclick="show_language(event)">French</a></li>
<li><a id="German" class="dropdown-item" href="#" onclick="show_language(event)">German</a></li>
<li><a id="Chinese" class="dropdown-item" href="#" onclick="show_language(event)">Chinese</a>
</li>
<li><a id="Yoruba" class="dropdown-item" href="#" onclick="show_language(event)">Yoruba</a></li>
<li><a id="Krio" class="dropdown-item" href="#" onclick="show_language(event)">Krio</a></li>
</ul>
</div>
</div>
</div>
<script>
document.getElementById('load_video_btn').onclick = function () {
// Change button text
this.innerHTML = "Translate Video";
// Get URL and update iframe
var url = document.getElementById('user_website_enter_form').value;
if (url.includes("youtube.com") || url.includes("youtu.be")) {
var embedUrl = url;
if (url.includes("watch?v=")) {
embedUrl = url.replace("watch?v=", "embed/");
} else if (url.includes("youtu.be/")) {
embedUrl = "https://www.youtube.com/embed/" + url.split("youtu.be/")[1];
}
document.getElementById('youtube_iframe').src = embedUrl;
} else {
alert("Please enter a valid YouTube URL.");
}
};
function show_language(event) {
event.preventDefault();
// Set the dropdown button text to the selected language
document.getElementById('dropdownMenuButton1').textContent = event.target.textContent;
}
</script>
<!--Bootstrap JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ndDqU0Gzau9qJ1lfW4pNLlhNTkCfHzAVBReH9diLvGRem5+R9g2FzA8ZGN954O5Q"
crossorigin="anonymous"></script>
<script src="app.js"></script>
</body>
</html>