diff options
Diffstat (limited to 'app/Resources/static')
-rw-r--r-- | app/Resources/static/themes/material/js/shortcuts/main.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/app/Resources/static/themes/material/js/shortcuts/main.js b/app/Resources/static/themes/material/js/shortcuts/main.js index ad4ca80a..0a2d2a69 100644 --- a/app/Resources/static/themes/material/js/shortcuts/main.js +++ b/app/Resources/static/themes/material/js/shortcuts/main.js | |||
@@ -8,9 +8,14 @@ function toggleFocus(cardToToogleFocus) { | |||
8 | } | 8 | } |
9 | 9 | ||
10 | $(document).ready(() => { | 10 | $(document).ready(() => { |
11 | const cards = $('#content').find('.card'); | ||
12 | const cardNumber = cards.length; | ||
11 | let cardIndex = 0; | 13 | let cardIndex = 0; |
12 | const cardNumber = $('#content ul.data > li').length; | 14 | /* If we come from next page */ |
13 | let card = $('#content ul.data > li')[cardIndex]; | 15 | if (window.location.hash === '#prev') { |
16 | cardIndex = cardNumber - 1; | ||
17 | } | ||
18 | let card = cards[cardIndex]; | ||
14 | const pagination = $('.pagination'); | 19 | const pagination = $('.pagination'); |
15 | 20 | ||
16 | /* Show nothing on quickstart */ | 21 | /* Show nothing on quickstart */ |
@@ -18,12 +23,6 @@ $(document).ready(() => { | |||
18 | return; | 23 | return; |
19 | } | 24 | } |
20 | 25 | ||
21 | /* If we come from next page */ | ||
22 | if (window.location.hash === '#prev') { | ||
23 | cardIndex = cardNumber - 1; | ||
24 | card = $('ul.data > li')[cardIndex]; | ||
25 | } | ||
26 | |||
27 | /* Focus current card */ | 26 | /* Focus current card */ |
28 | toggleFocus(card); | 27 | toggleFocus(card); |
29 | 28 | ||
@@ -47,7 +46,7 @@ $(document).ready(() => { | |||
47 | if (cardIndex >= 0 && cardIndex < cardNumber - 1) { | 46 | if (cardIndex >= 0 && cardIndex < cardNumber - 1) { |
48 | toggleFocus(card); | 47 | toggleFocus(card); |
49 | cardIndex += 1; | 48 | cardIndex += 1; |
50 | card = $('ul.data > li')[cardIndex]; | 49 | card = cards[cardIndex]; |
51 | toggleFocus(card); | 50 | toggleFocus(card); |
52 | return; | 51 | return; |
53 | } | 52 | } |
@@ -61,7 +60,7 @@ $(document).ready(() => { | |||
61 | if (cardIndex > 0 && cardIndex < cardNumber) { | 60 | if (cardIndex > 0 && cardIndex < cardNumber) { |
62 | toggleFocus(card); | 61 | toggleFocus(card); |
63 | cardIndex -= 1; | 62 | cardIndex -= 1; |
64 | card = $('ul.data > li')[cardIndex]; | 63 | card = cards[cardIndex]; |
65 | toggleFocus(card); | 64 | toggleFocus(card); |
66 | return; | 65 | return; |
67 | } | 66 | } |