oAutoPagerize
From Opera Wiki
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
- Create a directory for storing User JavaScript files, for instance C:\userjs\
- Go to "Tools -> Preferences -> Advanced -> Content -> JavaScript Options". Add the location of your newly created script directory to My JavaScript files.
- Save files oAutoPagerize.js and 0AutoPagerize.SITEINFO.js into the directory.
- If you want to stop this script, click on the right "on/off" toggle.
[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.
- You can set colors of the little icons, or the icons encoded in base64, and the size of it.
TOP_SITEINFOandBOTTOM_SITEINFOare your custom SITEINFO to be added on top/bottom of the existing SITEINFO.naviTypeis how you want to show the link to the added page. (just number or full url)- When
AUTO_STARTis false, the script starts as "off" state. You will need to turn it on manually on every page. BASE_REMAIN_HEIGHTis how much pixels from the bottom of the page you want to start adding the next page.FORCE_TARGET_WINDOW:trueandTARGET_WINDOW_NAME:'_blank'mean that, on added pages, all the links will open in a new tab. (If you open links in the same tab, then go back to that page, usually all the added pages will be gone. Hence this option.)HISTORY_MODE_FASTis for opera only. When turned on, Opera uses its fast history navigation mode, so that even if a new page open on the same tab, added pages won't be lost.DISABLE_IFRAMEis the setting to not use AutoPagerize in inline-frames.
[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
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.AutoPagerize.addFilteris used to apply filters to the added elements after the elements are inserted.- ex. add favicon to google's search results, etc. (various usage)
window.AutoPagerize.addDocumentFilteris used to apply filters to the next page before it's inserted.- ex. dynamically rewrite siteinfo, etc.
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!)