public
Description: a userscript for auto loading paginated web pages
Homepage: http://userscripts.org/scripts/show/8551
Clone URL: git://github.com/swdyh/autopagerize.git
Click here to lend your support to: autopagerize and make a donation at www.pledgie.com !
 * sort by url length
swdyh (author)
Sat Jun 28 05:51:53 -0700 2008
commit  ba8cc73ca233b3f6bec0c57df24d0cc4a9643852
tree    b2e97c6a87ab980e51e503b55f98050d100c6f88
parent  44d727a34e316a308a7c07cc6bba466a58adddae
...
212
213
214
215
216
217
 
 
 
218
219
220
...
242
243
244
245
246
247
 
 
 
248
249
250
...
355
356
357
358
359
360
361
362
363
364
 
 
 
 
 
 
 
365
366
367
...
548
549
550
 
 
 
 
 
 
551
552
553
...
212
213
214
 
 
 
215
216
217
218
219
220
...
242
243
244
 
 
 
245
246
247
248
249
250
...
355
356
357
 
 
 
 
 
 
 
358
359
360
361
362
363
364
365
366
367
...
548
549
550
551
552
553
554
555
556
557
558
559
0
@@ -212,9 +212,9 @@ AutoPager.prototype.request = function() {
0
         return
0
     }
0
 
0
- if ( !this.canHandleCrossDomainRequest() ) {
0
- return
0
- }
0
+ if ( !this.canHandleCrossDomainRequest() ) {
0
+ return
0
+ }
0
 
0
     this.lastRequestURL = this.requestURL
0
     var self = this
0
@@ -242,9 +242,9 @@ AutoPager.prototype.showLoading = function(sw) {
0
 }
0
 
0
 AutoPager.prototype.requestLoad = function(res) {
0
- if ( !this.canHandleCrossDomainRequest() ) {
0
- return
0
- }
0
+ if ( !this.canHandleCrossDomainRequest() ) {
0
+ return
0
+ }
0
 
0
     var t = res.responseText
0
     var htmlDoc = createHTMLDocumentByString(t)
0
@@ -355,13 +355,13 @@ AutoPager.prototype.getNextURL = function(xpath, doc) {
0
 }
0
 
0
 AutoPager.prototype.canHandleCrossDomainRequest = function(url) {
0
- if ( !supportsFinalUrl() ) {
0
- if (!isSameDomain(this.requestURL)) {
0
- this.error()
0
- return false
0
- }
0
- }
0
- return true
0
+ if ( !supportsFinalUrl() ) {
0
+ if (!isSameDomain(this.requestURL)) {
0
+ this.error()
0
+ return false
0
+ }
0
+ }
0
+ return true
0
 }
0
 
0
 AutoPager.prototype.terminate = function() {
0
@@ -548,6 +548,12 @@ var parseInfo = function(str) {
0
     return isValid(info) ? info : null
0
 }
0
 var launchAutoPager = function(list) {
0
+ if (list.length == 0) {
0
+ return
0
+ }
0
+ list = list.filter(function(i) { return ('url' in i) })
0
+ list.sort(function(a, b) { return (b.url.length - a.url.length) })
0
+
0
     for (var i = 0; i < list.length; i++) {
0
         try {
0
             if (ap) {

Comments

    No one has commented yet.