-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
24 lines (24 loc) · 1.16 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//https://www.youtube.com/watch?v=dQw4w9WgXcQ
//https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?wmode=transparent&iv_load_policy=3&autoplay=1&html5=1&showinfo=0&rel=0&modestbranding=1&playsinline=0&theme=light
const base = "https://www.youtube-nocookie.com/embed/";
const end = "?wmode=transparent&iv_load_policy=3&autoplay=0&html5=1&showinfo=0&rel=0&modestbranding=1&playsinline=0&theme=light";
const strip_timestamps = /\?t=\d+/;
var submit = document.getElementById('submit');
var download = document.getElementById('download');
var url = document.getElementById('url');
var video_holder;
var video_holder_holder = document.getElementById('video-holder-holder');
var link;
var id;
submit.onclick = () => {
if(document.getElementById('instructions')) {
document.getElementById('instructions').remove();
}
link = url.value;
id = link.replace(strip_timestamps, "");
id = id.substr(id.length - 11, 11);
video_holder = document.getElementById('video-holder').cloneNode(true);
video_holder.style.display = 'block';
video_holder.children[1].src = base + id + end;
video_holder_holder.appendChild(video_holder);
}