2020-12-13 14:39:58 +01:00
|
|
|
function openVideo (elt) {
|
|
|
|
|
|
|
|
let url = elt.href;
|
|
|
|
|
2020-12-13 15:09:08 +01:00
|
|
|
var embedLink = url.replace(/(https?:\/\/.*\/videos)\/watch\/(.*)/, '$1/embed/$2?start=0s&autoplay=1');
|
2020-12-13 14:39:58 +01:00
|
|
|
|
|
|
|
|
2020-12-13 15:09:08 +01:00
|
|
|
var image = elt.getElementsByTagName('img')[0];
|
|
|
|
|
|
|
|
image.style.display = "none";
|
|
|
|
|
|
|
|
image.insertAdjacentHTML('afterend', '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts allow-popups" src="'+embedLink+'" frameborder="0" allowfullscreen></iframe>');
|
2020-12-13 14:39:58 +01:00
|
|
|
}
|