Suite prise en compte mode strict de TypeScript + simplification itération vers la vidéo suivante.
This commit is contained in:
parent
74f9208f1f
commit
b8ed8b806e
@ -49,7 +49,7 @@ export class vCarousel
|
||||
// Si this._firstVideoId a été fourni, on vérifie qu'il est présent dans la liste des conteneurs de vidéos.
|
||||
set firstVideoId(firstVideo: string|undefined)
|
||||
{
|
||||
if((firstVideo!=="" && this._vContainers.findIndex(video => video.id === firstVideo) !== -1) || (firstVideo===""))
|
||||
if((firstVideo!==undefined && firstVideo!=="" && this._vContainers.findIndex(video => video.id === firstVideo) !== -1) || ( firstVideo===""))
|
||||
this._firstVideoId=firstVideo;
|
||||
}
|
||||
|
||||
@ -109,19 +109,12 @@ export class vCarousel
|
||||
if(nbTurn < (vCarousel.nbVContainers-1) || vCarousel._noStop===true)
|
||||
{
|
||||
vContainer.style.display = "none";
|
||||
let nextVContainer: HTMLElement, nextVideo: HTMLMediaElement, nextHash: string;
|
||||
let nextVContainer: HTMLElement, nextVideo: HTMLMediaElement, nextHash: string, nextOne=0;
|
||||
if(i < (vCarousel.nbVContainers-1))
|
||||
{
|
||||
nextVContainer=vCarousel._vContainers[i+1].containerElt;
|
||||
nextVideo=vCarousel._vContainers[i+1].videoElt;
|
||||
nextHash=vCarousel._vContainers[i+1].id;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextVContainer=vCarousel._vContainers[0].containerElt;
|
||||
nextVideo=vCarousel._vContainers[0].videoElt;
|
||||
nextHash=vCarousel._vContainers[0].id;
|
||||
}
|
||||
nextOne=i+1;
|
||||
nextVContainer=vCarousel._vContainers[nextOne].containerElt;
|
||||
nextVideo=vCarousel._vContainers[nextOne].videoElt;
|
||||
nextHash=vCarousel._vContainers[nextOne].id;
|
||||
nextVContainer.style.display = "block";
|
||||
vCarousel._currentVideo=nextVideo;
|
||||
// On adapte l'ancre de l'url de manière à ce qu'elle soit cohérente avec la vidéo affichée.
|
||||
|
Loading…
Reference in New Issue
Block a user