diff --git a/views/page.ejs b/views/page.ejs index f8f2bf0..b7222a5 100644 --- a/views/page.ejs +++ b/views/page.ejs @@ -5,22 +5,21 @@ <% - let leftCnt = paginate.currPage - 1, rightCnt = paginate.pageCnt - paginate.currPage, omitLeft, omitRight; + let leftCnt = paginate.currPage - 2, rightCnt = paginate.pageCnt - paginate.currPage, omitLeft, omitRight; if (leftCnt + rightCnt > 15) { - if (leftCnt < 7) { + if (leftCnt <= 7) { rightCnt = 14 - leftCnt; omitRight = true; - } else if (rightCnt < 7) { + } else if (rightCnt <= 7) { leftCnt = 14 - rightCnt; omitLeft = true; } else { rightCnt = leftCnt = 7; omitLeft = omitRight = true; } - } - if (omitLeft) { - %> - <%= 1 %> + } >% + <%= 1 %> + <% if (omitLeft) { %>
...
<% } @@ -37,8 +36,8 @@ if (omitRight) { %>
...
- <%= paginate.pageCnt %> <% } %> + <%= paginate.pageCnt %> href="<%= syzoj.utils.makeUrl(req, Object.assign(req.query, { page: paginate.currPage + 1 })) %>" <% } %>id="page_next">