X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=app%2FResources%2Fstatic%2Fthemes%2Fmaterial%2Fjs%2Fshortcuts%2Fmain.js;h=41499478cf4288b73716283a77038eb2acab5199;hb=a40029f9d6cf8405b6f3e30c8762a4f50da88db5;hp=ad4ca80ad38962313c654e1aa6dae05db6f213c5;hpb=1f00547836d1e832b31368413dccb32586206321;p=github%2Fwallabag%2Fwallabag.git diff --git a/app/Resources/static/themes/material/js/shortcuts/main.js b/app/Resources/static/themes/material/js/shortcuts/main.js index ad4ca80a..41499478 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) { } $(document).ready(() => { + const cards = $('#content').find('.card'); + const cardNumber = cards.length; let cardIndex = 0; - const cardNumber = $('#content ul.data > li').length; - let card = $('#content ul.data > li')[cardIndex]; + /* If we come from next page */ + if (window.location.hash === '#prev') { + cardIndex = cardNumber - 1; + } + let card = cards[cardIndex]; const pagination = $('.pagination'); /* Show nothing on quickstart */ @@ -18,10 +23,9 @@ $(document).ready(() => { return; } - /* If we come from next page */ - if (window.location.hash === '#prev') { - cardIndex = cardNumber - 1; - card = $('ul.data > li')[cardIndex]; + /* Show nothing on login/register page */ + if ($('#username').length > 0 || $('#fos_user_registration_form_username').length > 0) { + return; } /* Focus current card */ @@ -47,7 +51,7 @@ $(document).ready(() => { if (cardIndex >= 0 && cardIndex < cardNumber - 1) { toggleFocus(card); cardIndex += 1; - card = $('ul.data > li')[cardIndex]; + card = cards[cardIndex]; toggleFocus(card); return; } @@ -61,7 +65,7 @@ $(document).ready(() => { if (cardIndex > 0 && cardIndex < cardNumber) { toggleFocus(card); cardIndex -= 1; - card = $('ul.data > li')[cardIndex]; + card = cards[cardIndex]; toggleFocus(card); return; }