-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
195 lines (162 loc) · 5.75 KB
/
index.html
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Photos</title>
<link href="../vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<style>
body {
padding-top: 10px;
background-color: #eee;
margin-bottom: 60px;
}
.drop-shadow {
box-shadow: 7px 7px 20px #999;
}
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
}
.container .text-muted {
margin: 20px 0;
text-align: center;
}
/*
.carousel-inner {
height: 650px;
}
.carousel-inner .item {
overflow: auto;
max-width: 100%;
max-height: 100%;
}
.carousel-inner .item img {
width: 100%;
min-height: 100%;
max-height: 100%;
}
*/
.carousel-inner .item img {
width: 100%;
}
.carousel-inner .item::-webkit-scrollbar {
display: none;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="text-center">
<a href="/index.html" class="btn btn-default" role="button">HOME</a>
<div class="btn-group" data-toggle="buttons">
<label id="rst-button" class="btn btn-default center-block">Reset</label>
<label id="recall-button" class="btn btn-default center-block">Recall</label>
<label id="rand-button" class="btn btn-default center-block">Random</label>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12">
<div id="myCarousel" class="carousel slide drop-shadow" data-ride="carousel">
<div class="carousel-inner">
<div class="item active"> </div>
<div class="item" > </div>
</div>
<!-- Left and right controls -->
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
</div>
</div>
</div>
</div><!-- /.container -->
<br/>
<br/>
<footer class="footer">
<div class="container">
<p class="text-muted">Copyright 2017</p>
</div>
</footer>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../vendor/jquery/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../vendor/jquery/jquery.min.js"><\/script>')</script>
<script src="../vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="purls.js"></script>
<script>
var ptr = 0;
var last_ptr = ptr;
var max = purls.length;
var next_url = purls[ptr];
var seconds = 10;
function update_ptr(v) {
last_ptr = ptr;
// Roll around if needed
v = (v >= 0) ? v : (max + (v % max));
ptr = Math.abs(v)%max;
}
//===========================================================
// Carousel Transition Handler
//
$('#myCarousel').bind('slide.bs.carousel', function (ev) {
var target = $(ev.relatedTarget);
// TODO:This is inverted (left<->right) because for some reason
// actions are inverted in the UI.
if ( ev.direction == "left" ) {
update_ptr(ptr+1);
} else {
update_ptr( ptr-1 );
}
var url = purls[ptr];
target.html('<img src="'+url+'"/>');
console.log("idx: " + ptr );
});
//===========================================================
// Button Handlers
//
function set_active_photo(v) {
update_ptr(v);
var url = purls[ptr];
$('.item.active').html('<img src="'+url+'"/>');
console.log("idx: " + v );
}
$('#rand-button').on('click', function(e) {
set_active_photo( Math.floor((Math.random()*max)+1) );
});
$('#recall-button').on('click', function(e) {
set_active_photo(last_ptr);
});
$('#rst-button').on('click', function(e) {
set_active_photo(0);
});
//===========================================================
// Initialization
//
$('.item.active').append("<img src=\""+purls[ptr]+"\"/>");
$('#myCarousel').carousel({
interval: seconds * 1000
});
</script>
</body>
</html>