aboutsummaryrefslogtreecommitdiffhomepage
path: root/app
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
parent5637a26e9af98a05c76823c85611315cd1a986e0 (diff)
downloadwallabag-c930992348d81c70884791ee3edbec4a3cc1d128.tar.gz
wallabag-c930992348d81c70884791ee3edbec4a3cc1d128.tar.zst
wallabag-c930992348d81c70884791ee3edbec4a3cc1d128.zip
fix next/prev page
Diffstat (limited to 'app')
-rw-r--r--app/Resources/static/themes/_global/js/shortcuts/main.js1
-rw-r--r--app/Resources/static/themes/material/js/shortcuts/main.js18
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 @@
1import Mousetrap from 'mousetrap'; 1import 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}
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