Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +11 -2
templates/index.html
CHANGED
@@ -36,10 +36,19 @@
|
|
36 |
});
|
37 |
|
38 |
document.getElementById('prevBtn').addEventListener('click', function() {
|
39 |
-
|
|
|
|
|
|
|
|
|
40 |
});
|
|
|
41 |
document.getElementById('nextBtn').addEventListener('click', function() {
|
42 |
-
|
|
|
|
|
|
|
|
|
43 |
});
|
44 |
|
45 |
function navigate(url) {
|
|
|
36 |
});
|
37 |
|
38 |
document.getElementById('prevBtn').addEventListener('click', function() {
|
39 |
+
let newIndex = {{ index }} - 1;
|
40 |
+
if (newIndex < 0) {
|
41 |
+
newIndex = {{ total }} - 1;
|
42 |
+
}
|
43 |
+
navigate('{{ url_for("index") }}?set={{ set_name }}&index=' + newIndex);
|
44 |
});
|
45 |
+
|
46 |
document.getElementById('nextBtn').addEventListener('click', function() {
|
47 |
+
let newIndex = {{ index }} + 1;
|
48 |
+
if (newIndex >= {{ total }}) {
|
49 |
+
newIndex = 0;
|
50 |
+
}
|
51 |
+
navigate('{{ url_for("index") }}?set={{ set_name }}&index=' + newIndex);
|
52 |
});
|
53 |
|
54 |
function navigate(url) {
|