Like you can see, in {block:PreviousPost} , I fill the {PreviousPost} href. And in {block:NextPost} the {NextPost} href, ok? Supposedly, according documentation, PreviousPost is newer post and NextPost is older post. Aha.
And, like you see, I have previous link with id="prev-post" and next-link with id="next-post". Logical, no? And same for Page Pagination, with -page suffix. Note: you can get confused because in previous block I use right arrow and next class and in next block I used left arrow and prev class, for align the link icon arrows in the opposite site. The reason of this is explained after the next code.
Well, here is someone that can explain WHY this next funtions ONLY work well this way:
function goToPrev() {
{block:Pagination}{block:PreviousPage}
$('#prev-page').trigger('click');
{/block:PreviousPage}{/block:Pagination}
{block:PermalinkPagination}{block:NextPost}
$('#next-post').trigger('click');
{/block:NextPost}{/block:PermalinkPagination}
};
function goToNext() {
{block:Pagination}{block:NextPage}
$('#next-page').trigger('click');
{/block:NextPage}{/block:Pagination}
{block:PermalinkPagination}{block:PreviousPost}
$('#prev-post').trigger('click');
{/block:PreviousPost}{/block:PermalinkPagination}
};
Because this IS CRAZY. Like you can see in this functions, Pagination of pages works like it should work: if I trigger the link of previous page in the block of previous page, it surprisingly fires the previous page link. And the same happens for the next page link. And we're in the first page and there is only next-pages (because we are in the newest one), it shows the previous block only. Good.
But when we are in permalink pages and we are in the most newest post, and there should be only the NextPost block... Guess what. Yeah! The only block showing is the PreviousPost block. Tadah! ¬___¬ So I have to implement this last 2 functions for goToPrev and goToNext with the part about permalink pagination CHANGED their logical order (this functions are fired by hotkeys: when the user pushes → goToNext is fired and when he pushes ← goToPrev is fired).
I revised the code again and again and again and AGAIN, and it makes me crazy, till I got this. Anyone can explain me this nonsense?