Greasy Fork is available in English.
Client side customized pagination for Brazen user scripts framework
Skrip ini tidak untuk dipasang secara langsung. Ini adalah pustaka skrip lain untuk disertakan dengan direktif meta // @require https://update.greasyfork.org/scripts/424499/1847309/Brazen%20Framework%20-%20Paginator.js
Optional. After filtering, if too few compliant tiles remain, fetch and append subsequent search pages until a limit or the last page.
Greasy Fork: Paginator · Requires: Utilities · @require before Framework core
Classic paginated search UIs where client-side filters hide most tiles. Not a substitute for infinite-scroll-only sites (though observer-based compliance still applies).
this._setupPaginator(
() => IS_SEARCH_PAGE, // enableCondition
{
itemListSelector: '#video-list',
paginationWrapper: '.pagination',
lastPageUrl: 'https://example.com/search?page=99',
onGetPageNoFromUrl: (pageUrl, paginator) => /* parse int */,
onGetPageUrlFromPageNo: (pageNo, paginator) => /* build url */,
onGetPaginationElementForPageNo: (pageNo, paginator) => /* jQuery link */,
},
)
_setupPaginator also registers Configuration Manager fields:
| Constant | Display name | Range | Role |
|---|---|---|---|
CONFIG_PAGINATOR_THRESHOLD |
Pagination Threshold | 1–1000 | Minimum compliant items before stopping |
CONFIG_PAGINATOR_LIMIT |
Pagination Limit | 1–50 | Max additional pages to merge beyond current |
configuration.itemSelectors is set from framework itemSelectors automatically.
PaginatorConfiguration)| Key | Required | Role |
|---|---|---|
itemListSelector |
yes | Container selector for .load() and tile insertion |
paginationWrapper |
yes | Site pagination root (length check gates run) |
lastPageUrl |
yes | URL of final page — used to compute _lastPageNo |
onGetPageNoFromUrl |
yes | (pageUrl, paginator) => number |
onGetPageUrlFromPageNo |
yes | (pageNo, paginator) => string |
onGetPaginationElementForPageNo |
yes | (pageNo, paginator) => JQuery |
itemSelectors |
set by framework | Tile selector; defaults to app itemSelectors |
| Method | Role |
|---|---|
initialize() |
Parse current/last page from URLs; create #brazen-paginator-sandbox; cache _targetElement |
run(threshold, limit) |
Entry point — may fetch next page |
onAfterPagination(handler) |
(paginator) => void after UI conform step |
getCurrentPageNo() |
Current page from location |
getLastPageNo() |
From lastPageUrl |
getPaginatedPageNo() |
Highest page merged so far |
getItemListSelector() |
Config selector |
getPaginationWrapper() |
Config wrapper |
getPageNoFromUrl(url) |
Delegates to callback |
getPageUrlFromPageNo(n) |
Delegates to callback |
getPaginationElementForPageNo(n) |
Delegates to callback |
run(threshold, limit) executes only when paginationWrapper.length and threshold are truthy.
Loop condition (all must hold):
_paginatedPageNo < _lastPageNolimit > 0 and (_paginatedPageNo - _currentPageNo) < limit< threshold (tiles without .brazen-noncompliant-item)When true:
_paginatedPageNo.load(nextUrl + ' ' + itemListSelector)itemSelectors after last compliant tile in list_pageConcatenated = trueWhen false: _conformUIToNewPaginatedState() updates pagination links (merged range label start-end, prune superseded links).
Framework integration:
initialize() during init() if paginator configured.run(threshold, limit) after each compliance pass and when new nodes observed on paginated list.CLASS_NON_COMPLIANT_ITEM from Framework core for compliant count.After concatenation, current page link text becomes {currentPageNo}-{paginatedPageNo}. Subsequent page links are removed or retargeted depending on whether the merged range ends at the last page.
Auto next page: navigate when all items on a page are filtered — implement in _onAfterComplianceRun using site next-link (independent of this module).