aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/Resources/static/themes/material
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-11-05 16:06:13 +0100
committerThomas Citharel <tcit@tcit.fr>2016-11-15 21:55:16 +0100
commitc930992348d81c70884791ee3edbec4a3cc1d128 (patch)
tree04e5fd150e4ae88c926ee6ac5c93b4d31a6bb149 /app/Resources/static/themes/material
parent5637a26e9af98a05c76823c85611315cd1a986e0 (diff)
downloadwallabag-c930992348d81c70884791ee3edbec4a3cc1d128.tar.gz
wallabag-c930992348d81c70884791ee3edbec4a3cc1d128.tar.zst
wallabag-c930992348d81c70884791ee3edbec4a3cc1d128.zip
fix next/prev page
Diffstat (limited to 'app/Resources/static/themes/material')
-rw-r--r--app/Resources/static/themes/material/js/shortcuts/main.js18
1 files changed, 6 insertions, 12 deletions
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}
9let card;
10let cardIndex;
11let cardNumber;
12let 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