「飲食店検索」の版間の差分
提供: 川西図鑑
その他の操作
編集の要約なし |
編集の要約なし |
||
| 599行目: | 599行目: | ||
document.head.appendChild(canonical); | document.head.appendChild(canonical); | ||
const page = parseInt( | const fullurl = new URL(location.href); | ||
const page = parseInt(fullurl.searchParams.get('page') || '1', 10); | |||
const next = document.querySelector('[data-role="next-page"]'); | const next = document.querySelector('[data-role="next-page"]'); | ||
if (next) { | if (next) { | ||
fullurl.searchParams.set('page', page + 1); | |||
next.href = | next.href = fullurl.toString(); | ||
} | } | ||
| 610行目: | 612行目: | ||
if (prev) { | if (prev) { | ||
if (page > 1) { | if (page > 1) { | ||
fullurl.searchParams.set('page', page - 1); | |||
prev.href = | prev.href = fullurl.toString(); | ||
} | } | ||
} | } | ||
| 691行目: | 693行目: | ||
<html> | <html> | ||
<div class="pagination"> | <div class="pagination"> | ||
<a data-role="prev-page" href="#">← 前へ</a> | |||
<a data-role="next-page" href="#">次へ →</a> | <a data-role="next-page" href="#">次へ →</a> | ||
</div> | </div> | ||
</html> | </html> | ||
__目次非表示__ | __目次非表示__ | ||