diff options
-rw-r--r-- | index.html | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/index.html b/index.html index 0c2330e..aaec710 100644 --- a/index.html +++ b/index.html @@ -23,6 +23,15 @@ title: 首页 - 我的文章 {% endfor %} </table> {% if paginator.total_pages > 1 %} +<script> + function switchPage(sobj){ + if (sobj.value == 1){ + window.location = "{{ '/index.html' | prepend: site.baseurl | replace: '//', '/' }}"; + } else { + window.location = "{{ '/page' | prepend: site.baseurl | replace: '//', '/' }}" + sobj.value + "/"; + } + } +</script> <div class="pagination"> {% if paginator.previous_page %} {% if paginator.previous_page == 1 %} @@ -34,15 +43,15 @@ title: 首页 - 我的文章 <span>« Prev</span> {% endif %} +<select onchange="switchPage(this)"> {% for page in (1..paginator.total_pages) %} {% if page == paginator.page %} - <em>{{ page }}</em> - {% elsif page == 1 %} - <a href="{{ '/index.html' | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a> + <option value="{{ page }}" selected>{{ page }}</option> {% else %} - <a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}/">{{ page }}</a> + <option value="{{ page }}">{{ page }}</option> {% endif %} {% endfor %} +</select> {% if paginator.next_page %} <a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}/">Next »</a> |