OzoneAsai commited on
Commit
67db981
1 Parent(s): 03e3c38

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +11 -2
templates/index.html CHANGED
@@ -36,10 +36,19 @@
36
  });
37
 
38
  document.getElementById('prevBtn').addEventListener('click', function() {
39
- navigate('{{ url_for("prev_card", set=set_name, index=index) }}');
 
 
 
 
40
  });
 
41
  document.getElementById('nextBtn').addEventListener('click', function() {
42
- navigate('{{ url_for("next_card", set=set_name, index=index) }}');
 
 
 
 
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) {