(nextButton: HTMLAnchorElement)
| 11 | const itemsPerNotificationsPage = 25; |
| 12 | |
| 13 | function linkify(nextButton: HTMLAnchorElement): void { |
| 14 | const totalNotificationsNode = $('.js-notifications-list-paginator-counts').lastChild!; |
| 15 | assertNodeContent(totalNotificationsNode, /^of \d+$/); |
| 16 | const totalNotificationsNumber = looseParseInt(totalNotificationsNode); |
| 17 | const lastCursor = Math.floor((totalNotificationsNumber - 1) / itemsPerNotificationsPage) * itemsPerNotificationsPage; |
| 18 | const nextButtonSearch = new URLSearchParams(nextButton.search); |
| 19 | nextButtonSearch.set('after', stringToBase64(`cursor:${lastCursor}`)); |
| 20 | totalNotificationsNode.replaceWith( |
| 21 | ' of ', |
| 22 | <a href={'?' + String(nextButtonSearch)}> |
| 23 | {totalNotificationsNumber} |
| 24 | </a>, |
| 25 | ); |
| 26 | } |
| 27 | |
| 28 | function init(signal: AbortSignal): void { |
| 29 | // When there's no "next page", this element becomes `<button disabled>` |
nothing calls this directly
no test coverage detected