-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (26 loc) · 778 Bytes
/
script.js
File metadata and controls
30 lines (26 loc) · 778 Bytes
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
console.log('Youtube video detected, YouTube translator enabled 😈')
var url = new URL(document.URL)
var c = url.searchParams.get('v')
if (!!document.URL.match(/file/g)) {
console.log('Debug mode detected ⚠️')
} else if (!c) {
alert('Wow, YouTube video identifier not found 😭')
console.log(document.URL)
} else {
console.log('Youtube Video ' + c + ' detected')
play(c)
}
var button = document.getElementById('button')
if (!!button) {
button.addEventListener('click', () => {
var content = document.getElementById('videoid').value
if (content == '') {
content = 'ePpPVE-GGJw'
}
console.log('Playing ' + content + '...')
play(content)
})
}
function play(video_identifier) {
fetch_transcript(video_identifier)
}