summaryrefslogtreecommitdiffstats
path: root/templates/index.html
blob: c43bf333c2e7e95010e4df25fa547013da29bc55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{% extends "layout.html" %}
{% block body %}
<script type="text/javascript">
//Change active button in navbar

$("document").ready( function(){
  $("li").removeClass("active");
  $("#home").addClass("active");
  
  pages = [];
  i=1;
  $(".image").each( function() {
    pages.push($(this).attr("rel"))
  });


  $(".image").click(function() {
        var image = $(this).attr("rel");
        $('#display').hide();
        $('#display').fadeIn('slow');
        $('#display').attr("src", image);
        i = $(this).data("number");
        console.log(i);
        next_page = pages[i];
        console.log("next: " + next_page)
        if(i >= 2)
        {
          previous_page = pages[i - 2];
          console.log("previous: " + previous_page)
        }
        return false;
  });

  previous_page = "";
  console.log(pages);
  next_page = pages[1];
  $(function() {
      $("#newer").click(function() {
        if(i < pages.length)
        {
          previous_page = pages[i-1];
          $('#display').hide();
          $('#display').fadeIn('slow');
          $('#display').attr("src", next_page);
          
          i++;
          next_page = pages[i];
        }
        return false;
       });
      $("#older").click(function() {
        if(i >= 2)
        { 
          $('#display').hide();
          $('#display').fadeIn('slow');
          $('#display').attr("src", previous_page);
          
            previous_page = pages[i-3];
            next_page = pages[i-1]
            i--;
        }
        return false;
       });
    });
});

</script>

<div class="container ">
  <h2>{{thumbs_info.subject}}, {{thumbs_info.datestring}}</h2>
    <ul class="thumbnails">
        <li class="span10">
          <a href="#"  id="image">
              <img id="display" src="{{ url_for('static', filename=main_page_src) }}" alt="">
          </a>
          <ul class="pager">
            <li class="previous">
              <a href="" id="older">&larr; Older</a>
            </li>
            <li class="next">
              <a href="" id="newer">Newer &rarr;</a>
            </li>
          </ul>
        </li>

        <li class="span2">
          {% for  thumb in thumbs %}
            <a href="#" rel="{{ url_for('static', filename=thumb.href) }}" class="thumbnail image" 
            data-number="{{loop.index}}">
              <img src="{{ url_for('static', filename='mini/' + thumb.src) }}" alt="">
            </a>
          {% endfor %}  
          <ul>
            <h4>Other dates...</h4>
              {% for date in thumbs_info.other_dates %}
                <li><a href="/view/{{thumbs_info.subject}}/{{date }}">{{date }}</a> </li>
              {% endfor %}
          </ul>      
        </li>
        
    </ul>
    

  {% endblock %} 

  <script type="text/javascript">
    $(function() {
      $(".image").click(function() {
        var image = $(this).attr("rel");
        $('#display').hide();
        $('#display').fadeIn('slow');
        $('#display').attr("src", image);
        return false;
       });
    });
  </script>