_includes/themes/j1/procedures/global/pager.proc in j1_template-2019.4.7 vs _includes/themes/j1/procedures/global/pager.proc in j1_template-2019.4.8

- old
+ new

@@ -1,26 +1,24 @@ {% comment %} # ----------------------------------------------------------------------------- - # ~/_includes/themes/j1/procedures/global/pager.proc - # HTML/Liquid procedure to create a paginator for pages of type "post" + # ~/_includes/themes/j1/procedures/global/pager.proc + # HTML/Liquid procedure to create a paginator for pages of type "post" # - # Product/Info: - # http://jekyll.one + # Product/Info: + # http://jekyll.one # - # Copyright (C) 2019 Juergen Adams + # Copyright (C) 2019 Juergen Adams # - # J1 Template is licensed under the MIT License. - # See: https://github.com/jekyll-one-org/j1_template/blob/master/LICENSE - # + # J1 Template is licensed under the MIT License. + # See: https://github.com/jekyll-one-org/j1_template/blob/master/LICENSE # ----------------------------------------------------------------------------- - # NOTE: + # NOTE: # This pager reads the "page path" from cookie "cookieUserState". This # data is used to return from a previous (page builder) page. # ----------------------------------------------------------------------------- # Test data: - # liquid_var: {{ liquid_var | debug }} - # + # liquid_var: {{ liquid_var | debug }} # ----------------------------------------------------------------------------- {% endcomment %} {% comment %} Variables @@ -32,50 +30,50 @@ {% comment %} Main -------------------------------------------------------------------------------- {% endcomment %} - <div class="paginator"> - <ul class="pagination raised-z0"> +<div class="paginator"> + <ul class="pagination raised-z0"> - {% comment %} Set PREVIOUS page - -------------------------------------------------------------------------- {% endcomment %} - {% if page.previous %} - <li class="page-item"><a class="page-link" href="{{ base_path }}{{ page.previous.url }}" title="{{ page.previous.title }}">Prev</a></li> - {% else %} - <li class="page-item disabled"><a class="page-link">Prev</a></li> - {% endif %} + {% comment %} Set PREVIOUS page + ---------------------------------------------------------------------------- {% endcomment %} + {% if page.previous %} + <li class="page-item"><a class="page-link" href="{{ base_path }}{{ page.previous.url }}" title="{{ page.previous.title }}">Prev</a></li> + {% else %} + <li class="page-item disabled"><a class="page-link">Prev</a></li> + {% endif %} - {% comment %} Set BACK page (PagerURL) - -------------------------------------------------------------------------- {% endcomment %} - <!-- [INFO ] [j1.posts.pager.proc ] [Manage the current pager settings for: {{ builder_path }}] --> - <script> - var cookie_names = j1.getCookieNames(); - const user_state_cookie_name = cookie_names.user_session; - var user_state = j1.readCookie(user_state_cookie_name); - var re = new RegExp("navigator|dateview|tagview|archive"); - var last_pager = user_state.last_pager; - var last_pager_url; + {% comment %} Set BACK page (PagerURL) + ---------------------------------------------------------------------------- {% endcomment %} + <!-- [INFO ] [procedures.global.pager.proc ] [Manage the current pager settings for: {{ builder_path }}] --> + <script> + var cookie_names = j1.getCookieNames(); + var user_state_cookie_name = cookie_names.user_session; + var user_state = j1.readCookie(user_state_cookie_name); + var re = new RegExp('navigator|dateview|tagview|archive'); + var last_pager = user_state.last_pager; + var last_pager_url; - <!-- [INFO ] [j1.page.{{page.title}} ] [Calculate BackURL from User State Cookie] --> - if (re.test(last_pager)) { - last_pager_url = '<li class="page-item"><a class="page-link" href="' + last_pager + '" title="Back to Top Page">Back</a></li>'; - } else { - last_pager_url = '<li class="page-item disabled"><a class="page-link" title="Back to Top Page">Back</a></li>'; - } - document.write( last_pager_url ); - j1.writeCookie({ - name: user_state_cookie_name, - data: user_state - }); - </script> + <!-- [INFO ] [procedures.global.pager.proc ] [Calculate BackURL from User State Cookie for page: {{page.title}}] --> + if (re.test(last_pager)) { + last_pager_url = '<li class="page-item"><a class="page-link" href="' + last_pager + '" title="Back to Top Page">Back</a></li>'; + } else { + last_pager_url = '<li class="page-item disabled"><a class="page-link" title="Back to Top Page">Back</a></li>'; + } + document.write( last_pager_url ); + j1.writeCookie({ + name: user_state_cookie_name, + data: user_state + }); + </script> - {% comment %} Set NEXT page - -------------------------------------------------------------------------- {% endcomment %} - {% if page.next %} - <li class="page-item"><a class="page-link" href="{{ base_path }}{{ page.next.url }}" title="{{ page.next.title }}">Next</a></li> - {% else %} - <li class="page-item disabled"><a class="page-link" href="#">Next</a></li> - {% endif %} + {% comment %} Set NEXT page + ---------------------------------------------------------------------------- {% endcomment %} + {% if page.next %} + <li class="page-item"><a class="page-link" href="{{ base_path }}{{ page.next.url }}" title="{{ page.next.title }}">Next</a></li> + {% else %} + <li class="page-item disabled"><a class="page-link" href="#">Next</a></li> + {% endif %} - </ul> - </div> + </ul> +</div> \ No newline at end of file