<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>{{ album.title|striptags }}</title>
    <meta name="description" content="">
    <meta name="author" content="{{ author }}">
    <meta name="viewport" content="width=device-width">

    <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Molengo">
    <link rel="stylesheet" href="{{ theme.url }}/classic/galleria.classic.css">
    <link rel="stylesheet" href="{{ theme.url }}/css/style.min.css">
    <!--[if lt IE 9]>
        <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
  </head>
  <body>
    <div class="container">
      <header>
        <h1><a href="{{ album.index_url }}">{{ index_title }}</a></h1>

        {% if settings.links %}
        <nav id="menu">
          <ul>
            {% for title, link in settings.links %}
            <li><a href="{{ link }}">{{ title }}</a></li>
            {% endfor %}
          </ul>
        </nav>
        {% endif %}

        {% if album.breadcrumb %}
        <h2>
          {%- for url, title in album.breadcrumb -%}
          <a href="{{ url }}">{{ title }}</a>
          {%- if not loop.last %} » {% endif -%}
          {% endfor -%}
        </h2>
        <hr>
        {% endif %}
      </header>

      <div id="main" role="main">
        {% if album.albums %}
        <div id="albums">
          <!-- <h1>Albums</h1> -->
          <ul>
            {% for alb in album.albums %}
            <li><a href="{{ alb.url }}">
              <img src="{{ alb.thumbnail }}" class="album_thumb" alt="{{ alb.name }}" title="{{ alb.name }}" /></a>
              <span class="album_title">{{ alb.title }}</span>
            </li>
            {% endfor %}
          </ul>
        </div>
        {% endif %}

        {% if album.medias %}
          {% macro img_description(media) -%}
            {%- if media.big %}<a href='{{ media.big }}'>Full size</a>{% endif %}
            {% if media.description %}<br>{{ media.description }}{% endif %}

            {%- if media.exif %}
              <br>
              {% if media.exif.iso %}ISO: {{ media.exif.iso }}, {% endif %}
              {% if media.exif.focal %}Focal: {{ media.exif.focal }}, {% endif %}
              {% if media.exif.exposure %}Exposure: {{ media.exif.exposure }}, {% endif %}
              {% if media.exif.fstop %}Fstop: {{ media.exif.fstop }}{% endif %}
              {% if media.exif.datetime %}
                <br>Date: {{ media.exif.datetime }}
              {% endif %}
            {% endif %}
          {%- endmacro %}
        <div id="gallery">
          {% for media in album.medias %}
            {% if media.type == "image" %}
              <a href="{{ media.filename }}">
                <img src="{{ media.thumbnail }}" alt="{{ media.filename }}"
                    data-title="{{ media.title if media.title else media.filename }}"
                    data-description="{{ img_description(media) }}"/>
              </a>
            {% endif %}
            {% if media.type == "video" %}
              <a href="{{ theme.url }}/img/empty.png">
                <img src="{{ media.thumbnail }}" alt="{{ media.filename }}"
                    data-title="{{ media.title if media.title else media.filename }}"
                    data-description="{{ img_description(media) }}"
                    data-layer="<video controls>
                                  <source src='{{ media.filename }}' type='video/webm' />
                                </video>" />
              </a>
            {% endif %}
          {% endfor %}
        </div>
        {% endif %}

        {% if album.zip %}
        <div id="additionnal-infos" class="row">
          <p>
            <a href="{{ album.zip }}"
               title="Download a zip archive with all images">Download ZIP</a>
          </p>
        </div>
        {% endif %}

        {% if album.description %}
        <div id="description">
          {{ album.description }}
        </div>
        {% endif %}
      </div>

      <footer>
        <p>{% if author %}&copy; {{ author }} - {% endif %}
          Generated by <a href="{{ sigal_link }}">sigal</a></p>
      </footer>
    </div>

    {% if album.medias %}
    <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
    <script>!window.jQuery && document.write(unescape('%3Cscript src="{{ theme.url }}/js/jquery-1.11.1.min.js"%3E%3C/script%3E'))</script>
    <script src="{{ theme.url }}/js/galleria-1.4.2.min.js"></script>
    <script src="{{ theme.url }}/js/galleria.classic.min.js"></script>
    <script src="{{ theme.url }}/js/galleria.history.min.js"></script>
    <script>
    Galleria.configure({
        imageCrop: false,
        transition: "fade"
    });
    Galleria.run("#gallery");

    Galleria.ready(function() {
        this.attachKeyboard({
            right: this.next,
            left: this.prev
         });
     });

    </script>
    {% endif %}
    {% include 'analytics.html' %}
  </body>
</html>
