diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Resources/static/themes/_global/js/shortcuts/main.js | 1 | ||||
-rw-r--r-- | app/Resources/static/themes/material/js/shortcuts/main.js | 18 |
2 files changed, 6 insertions, 13 deletions
diff --git a/app/Resources/static/themes/_global/js/shortcuts/main.js b/app/Resources/static/themes/_global/js/shortcuts/main.js index 1f2c1c52..ef6a1b84 100644 --- a/app/Resources/static/themes/_global/js/shortcuts/main.js +++ b/app/Resources/static/themes/_global/js/shortcuts/main.js | |||
@@ -1,6 +1,5 @@ | |||
1 | import Mousetrap from 'mousetrap'; | 1 | import Mousetrap from 'mousetrap'; |
2 | 2 | ||
3 | |||
4 | /** Shortcuts **/ | 3 | /** Shortcuts **/ |
5 | 4 | ||
6 | /* Go to */ | 5 | /* Go to */ |
diff --git a/app/Resources/static/themes/material/js/shortcuts/main.js b/app/Resources/static/themes/material/js/shortcuts/main.js index 62b7ec64..ba396841 100644 --- a/app/Resources/static/themes/material/js/shortcuts/main.js +++ b/app/Resources/static/themes/material/js/shortcuts/main.js | |||
@@ -6,16 +6,12 @@ function toggleFocus(cardToToogleFocus) { | |||
6 | $(cardToToogleFocus).toggleClass('z-depth-4'); | 6 | $(cardToToogleFocus).toggleClass('z-depth-4'); |
7 | } | 7 | } |
8 | } | 8 | } |
9 | let card; | ||
10 | let cardIndex; | ||
11 | let cardNumber; | ||
12 | let pagination; | ||
13 | 9 | ||
14 | $(document).ready(() => { | 10 | $(document).ready(() => { |
15 | cardIndex = 0; | 11 | let cardIndex = 0; |
16 | cardNumber = $('#content ul.data > li').length; | 12 | const cardNumber = $('#content ul.data > li').length; |
17 | card = $('#content ul.data > li')[cardIndex]; | 13 | let card = $('#content ul.data > li')[cardIndex]; |
18 | pagination = $('.pagination'); | 14 | const pagination = $('.pagination'); |
19 | 15 | ||
20 | /* If we come from next page */ | 16 | /* If we come from next page */ |
21 | if (window.location.hash === '#prev') { | 17 | if (window.location.hash === '#prev') { |
@@ -44,9 +40,8 @@ $(document).ready(() => { | |||
44 | toggleFocus(card); | 40 | toggleFocus(card); |
45 | return; | 41 | return; |
46 | } | 42 | } |
47 | if (pagination != null && pagination.find('li.next') && cardIndex === cardNumber - 1) { | 43 | if (pagination.length > 0 && pagination.find('li.next:not(.disabled)').length > 0 && cardIndex === cardNumber - 1) { |
48 | window.location.href = window.location.origin + $(pagination).find('li.next a').attr('href'); | 44 | window.location.href = window.location.origin + $(pagination).find('li.next a').attr('href'); |
49 | return; | ||
50 | } | 45 | } |
51 | }); | 46 | }); |
52 | 47 | ||
@@ -59,9 +54,8 @@ $(document).ready(() => { | |||
59 | toggleFocus(card); | 54 | toggleFocus(card); |
60 | return; | 55 | return; |
61 | } | 56 | } |
62 | if (pagination !== null && $(pagination).find('li.prev') && cardIndex === 0) { | 57 | if (pagination.length > 0 && $(pagination).find('li.prev:not(.disabled)').length > 0 && cardIndex === 0) { |
63 | window.location.href = `${window.location.origin + $(pagination).find('li.prev a').attr('href')}#prev`; | 58 | window.location.href = `${window.location.origin + $(pagination).find('li.prev a').attr('href')}#prev`; |
64 | return; | ||
65 | } | 59 | } |
66 | }); | 60 | }); |
67 | 61 | ||