templates/FrontBundle/Page/spectacles-speciaux2.html.twig line 1

Open in your IDE?
  1. {% extends 'FrontBundle/layout.html.twig' %}
  2. {% block title %}{{ app_sitename }} - {{ page.metaTitle }}{% endblock %}
  3. {% block description %}{{ page.metaDescription }}{% endblock %}
  4. {% block extra_class %}stack{% endblock %}
  5. {% block sub_header %}
  6.     <div class="sub-header anchor">
  7.         <ul>
  8.             <li><a href="#concerts">{{ 'menu_concerts'|tr(tr)|raw }}</a></li>
  9.             <li><a href="#noel">{{ 'menu_noel'|tr(tr)|raw }}</a></li>
  10.             <li><a href="#evenements">{{ 'menu_evenements'|tr(tr)|raw }}</a></li>
  11.         </ul>
  12.     </div>
  13. {% endblock %}
  14. {% block stylesheets %}
  15.     <link href="/front/css/owl.carousel.min.css" rel="stylesheet">
  16.     <link href="/front/css/owl.theme.default.min.css" rel="stylesheet">
  17.     <link href="/plugins/photoswipe/photoswipe.css" rel="stylesheet">
  18.     <link href="/plugins/photoswipe/default-skin/default-skin.css" rel="stylesheet" type="text/css"/>
  19.     <link href="/front/css/carousel.css" rel="stylesheet">
  20.     <style>
  21.         .espace-content h2 {
  22.             font-size: 28px;
  23.         }
  24.         .pointer-event-none{
  25.             pointer-events: none !important;
  26.             font-size: 15px;
  27.             text-transform: uppercase;
  28.             border-radius: 20px;
  29.             transition: 0.3s ease;
  30.             color: var(--purple);
  31.             border: 1px solid var(--purple);
  32.             text-decoration: none;
  33.             padding: 8px 16px;
  34.             width: max-content;
  35.             opacity: 0.5;
  36.             float: left;
  37.         }
  38.         span.name-title{
  39.             font-size: 17px;
  40.             letter-spacing: 3px;
  41.             width: 80%;
  42.             text-align: left;
  43.             display: block;
  44.             text-transform: uppercase;
  45.             color: #1A1A1A;
  46.             font-weight: 600;
  47.         }
  48.         .page_spectacles-speciaux .concerts .description .desc {
  49.             font-size: 14px;
  50.         }
  51.         strong.head {
  52.             font-size: 18px;
  53.             font-style: italic;
  54.         }
  55.         @media screen and (min-width: 1200px) {
  56.             .page_spectacles-speciaux .evenements .description {
  57.                 font-size: 15px;
  58.                 line-height: 20px;
  59.                 color: #707070;
  60.                 padding-left: calc(var(--bs-gutter-x)* .5* 2);
  61.                 display: flex;
  62.                 flex-direction: column;
  63.                 justify-content: center;
  64.                 height: 100%;
  65.                 align-items: center;
  66.             }
  67.             /**
  68.            Ppur la gestion de la modale du menu
  69.             */
  70.             .span-custom {
  71.                 display: flex !important;
  72.                 justify-content: center !important;
  73.             }
  74.             li.custom-liste {
  75.                 text-align: center !important;
  76.                 font-size: 13px;
  77.             }
  78.             li.custom-liste .boisson{
  79.                 font-style: italic;
  80.                 color: var(--gold);
  81.             }
  82.             .space-modale {
  83.                 margin-left: 5.5rem !important;
  84.             }
  85.             .space-modale2 {
  86.                 margin-left: 7.3rem !important;
  87.             }
  88.             @media screen and (max-width: 450px) {
  89.                 li.custom-liste {
  90.                     font-size: 0.85rem !important;
  91.                     text-align: center;
  92.                 }
  93.                 .space-modale h1 {
  94.                     font-size: 1rem !important;
  95.                 }
  96.                 .space-modale {
  97.                     margin-left: 3.5rem !important;
  98.                 }
  99.                 .space-modale2 {
  100.                     margin-left: 2.5rem !important;
  101.                 }
  102.             }
  103.         /**
  104.         fin
  105.          */
  106.     </style>
  107. {% endblock %}
  108. {% block body %}
  109.     {% include 'FrontBundle/Partial/calendar.html.twig' %}
  110.     <section class="espace-content full" id="concerts" style="margin-top: 160px;">
  111.         <div class="content">
  112.             <h1>{{ 'spectacle_h1'|tr(tr)|upper|raw }}</h1>
  113.             <h2 class="mb-5 mt-5">{{ 'menu_concerts'|tr(tr)|upper|raw }}</h2>
  114.             <p class="p-0">{{ 'concert_title'|tr(tr)|raw }}</p>
  115.         </div>
  116.     </section>
  117.     <section class="concerts slider p-0 mt-5 mb-5">
  118.         <div class="content">
  119.             <div class="p-0 row">
  120.                 {% set deadline = "2030-10-31 21:00:00" %}
  121.                 {% set current = "now" | date("Y-m-d H:i:s") %}
  122.                 {% set oktoberfest_added = false %}
  123.                 {% for concert in concerts %}
  124.                     {% if concert.concert is not null and concert.start.timestamp > date().timestamp %}
  125.                         <div class="item col-md-6">
  126.                             <div class="row mb-5">
  127.                                 <div class="col-6 auto">
  128.                                     <img alt="concert" class="cover" src="{{ concert.concert.thumbnail }}" />
  129.                                     <a href="#" class="order red load-event {{ (concert.isfull) ? 'btn-isfull' : '' }}" data-id="{{ concert.id }}">
  130.                                         {{ (concert.isfull) ? 'general_full'|tr(tr)|upper|raw : 'general_reserver'|tr(tr)|upper|raw }}
  131.                                     </a>
  132.                                 </div>
  133.                                 <div class="col-6">
  134.                                     <div class="description">
  135.                                         <span class="name-title"><span>{{ concert.concert.titleLocale(app.request.locale) }}</span></span>
  136.                                         {% if app.request.locale == 'de' %}
  137.                                             <p>{{ concert.strStartDe }}</p>
  138.                                         {% elseif app.request.locale == 'en' %}
  139.                                             <p>{{ concert.strStartEn }}</p>
  140.                                         {% else %}
  141.                                             <p>{{ concert.strStart }}</p>
  142.                                         {% endif %}
  143.                                         <hr>
  144.                                         <p class="desc mb-3">{{ concert.concert.description(app.request.locale)|replace({'Animation:':'<br><br>Animation:','Entertainment:':'<br><br>Entertainment:'})|raw }}</p>
  145.                                         <span class="price">{{ 'menus_tarifs_spectacle_pn'|tr(tr)|ucfirst|raw }} : {{ concert.concert.info('pn') }} €*</span>
  146.                                         <span class="price premium">{{ 'menus_tarifs_spectacle_ph'|tr(tr)|ucfirst|raw }} : {{ concert.concert.info('ph') }} €*</span>
  147.                                         <span class="price purple">{{ 'menus_tarifs_spectacle_vip'|tr(tr)|ucfirst|raw }} : {{ concert.concert.info('vip') }} €*</span>
  148.                                         <p class="desc mt-3">*{{ 'menus_tarifs_horsrepas'|tr(tr)|raw }}</p>
  149.                                         {% if concert.id == 1672 %}
  150.                                             <p class="desc mb-3">{{ 'concert_food3'|tr(tr)|raw }}</p>
  151.                                         {% else %}
  152.                                             <p class="desc mb-3">{{ (concert.venueType.food) ? 'concert_food'|tr(tr)|raw : 'concert_nofood'|tr(tr)|raw }}</p>
  153.                                         {% endif %}
  154.                                     </div>
  155.                                 </div>
  156.                             </div>
  157.                         </div>
  158.                         {% if loop.index == 8 and current <= deadline %}
  159.                             <!-- Pour Oktoberfest -->
  160.                             <div class="item col-md-6">
  161.                                 <div class="row mb-5">
  162.                                     <div class="col-6 auto">
  163.                                         <img alt="concert" class="cover" src="{{ asset('front/img/evenements-2024/oktoberfest-min.jpg') }}" />
  164.                                         <a href="#" class="order red load-event" data-id="1439">
  165.                                             {{ 'general_reserver'|tr(tr)|upper|raw }}
  166.                                         </a>
  167.                                     </div>
  168.                                     <div class="col-6">
  169.                                         <div class="description">
  170.                                             <span class="name-title"><span>OKTOBERFEST</span></span>
  171.                                             {% if app.request.locale == 'de' %}
  172.                                                 <p>Donnerstag, 31. Oktober 2024 / 21h </p>
  173.                                             {% elseif app.request.locale == 'en' %}
  174.                                                 <p>Thursday 31 October 2024 / 21h</p>
  175.                                             {% else %}
  176.                                                 <p>Jeudi 31 Octobre 2024 / 21h</p>
  177.                                             {% endif %}
  178.                                             <hr>
  179.                                             <p class="desc mb-3">{{ 'events_2024_spe'|tr(tr)|raw }}</p>
  180.                                             <p class="desc mt-3">*{{ 'menus_tarifs_horsrepas'|tr(tr)|raw }}</p>
  181.                                             <p class="desc mb-3">{{ 'concert_food2'|tr(tr)|raw }}</p>
  182.                                         </div>
  183.                                     </div>
  184.                                 </div>
  185.                             </div>
  186.                             {% set oktoberfest_added = true %}
  187.                         {% endif %}
  188.                     {% endif %}
  189.                 {% endfor %}
  190.                 <div class="item row">
  191.                     <div class="col-6 auto">
  192.                         &nbsp;
  193.                     </div>
  194.                     <div class="col-6">
  195.                         <div class="description">
  196.                             &nbsp;
  197.                         </div>
  198.                     </div>
  199.                 </div>
  200.             </div>
  201.         </div>
  202.     </section>
  203.     <section class="noel slider pt-5 mt-5" id="noel" style="padding-bottom: 110px;">
  204.         <div class="content pt-5 mt-5 pb-5">
  205.             <div class="row">
  206.                 <div class="col-md-4">{#
  207.                     {% if app.request.locale == 'de' %}
  208.                       <img src="/front/img/spectacle-noel-2023-de.jpg" width="100%"  alt="noel" />
  209.                     {% else %}
  210.                       <img src="/front/img/spectacle-noel-2023.jpg" width="100%"  alt="noel" />
  211.                     {% endif %} #}
  212.                     <img src="{{ asset('/front/img/2025/spectacle-enfants.jpg') }}" width="100%"  alt="spectacle enfants" />
  213.                 </div>
  214.                 <div class="col-md-7 offset-md-1">
  215.                     <p class="title">{{ 'spectacle_enfant'|tr(tr)|raw }}</p>
  216.                     <p class="subtitle pt-5">{{ 'spectacle_enfant_subtitle'|tr(tr)|raw }}</p>
  217.                     <p class="description">{{ 'spectacle_enfant_desc'|tr(tr)|raw }}</p>
  218.                     <div class="d-flex flex-column justify-content-between gap-1 w-125px flex-md-row">
  219.                         {#  <a href="/{{app.request.locale}}/housh-ma-housh" class="pointer-event-none">{{ 'reser_event_home'|tr(tr)|upper|raw }}</a> #}
  220.                         <a href="#" class="cal open-cal" data-date="{{ 'now'|date('Y') }}-{{ ('now'|date('m')|number_format == 12) ? '12' : '11' }}-01">{{ 'general_reserver2'|tr(tr)|upper|raw }}</a>
  221.                         {# <button class="cal rounded-5" data-bs-toggle="modal" data-bs-target="#menu-child">{{ 'voir_le_menu'|tr(tr)|upper|raw }}</button> #}
  222.                     </div>
  223.                 </div>
  224.             </div>
  225.         </div>
  226.     </section>
  227.     <section class="espace-content full mt-5 pt-5" id="evenements">
  228.         <div class="content">
  229.             <h2 class="mb-5">{{ 'menu_evenements'|tr(tr)|upper|raw }}</h2>
  230.             <p class="p-0">{{ 'events_title'|tr(tr)|raw }}</p>
  231.         </div>
  232.     </section>
  233.     <section class="evenements slider p-0 mt-5 mb-5">
  234.         <div class="content">
  235.             <div class="row p-0">
  236.                 {#             <div class="item col-md-6 mb-5">
  237.             <div class="row">
  238.               <div class="col-6 auto">
  239.                 <span class="name">{{ 'events_e1_title'|tr(tr)|upper|raw }}</span>
  240.                 <img alt="event" class="cover" src="/front/img/spectacle-event2.jpg" />
  241.                 <a href="#" class="order purple open-cal" data-date="{{ 'now'|date('Y') }}-12-01">{{ 'general_reserver'|tr(tr)|upper|raw }}</a>
  242.               </div>
  243.               <div class="col-6">
  244.                 <div class="description">
  245.                 {{ 'events_e1'|tr(tr)|raw }}
  246.                 </div>
  247.               </div>
  248.             </div>
  249.             </div> #}
  250.                 <div class="item col-md-6 mb-5">
  251.                     <div class="row">
  252.                         <div class="col-6 auto">
  253.                             <span class="name">{{ 'events_2024_e2_title'|tr(tr)|upper|raw }}</span>
  254.                             <img alt="event" class="cover" src="{{ asset('front/img/2025/oktoberfest.png') }}" />
  255.                             <a href="#" class="order purple link load-event" data-id="1946">
  256.                                 {{ 'general_reserver'|tr(tr)|raw }}
  257.                             </a>
  258.                         </div>
  259.                         <div class="col-6">
  260.                             <div class="description">
  261.                                 {{ 'events_2024_e2'|tr(tr)|raw }}
  262.                             </div>
  263.                         </div>
  264.                     </div>
  265.                 </div>
  266.                 <div class="item col-md-6 mb-5">
  267.                     <div class="row">
  268.                         <div class="col-6 auto">
  269.                             <span class="name">Noël D'or</span>
  270.                             <img alt="event" class="cover" src="{{ asset('front/img/2025/noel-or.jpg') }}" />
  271.                             <a href="#" class="order purple open-cal" data-date="2025-11-01">{{ 'general_reserver'|tr(tr)|upper|raw }}</a>
  272.                         </div>
  273.                         <div class="col-6">
  274.                             <div class="description">
  275.                                 {{ 'events_noel'|tr(tr)|raw }}
  276.                             </div>
  277.                         </div>
  278.                     </div>
  279.                 </div>
  280.                                   <div class="item col-md-12 mb-5 py-5">
  281.                     <div class="row">
  282.                         <div class="col-md-3 auto">
  283.                             <span class="name">{{ 'events_e1_title'|tr(tr)|upper|raw }}</span>
  284.                             <img alt="event" class="cover" src="{{ asset('front/img/evenements-2024/st-sylvestre.jpg') }}" />
  285.                             <a href="#" class="order purple open-cal" data-date="2025-12-31">{{ 'general_reserver'|tr(tr)|upper|raw }}</a>
  286.                         </div>
  287.                         <div class="col-md-9 row">
  288.                             <div class=" col-md-6">
  289.                                 <div class="description">
  290.                                     {{ 'events_2024_e3_gala'|tr(tr)|raw }}
  291.                                 </div>
  292.                             </div>
  293.                             <div class=" col-md-6">
  294.                                 <div class="description">
  295.                                     {{ 'events_2024_e3_loung'|tr(tr)|raw }}
  296.                                 </div>
  297.                             </div>
  298.                         </div>
  299.                     </div>
  300.                 </div>
  301.                 <div class="item col-md-6 mb-5">
  302.                     <div class="row">
  303.                         <div class="col-6 auto">
  304.                             <span class="name">{{ 'events_2024_e1_title'|tr(tr)|upper|raw }}</span>
  305.                             <img alt="event" class="cover" src="{{ asset('front/img/evenements-2024/st-valentin.jpg') }}" />
  306.                             <a href="#" class="order purple open-cal" data-date="2026-02-13">{{ 'general_reserver'|tr(tr)|upper|raw }}</a>
  307.                         </div>
  308.                         <div class="col-6">
  309.                             <div class="description">
  310.                                 {{ 'events_2024_e1'|tr(tr)|raw }}
  311.                             </div>
  312.                         </div>
  313.                     </div>
  314.                 </div>
  315.             </div>
  316.         </div>
  317.     </section>
  318.     <!-- Modale pour le menu père noel -->
  319.     <div class="modal fade" id="menu-child" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="MenuChildLabel" aria-hidden="true">
  320.         <div class="modal-dialog modal-dialog-centered">
  321.             <div class="modal-content border-3">
  322.                 <div class="modal-header border-bottom-0">
  323.                     <div class="d-flex justify-content-end space-modale">
  324.                         <h1 class="modal-title fs-5 " id="MenuChildLabel">  {{ 'menu_noel_enfant_title'|tr(tr)|raw }}</h1>
  325.                     </div>
  326.                     <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  327.                 </div>
  328.                 <div class="modal-body">
  329.                     <div class="d-flex justify-content-center mt-2">
  330.                         {{ 'menu_noel_enfant_content'|tr(tr)|raw }}
  331.                     </div>
  332.                 </div>
  333.             </div>
  334.         </div>
  335.     </div>
  336.     <!-- fin de la modale -->
  337.     <!-- Modale pour le menu saint-sylvestre --->
  338.     <div class="modal fade" id="menu-saint-sylvestre" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="MenuSaintSylvestreLabel" aria-hidden="true">
  339.         <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
  340.             <div class="modal-content border-3">
  341.                 <div class="modal-header border-bottom-0">
  342.                     <div class="d-flex justify-content-end space-modale2">
  343.                         <h1 class="modal-title fs-5 " id="MenuSaintSylvestreLabel">  {{ 'menus_tarifs_ss_title'|tr(tr)|raw }}</h1>
  344.                     </div>
  345.                     <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  346.                 </div>
  347.                 <div class="modal-body">
  348.                     <div class="d-flex justify-content-center mt-2">
  349.                         {{ 'menu_tarif_ss_home'|tr(tr)|raw }}
  350.                     </div>
  351.                 </div>
  352.             </div>
  353.         </div>
  354.     </div>
  355.     <!-- fin de la modale --->
  356.     {% include 'FrontBundle/Partial/footer.html.twig' %}
  357.     <!-- Root element of PhotoSwipe. Must have class pswp. -->
  358.     <div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
  359.         <!-- Background of PhotoSwipe.
  360.           It's a separate element as animating opacity is faster than rgba(). -->
  361.         <div class="pswp__bg"></div>
  362.         <!-- Slides wrapper with overflow:hidden. -->
  363.         <div class="pswp__scroll-wrap">
  364.             <!-- Container that holds slides.
  365.               PhotoSwipe keeps only 3 of them in the DOM to save memory.
  366.               Don't modify these 3 pswp__item elements, data is added later on. -->
  367.             <div class="pswp__container">
  368.                 <div class="pswp__item"></div>
  369.                 <div class="pswp__item"></div>
  370.                 <div class="pswp__item"></div>
  371.             </div>
  372.             <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
  373.             <div class="pswp__ui pswp__ui--hidden">
  374.                 <div class="pswp__top-bar">
  375.                     <!--  Controls are self-explanatory. Order can be changed. -->
  376.                     <div class="pswp__counter"></div>
  377.                     <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
  378.                     <button class="pswp__button pswp__button--share" title="Share"></button>
  379.                     <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
  380.                     <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
  381.                     <!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
  382.                     <!-- element will get class pswp__preloader--active when preloader is running -->
  383.                     <div class="pswp__preloader">
  384.                         <div class="pswp__preloader__icn">
  385.                             <div class="pswp__preloader__cut">
  386.                                 <div class="pswp__preloader__donut"></div>
  387.                             </div>
  388.                         </div>
  389.                     </div>
  390.                 </div>
  391.                 <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
  392.                     <div class="pswp__share-tooltip"></div>
  393.                 </div>
  394.                 <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
  395.                 </button>
  396.                 <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
  397.                 </button>
  398.                 <div class="pswp__caption">
  399.                     <div class="pswp__caption__center"></div>
  400.                 </div>
  401.             </div>
  402.         </div>
  403.     </div>
  404. {% endblock %}
  405. {% block javascripts %}
  406.     <script src="/front/js/owl.carousel.min.js"></script>
  407.     <script src="/plugins/photoswipe/photoswipe.min.js"></script>
  408.     <script src="/plugins/photoswipe/photoswipe-ui-default.min.js"></script>
  409.     <script type="text/javascript">
  410.         $( document ).ready(function() {
  411.             $('.open-date').on('click', function(e){
  412.                 e.preventDefault();
  413.                 loadEvent($(this).data('id'));
  414.             });
  415.             var url_anchor = $(location).attr('href');
  416.             url_anchor_arr = url_anchor.split("#");
  417.             if(url_anchor_arr.length > 1){
  418.                 console.log(url_anchor_arr[1]);
  419.                 setTimeout(function(){ $('.anchor a[href="#'+url_anchor_arr[1]+'"]').click(); }, 1000);
  420.             }
  421.             var owl2 = $('.noel .owl-carousel');
  422.             owl2.owlCarousel({
  423.                 loop: false,
  424.                 mouseDrag: false,
  425.                 touchDrag: false,
  426.                 pullDrag: false,
  427.                 // rewind: true,
  428.                 itemElement: 'figure',
  429.                 autoplay: false,
  430.                 margin:0,
  431.                 nav:true,
  432.                 dots:false,
  433.                 responsive:{
  434.                     0:{
  435.                         items:3
  436.                     },
  437.                     600:{
  438.                         items:3
  439.                     },
  440.                     1920:{
  441.                         items:3
  442.                     }
  443.                 }
  444.             });
  445.             owl.on('changed.owl.carousel', function(event) {
  446.                 var itemsNbr = owl.data()['owl.carousel'].settings.items;
  447.                 var itemsTotal = event.item.count;
  448.                 var itemsIndex = event.item.index;
  449.                 var pagesNbr = itemsTotal - itemsNbr;
  450.                 var horizontalBar = $('.horizontal-bar').outerWidth();
  451.                 var horizontalBarCtrl = $('.horizontal-bar-ctrl').outerWidth();
  452.                 var courseLength = $('.horizontal-bar').outerWidth() - $('.horizontal-bar-ctrl').outerWidth();
  453.                 var left = itemsIndex * 100 / pagesNbr; // percent
  454.                 left = left * courseLength / 100;
  455.                 $('.horizontal-bar-ctrl').css('left', left+'px');
  456.             });
  457.             owl2.on('changed.owl.carousel', function(event) {
  458.                 var itemsNbr = owl2.data()['owl.carousel'].settings.items;
  459.                 var itemsTotal = event.item.count;
  460.                 var itemsIndex = event.item.index;
  461.                 var pagesNbr = itemsTotal - itemsNbr;
  462.                 var horizontalBar = $('.noel .horizontal-bar').outerWidth();
  463.                 var horizontalBarCtrl = $('.noel .horizontal-bar-ctrl').outerWidth();
  464.                 var courseLength = $('.noel .horizontal-bar').outerWidth() - $('.noel .horizontal-bar-ctrl').outerWidth();
  465.                 var left = itemsIndex * 100 / pagesNbr; // percent
  466.                 left = left * courseLength / 100;
  467.                 $('.noel .horizontal-bar-ctrl').css('left', left+'px');
  468.             });
  469.             $('.owl-carousel.images a').each(function(index, value) {
  470.                 img = new Image();
  471.                 size = 0;
  472.                 const ident = $(this).attr('id').toString();
  473.                 img.onload = function() {
  474.                     $('#'+ident).attr('data-size', this.width + 'x' + this.height);
  475.                 }
  476.                 img.src = $(this).attr('source');
  477.             }).promise().done( function(){
  478.                 setTimeout( function(){
  479.                     initPhotoSwipeFromDOM('.my-gallery');
  480.                 }, 1000);
  481.             } );
  482.             $('.owl-carousel.images .owl-stage').addClass('my-gallery');
  483.             $('.owl-carousel.images .owl-stage').attr('itemscope');
  484.             $('.owl-carousel.images .owl-stage').attr('itemtype', 'http://schema.org/ImageGallery');
  485.             $('.owl-carousel.images .owl-item ').attr('itemscope');
  486.             $('.owl-carousel.images .owl-item ').attr('itemprop', 'associatedMedia');
  487.             $('.owl-carousel.images .owl-item ').attr('itemtype', 'http://schema.org/ImageObject');
  488.         });
  489.     </script>
  490.     <script type="text/javascript">
  491.         var initPhotoSwipeFromDOM = function(gallerySelector) {
  492.             // parse slide data (url, title, size ...) from DOM elements
  493.             // (children of gallerySelector)
  494.             var parseThumbnailElements = function(el) {
  495.                 console.log(el.childNodes);
  496.                 var thumbElements = el.childNodes,
  497.                     numNodes = thumbElements.length,
  498.                     items = [
  499.                         // {
  500.                         //   src: 'https://dummyimage.com/1000x1000/ccc/5cac22',
  501.                         //   w: '1024',
  502.                         //   h: '1024'
  503.                         // },
  504.                         // {
  505.                         //   src: 'https://dummyimage.com/1000x1000/5cac22/fff',
  506.                         //   w: '1024',
  507.                         //   h: '1024'
  508.                         // }
  509.                     ],
  510.                     figureEl,
  511.                     linkEl,
  512.                     size,
  513.                     item;
  514.                 for(var i = 0; i < numNodes; i++) {
  515.                     figureEl = thumbElements[i]; // <figure> element
  516.                     // include only element nodes
  517.                     if(figureEl.nodeType !== 1) {
  518.                         continue;
  519.                     }
  520.                     linkEl = figureEl.children[0]; // <a> element
  521.                     size = linkEl.getAttribute('data-size').split('x');
  522.                     // create slide object
  523.                     item = {
  524.                         src: linkEl.getAttribute('href'),
  525.                         w: parseInt(size[0], 10),
  526.                         h: parseInt(size[1], 10)
  527.                     };
  528.                     if(figureEl.children.length > 1) {
  529.                         // <figcaption> content
  530.                         item.title = figureEl.children[1].innerHTML;
  531.                     }
  532.                     if(linkEl.children.length > 0) {
  533.                         // <img> thumbnail element, retrieving thumbnail url
  534.                         item.msrc = linkEl.children[0].getAttribute('src');
  535.                     }
  536.                     item.el = figureEl; // save link to element for getThumbBoundsFn
  537.                     items.push(item);
  538.                 }
  539.                 return items;
  540.             };
  541.             // find nearest parent element
  542.             var closest = function closest(el, fn) {
  543.                 return el && ( fn(el) ? el : closest(el.parentNode, fn) );
  544.             };
  545.             // triggers when user clicks on thumbnail
  546.             var onThumbnailsClick = function(e) {
  547.                 e = e || window.event;
  548.                 e.preventDefault ? e.preventDefault() : e.returnValue = false;
  549.                 var eTarget = e.target || e.srcElement;
  550.                 // find root element of slide
  551.                 var clickedListItem = closest(eTarget, function(el) {
  552.                     return (el.tagName && el.tagName.toUpperCase() === 'FIGURE');
  553.                 });
  554.                 if(!clickedListItem) {
  555.                     return;
  556.                 }
  557.                 // find index of clicked item by looping through all child nodes
  558.                 // alternatively, you may define index via data- attribute
  559.                 var clickedGallery = clickedListItem.parentNode,
  560.                     childNodes = clickedListItem.parentNode.childNodes,
  561.                     numChildNodes = childNodes.length,
  562.                     nodeIndex = 0,
  563.                     index;
  564.                 for (var i = 0; i < numChildNodes; i++) {
  565.                     if(childNodes[i].nodeType !== 1) {
  566.                         continue;
  567.                     }
  568.                     if(childNodes[i] === clickedListItem) {
  569.                         index = nodeIndex;
  570.                         break;
  571.                     }
  572.                     nodeIndex++;
  573.                 }
  574.                 if(index >= 0) {
  575.                     // open PhotoSwipe if valid index found
  576.                     openPhotoSwipe( index, clickedGallery );
  577.                 }
  578.                 return false;
  579.             };
  580.             // parse picture index and gallery index from URL (#&pid=1&gid=2)
  581.             var photoswipeParseHash = function() {
  582.                 var hash = window.location.hash.substring(1),
  583.                     params = {};
  584.                 if(hash.length < 5) {
  585.                     return params;
  586.                 }
  587.                 var vars = hash.split('&');
  588.                 for (var i = 0; i < vars.length; i++) {
  589.                     if(!vars[i]) {
  590.                         continue;
  591.                     }
  592.                     var pair = vars[i].split('=');
  593.                     if(pair.length < 2) {
  594.                         continue;
  595.                     }
  596.                     params[pair[0]] = pair[1];
  597.                 }
  598.                 if(params.gid) {
  599.                     params.gid = parseInt(params.gid, 10);
  600.                 }
  601.                 return params;
  602.             };
  603.             var openPhotoSwipe = function(index, galleryElement, disableAnimation, fromURL) {
  604.                 var pswpElement = document.querySelectorAll('.pswp')[0],
  605.                     gallery,
  606.                     options,
  607.                     items;
  608.                 items = parseThumbnailElements(galleryElement);
  609.                 // define options (if needed)
  610.                 options = {
  611.                     // define gallery index (for URL)
  612.                     galleryUID: galleryElement.getAttribute('data-pswp-uid'),
  613.                     getThumbBoundsFn: function(index) {
  614.                         // See Options -> getThumbBoundsFn section of documentation for more info
  615.                         var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail
  616.                             pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
  617.                             rect = thumbnail.getBoundingClientRect();
  618.                         return {x:rect.left, y:rect.top + pageYScroll, w:rect.width};
  619.                     }
  620.                 };
  621.                 // PhotoSwipe opened from URL
  622.                 if(fromURL) {
  623.                     if(options.galleryPIDs) {
  624.                         // parse real index when custom PIDs are used
  625.                         // http://photoswipe.com/documentation/faq.html#custom-pid-in-url
  626.                         for(var j = 0; j < items.length; j++) {
  627.                             if(items[j].pid == index) {
  628.                                 options.index = j;
  629.                                 break;
  630.                             }
  631.                         }
  632.                     } else {
  633.                         // in URL indexes start from 1
  634.                         options.index = parseInt(index, 10) - 1;
  635.                     }
  636.                 } else {
  637.                     options.index = parseInt(index, 10);
  638.                 }
  639.                 // exit if index not found
  640.                 if( isNaN(options.index) ) {
  641.                     return;
  642.                 }
  643.                 if(disableAnimation) {
  644.                     options.showAnimationDuration = 0;
  645.                 }
  646.                 // Pass data to PhotoSwipe and initialize it
  647.                 gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
  648.                 gallery.init();
  649.             };
  650.             // loop through all gallery elements and bind events
  651.             var galleryElements = document.querySelectorAll( gallerySelector );
  652.             for(var i = 0, l = galleryElements.length; i < l; i++) {
  653.                 galleryElements[i].setAttribute('data-pswp-uid', i+1);
  654.                 galleryElements[i].onclick = onThumbnailsClick;
  655.             }
  656.             // Parse URL and open gallery if it contains #&pid=3&gid=1
  657.             var hashData = photoswipeParseHash();
  658.             if(hashData.pid && hashData.gid) {
  659.                 openPhotoSwipe( hashData.pid ,  galleryElements[ hashData.gid - 1 ], true, true );
  660.             }
  661.         };
  662.     </script>
  663. {% endblock %}