<div class="PrePlayPageHeader-altPageHeader-3bZbS PrePlayPageHeader-pageHeader-2o14F PageHeader-pageHeader-18RSw">
    <div class="PageHeaderLeft-pageHeaderLeft-2TxSo"><a
                href="/tvshow/<?php echo $season->getTvShow()->id; ?>"
                role="link" class="PageHeaderBreadcrumbButton-link-1N0DD Link-link-2XYrU Link-default-32xSO"><?php echo $season->getTvShow()->title; ?></a>
        <button aria-haspopup="true" role="button"
                class="PageHeaderBreadcrumbButton-button-1uaPj DisclosureArrowButton-disclosureArrowButton-3tbYZ DisclosureArrowButton-medium-3-Y37  Link-link-2XYrU Link-default-32xSO"
                type="button">Saison <?php echo $season->number; ?>
            <div class="DisclosureArrowButton-disclosureArrow-34Wg3 DisclosureArrow-disclosureArrow-1sBFv DisclosureArrowButton-down-bd2wx DisclosureArrowButton-medium-3-Y37 DisclosureArrow-down-1U7WW DisclosureArrow-up-rjGpc DisclosureArrow-default-3_FCW DisclosureArrow-medium-3VjTd "></div>
        </button></div>
    <div class="PageHeaderRight-pageHeaderRight-2CT0g">
        <div class="pageHeaderToolbar-toolbarContainer-2N-IJ Measure-container-2XznZ">
            <div class="pageHeaderToolbar-toolbar-1lW-M">
                <button id="id-22" aria-label="Lire" data-qa-id="toolbarPlay" role="button"
                        class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
                        type="button"><i class="plex-icon-toolbar-play-560"
                                                                  aria-hidden="true"></i></button>
                <button id="id-23" aria-label="Ordre aléatoire." data-qa-id="toolbarShuffle" role="button"
                        class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
                        type="button"><i class="plex-icon-toolbar-shuffle-560"
                                                                  aria-hidden="true"></i></button>
                <button id="id-24" aria-label="Ajouter à la liste de lecture" data-qa-id="toolbarPlaylist"
                        role="button"
                        class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
                        type="button"><i class="plex-icon-toolbar-add-to-playlist-560"
                                                                  aria-hidden="true"></i></button>
                <button id="id-21" aria-label="Plus..." aria-haspopup="true" data-qa-id="toolbarMore" role="button"
                        class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO"
                        type="button"><i class="plex-icon-toolbar-more-560"
                                                                  aria-hidden="true"></i></button>
            </div>
            <div class="Measure-scrollContainer-3vb4J">
                <div class="Measure-expandContent-1JQfL"></div>
            </div>
            <div class="Measure-scrollContainer-3vb4J">
                <div class="Measure-shrinkContent-32Udi Measure-expandContent-1JQfL"></div>
            </div>
        </div>
        <div class="PrePlayPageHeader-divider-WQRk8 PageHeaderDivider-pageHeaderDivider-DvwUq"></div>
        <button id="id-15" aria-label="Montrer les affiches" data-qa-id="toolbarToggleArtwork" role="button"
                class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO" type="button">
            <i class="plex-icon-toolbar-artwork-560" aria-hidden="true"></i></button>
        <div class="PageHeaderDivider-pageHeaderDivider-DvwUq"></div>
        <div>
            <button id="id-18" data-qa-id="toolbarPrevious" role="button"
                    class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO isDisabled "
                    type="button" disabled=""><i class="plex-icon-page-prev-560"
                                                                          aria-hidden="true"></i></button>
            <button id="id-19" data-qa-id="toolbarNext" role="button"
                    class="ToolbarButton-toolbarButton-3xzHJ Link-link-2XYrU Link-default-32xSO isDisabled "
                    type="button" disabled=""><i class="plex-icon-page-next-560"
                                                                          aria-hidden="true"></i></button>
        </div>
    </div>
</div>
<div class="PrePlayPageContent-prePlayPageContentContainer-1ckaM PageContent-pageContent-16mK6">
    <div class="PrePlayPageContent-prePlayPageContent-1fFCH Scroller-scroller-d5-b- Scroller-vertical-1bgGS ">
        <div class="PageContent-innerPageContent-3ktLT">
            <div>
                <div style="position: fixed; top: 180px;">
                    <div class="MetadataPosterCard-cardContainer-2gRcQ"
                         data-qa-id="metadataPosterCard--/library/metadata/28083">
                        <div class="MetadataPosterCard-card-3bztR " style="width: 260px; height: 390px;">
                            <div class="PrePlayPosterCard-face-3rQEj MetadataPosterCardFace-face--dz_D MetadataPosterCardFace-poster-L2P6r MetadataPosterCardFace-faceFront-1bxHG  ">
                                <div class="PosterCardImg-imageContainer-1Ar4M" data-season-id="<?php echo $season->id; ?>">
                                    <div style="background-image: url(); background-size: cover; background-position: center center; background-repeat: no-repeat; width: 100%; height: 100%; position: absolute; z-index: 2;"
                                         class=""></div>
                                </div>
                                <div class=" MetadataPosterCardOverlay-overlay-1uMpL         ">
                                    <div class="MetadataPosterCardOverlay-background-2EwyB"></div>
                                    <div data-qa-id="metadataPosterUnwatchedNumberBadge"
                                         class="MetadataPosterCardOverlay-unwatchedBadge-Qn1fv MetadataPosterCardOverlay-badge-1FU-p">
                                        6
                                    </div>
                                    <button aria-label="Lire Saison 1" tabindex="-1"
                                            data-qa-id="metadataPosterPlayButton" role="button"
                                            class="MetadataPosterCardOverlay-playCoverButton-I7oU3 MetadataPosterCardOverlay-playButton-1fjhk PlayButton-playButton-3WX8X MetadataPosterCardOverlay-button-M43H- Link-link-2XYrU Link-default-32xSO      "
                                            type="button">
                                        <div class="MetadataPosterCardOverlay-playCircle-M67q6 PlayButton-playCircle-3Evfd MetadataPosterCardOverlay-centerCircle-1Mg-s">
                                            <i class="plex-icon-play-560 PlayButton-playIcon-dt3sk"
                                               aria-hidden="true"></i></div>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="PrePlayMetadataContent-content-2ww3j" style="padding-left: 320px;">
                    <div class="Measure-container-2XznZ">
                        <div class="PrePlayMetadataInnerContent-innerContent-1BPzw">
                            <div class="PrePlayPrimaryTitle-primaryTitle-1r9P9" data-qa-id="preplayMainTitle"><a
                                        data-qa-id="metadataTitleLink" title="<?php echo $season->getTvShow()->title; ?>"
                                        href="/tvshow/<?php echo $season->getTvShow()->id; ?>"
                                        role="link" class=" Link-link-2XYrU Link-default-32xSO      "><?php echo $season->getTvShow()->title; ?></a>
                            </div>
                            <div class="PrePlaySecondaryTitle-secondaryTitle-YJRGC PrePlayPrimaryTitle-primaryTitle-1r9P9"
                                 data-qa-id="preplaySecondTitle">
                                <div class="PrePlayLeftTitle-leftTitle-Ev1KG">Saison <?php echo $season->number; ?></div>
                            </div>
                        </div>
                        <div class="PrePlayDivider-divider-1qvbj"></div>
                        <div class="Measure-scrollContainer-3vb4J">
                            <div class="Measure-expandContent-1JQfL"></div>
                        </div>
                        <div class="Measure-scrollContainer-3vb4J">
                            <div class="Measure-shrinkContent-32Udi Measure-expandContent-1JQfL"></div>
                        </div>
                    </div>
                    <div class="PrePlayMetadataListInnerContent-innerContent-2CsIz">
                        <div class="PrePlayList-container-WZ86O HubCell-hubCell-3Ys17"
                             data-qa-id="preplayContainer--episode">
                            <div class="PrePlayDescendantList-descendantHubCellHeader-2qK3U HubCellHeader-hubCellHeader-2pvYN">
                                <div class="HubCellTitle-hubCellTitle-2abIn"><?php echo $season->leafCount; ?> EPISODES
                                </div>
                            </div>
                            <div style="margin-top: 15px">
                                <div class=" " style="width: 100%; height: auto;">
                                    <?php foreach ($season->getEpisodes() as $episode) : ?>
                                    <div class=" virtualized-cell-3KPHx " data-qa-id="cellItem" style="display: inline-block; margin-left: 20px;">
                                        <div class="MetadataPosterCard-cardContainer-2gRcQ">
                                            <div class="MetadataPosterCard-card-3bztR "
                                                 style="width: 192px; height: 108px;">
                                                <div class="MetadataPosterCardFace-face--dz_D MetadataPosterCardFace-poster-L2P6r MetadataPosterCardFace-faceFront-1bxHG  ">
                                                    <div class="PosterCardImg-imageContainer-1Ar4M" data-movie-id="<?php echo $episode->id; ?>">
                                                        <div style="background-image: url(); background-size: cover; background-position: center center; background-repeat: no-repeat; width: 100%; height: 100%; position: absolute; z-index: 2;"
                                                             class=""></div>
                                                    </div>
                                                    <div class=" MetadataPosterCardOverlay-overlay-1uMpL">
                                                        <div class="MetadataPosterCardOverlay-background-2EwyB"></div>
                                                        <a href="/episode/<?php echo $episode->id; ?>"
                                                           role="link"
                                                           class="MetadataPosterCardOverlay-link-1Swhl Link-link-2XYrU Link-default-32xSO      "></a>
                                                        <button tabindex="-1" role="button" data-id="<?php echo $episode->id; ?>"
                                                                class="MetadataPosterCardOverlay-playButton-1fjhk PlayButton-playButton-3WX8X MetadataPosterCardOverlay-button-M43H- Link-link-2XYrU Link-default-32xSO      "
                                                                type="button">
                                                            <div class="MetadataPosterCardOverlay-playCircle-M67q6 PlayButton-playCircle-3Evfd MetadataPosterCardOverlay-centerCircle-1Mg-s">
                                                                <i class="plex-icon-play-560 PlayButton-playIcon-dt3sk"
                                                                   aria-hidden="true"></i></div>
                                                        </button>
                                                        <button data-qa-id="metadataPosterMoreButton" id="id-105"
                                                                tabindex="-1" aria-label="Plus d'actions"
                                                                aria-haspopup="true" role="button"
                                                                class="MetadataPosterCardOverlay-moreButton-3FK-K MetadataPosterCardOverlay-button-M43H- Link-link-2XYrU Link-default-32xSO      "
                                                                type="button"><i class="plex-icon-more-560"
                                                                                 aria-hidden="true"></i>
                                                            </button>
                                                        <button aria-label="Sélectionner Pilot" id="id-104"
                                                                tabindex="-1" role="button"
                                                                class="MetadataPosterCardOverlay-selectButton-3rwSV SelectButton-selectButton-3Kbjm MetadataPosterCardOverlay-button-M43H-  Link-link-2XYrU Link-default-32xSO      "
                                                                type="button">
                                                            <div class="MetadataPosterCardOverlay-selectCircle-3ql8S SelectButton-selectCircle-3tdvG"
                                                                 data-qa-id="multipleSelectButton"><i
                                                                        class="plex-icon-selected-560 SelectButton-selectedIcon-3-SAL"
                                                                        aria-hidden="true"></i></div>
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div data-qa-id="metadataTitleContainer"
                                             class="MetadataPosterCell-titleContainer-24DI6">
                                            <a title="<?php echo $episode->title; ?>" href="/tvshow/<?php echo $episode->id; ?>"
                                                    role="link" style="width: 192px;"
                                                    class=" MetadataPosterTitle-singleLineTitle-24_DN MetadataPosterTitle-title-3tU5F Link-link-2XYrU Link-default-32xSO">
                                                <?php echo $episode->title; ?>
                                            </a>
                                            <span class=" MetadataPosterTitle-singleLineTitle-24_DN MetadataPosterTitle-title-3tU5F MetadataPosterTitle-isSecondary-2VUxY ">Episode <?php echo $episode->number; ?></span>
                                        </div>
                                    </div>
                                    <?php endforeach; ?>
                                </div>
                            </div>
                        </div>
                        <div class="PrePlayMetadataInnerContent-innerContent-1BPzw">
                            <div class="PrePlayCastList-castList-3dQB5"></div>
                            <div class="PrePlayRelatedList-relatedList-2fY8S"
                                 style="opacity: 0; pointer-events: none;"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="Measure-scrollContainer-3vb4J">
        <div class="Measure-expandContent-1JQfL"></div>
    </div>
    <div class="Measure-scrollContainer-3vb4J">
        <div class="Measure-shrinkContent-32Udi Measure-expandContent-1JQfL"></div>
    </div>
</div>
<script type="text/javascript">
    $(window).on('load', function() {
        $(document).on('click', '.MetadataPosterCardOverlay-playButton-1fjhk.PlayButton-playButton-3WX8X', function (event) {
            event.stopPropagation();
            var movie_id = $(this).data('id');
            $.ajax({
                url: '/rest/movie/stream',
                method: 'GET',
                data: { movie_id : movie_id },
                dataType: 'html'
            }).done(function(view) {
                launchPlayer(view);
            }).fail(function(data) {
                console.error(data);
            });
        });
    });
    $('.PosterCardImg-imageContainer-1Ar4M[data-season-id]').each(function (index, element) {
        var season_id = $(element).data('season-id');
        $('[data-season-id="' + season_id + '"] > div').css('background-image', 'url("/cover/season?season_id='+ season_id +'&width='+ 338 +'&height='+ 488 +'")');

        /** CHANGE BACKGROUND **/
        var background = $('.background-container .FullPage-container-3qanw > div > div > div');
        $(background).css('background-image', 'url("/cover/season?season_id='+ season_id +'&width='+ 325 +'&height='+ 488 +'")');
        $(background).css('filter', 'blur(100px)');
        $(background).css('opacity', '0.3');
    });
    $('.PosterCardImg-imageContainer-1Ar4M[data-movie-id]').each(function (index, element) {
        var movie_id = $(element).data('movie-id');
        $('[data-movie-id="' + movie_id + '"] > div').css('background-image', 'url("/cover/movie?movie_id='+ movie_id +'&width='+ 240 +'&height='+ 135 +'&thumb=true")');
    });
</script>