Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
showVideos(videos) {
let ytids = [];
for(let link of this.mod.videos) {
let id = /[\?&]v=([^&]+)/.exec(link);
if(id) {
ytids.push({
type: 'text/html',
youtube: id[1],
poster: 'https://img.youtube.com/vi/' + id[1] + '/maxresdefault.jpg',
href: 'https://www.youtube.com/watch?v=' + id[1]
});
}
}
this.lightbox = Gallery(ytids, {
youTubeClickToPlay: false,
youTubePlayerVars: {
fs: 0,
vq: 'hd720'
},
toggleControlsOnSlideClick: false,
onslideend: (idx, el) => {
// Make sure the videos start automatically.
let link = el.querySelector('.video-content a');
if(link) link.click();
}
});
},
showScreens(screens) {
this.lightbox = Gallery(this.mod.screenshots);
},