Skip to content

wantora/weautopagerize

Repository files navigation

weAutoPagerize

Automatically inserts the next page.

AutoPagerize API Reference

SITEINFO

[
  {
    url: string(regexp),
    nextLink: string(xpath),
    pageElement: string(xpath),
    insertBefore: string(xpath) | null
  },

  // sample
  {
    url: '^https://blog\\.mozilla\\.org/futurereleases/(page/\\d+/)?$',
    nextLink: '//li[@class="prev"]//a',
    pageElement: '//article',
    insertBefore: '//nav[@class="nav-paging"]',
    exampleUrl: 'https://blog.mozilla.org/futurereleases/',
  },
]

HTML Classes

autopagerize_page_element

autopagerize_insert_before

autopagerize_page_separator, autopagerize_page_info, autopagerize_link

<hr class="autopagerize_page_separator">
<p class="autopagerize_page_info">
  page: <a class="autopagerize_link" href="http://www.example.com/?page=2">2</a>
</p>

Events

GM_AutoPagerizeLoaded

GM_AutoPagerizeNextPageLoaded

AutoPagerize_DOMNodeInserted

document.addEventListener("AutoPagerize_DOMNodeInserted", function(event) {
  console.log("pageElement: ", event.target);
  console.log("parentNode: ", event.relatedNode);
  console.log("url: ", event.newValue);
}, false);

AutoPagerizeToggleRequest, AutoPagerizeEnableRequest, AutoPagerizeDisableRequest

document.dispatchEvent(new Event("AutoPagerizeToggleRequest"));

AutoPagerize_launchAutoPager

document.dispatchEvent(new CustomEvent("AutoPagerize_launchAutoPager", {detail: {
  siteinfo: [
    {
      url: '^https://blog\\.mozilla\\.org/futurereleases/(page/\\d+/)?$',
      nextLink: '//li[@class="prev"]//a',
      pageElement: '//article',
      insertBefore: '//nav[@class="nav-paging"]',
    },
  ],
}}));

AutoPagerizeResponseFilterRequest, AutoPagerizeResponseFilterResponse

See src/userscript/naver-matome.js.

AutoPagerizeUserFetchRequest, AutoPagerizeUserFetchResponse

See src/userscript/pixiv.js.

Compatibility table

Name weAutoPagerize AutoPagerize (userscript) AutoPagerize uAutoPagerize
HTML Classes
SITEINFO
SITEINFO options.useUserFetch
SITEINFO options.useResponseFilter
GM_AutoPagerizeLoaded
GM_AutoPagerizeNextPageLoaded
AutoPagerize_DOMNodeInserted
AutoPagerizeToggleRequest
AutoPagerizeEnableRequest
AutoPagerizeDisableRequest
AutoPagerize_launchAutoPager
AutoPagerizeResponseFilterRequest
AutoPagerizeResponseFilterResponse
AutoPagerizeUserFetchRequest
AutoPagerizeUserFetchResponse
AutoPagerizeUpdateIconRequest
AutoPagerizeUpdateSettingsRequest
uAutoPagerize_Launched
uAutoPagerize_StateChange
uAutoPagerize_Destroy
uAutoPagerize_RequestLoad
uAutoPagerize_RequestError
uAutoPagerize_Request
uAutoPagerize_Restart

Build instructions

git clone https://github.com/wantora/weautopagerize.git
cd weautopagerize
npm install
npm run build

Contributors