11 lines
386 B
JavaScript
11 lines
386 B
JavaScript
function openVideo (elt) {
|
|
|
|
let url = elt.href;
|
|
|
|
var embedLink = url.replace(/(https?:\/\/.*\/videos)\/watch\/(.*)/, '$1/embed/$2?start=1s&autoplay=1');
|
|
|
|
elt.insertAdjacentHTML('afterend', '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts allow-popups" src="'+embedLink+'" frameborder="0" allowfullscreen></iframe>');
|
|
|
|
elt.style.display = "none";
|
|
}
|