oAutoPagerize

From Opera Wiki

Jump to:navigation, search

oAutoPagerize is a User javaScript which automatically loads the next page and inserts into current page when you reach the end of the page.
Opera comes with FastForward which lets you quickly access the next page in a series of pages, but this UserJS lets you not only quickly but stresslessly access by only scrolling.


Contents

[edit] How to Use / Install

Before User JavaScript can run in Opera, you must enable the feature by pointing Opera to your User JavaScript directory

  1. Create a directory for storing User JavaScript files, for instance C:\userjs\
  2. Go to "Tools -> Preferences -> Advanced -> Content -> JavaScript Options". Add the location of your newly created script directory to My JavaScript files.
  3. Save files oAutoPagerize.js and 0AutoPagerize.SITEINFO.js into the directory.


Running successfully
Inserting into current page


[edit] FAQ

[edit] Is it for Opera only?

No. This UserJS also works for Safari with GreaseKit and for Google Chrome. It is currently well maintained to be compatible with the latest versions of these browsers.

oAutoPagerize is an adaptation of Firefox's Greasemonkey script AutoPagerize to Opera and other browsers. Also Firefox's add-on AutoPager exists.


[edit] What is 0AutoPagerize.Settings.js?

On top of the main script, there is 0AutoPagerize.Settings.js with which you can customize and save your settings even when you update the main script.


[edit] What is SITEINFO?

The 0AutoPagerize.SITEINFO.js file contains the information about structures of numerous websites such as Google, digg.com, etc. The data are organized at Wedata.net, a wiki-based data hosting site. Because the script was developed in Japan, the SITEINFO currently covers mainly Japanese websites.

If you want to add a site to the SITEINFO, I recomend you first test it by directly writing into 0AutoPagerize.SITEINFO.js or oAutoPagerize.Settings.js. The data is in JSON style, for example, the google search result page's is

 {
    "pageElement": "id(\"res\")\/div[ol or div]",
    "url": "^http:\/\/[^.]+\\.google\\.(?:[^.]+\\.)?[^.\/]+\/(?:search|custom|cse)",
    "nextLink": "id(\"nav\")\/\/td[last()]\/a | id(\"nn\")\/parent::a",
 },

url is an RegExp of a page to be autopagerized, pageElement is an XPath of the element of the next page to be added, and nextLink is an XPath of an anchor or link element to identify as the next page. These are the mandatory keys.

There are also optional keys, insertBefore and exampleUrl. insertBefore is there for historical reasons, and AutoPagerize scripts don't require it any more. exampleUrl is only good for people who want to test if the SITEINFO is valid. See more details here.

It you want to share your SITEINFO with other people, you can go to wedata.net and edit there directly

AutoPagerize front page on wedata.net
AutoPagerize editing page on wedata.net

0AutoPagerize.SITEINFO.js updates from wedata every two hours. You can download the latest SITEINFO file by hovering cursor onto the AutoPagerize icon and click "UPDATE SITEINFO".

(0AutoPagerize.SITEINFO.js is slightly different style to wedata's JSONP, but wedata's JSONP file can also be used by oAutoPagerize)

[edit] How to write User Scripts compatible with AutoPagerize?

For JavaScript Geeks only!!

If you want your scripts to work in the added pages, it's best to use AutoPagerize's filter APIs.

 window.addEventListener( 'load', function(){
   AutoPagerize.addFilter(function (elements) {
     elements.forEach(function(elem){
       /* filter */
     });
   });
   AutoPagerize.addDocumentFilter(function(doc, url, siteinfo) {
     /* filter */
   });
 },false);

The script also fires GM_AutoPagerizeNextPageLoaded event after the page is loaded. It make it easy to write a script to run after the next page is added.

[edit] Author

oAutoPagerize (Opera, Safari, Chrome version) was written by os0x. AutoPagerize (Greasemonkey version) was written by swydh. (Thank you for the wonderful scripts!)

Navigation
Toolbox
In other languages
Google AdSense