Commits

Anton Afanasyev  committed 80f3be4

fixed "teminated" state for when pref or next dont exist in the SITEINFO

  • Participants
  • Parent commits 80415dd
  • Branches backwards-load

Comments (0)

Files changed (1)

File autopagerize.user.js

 
 var AutoPager = function(info) {
     this.info = info;
+    this.terminatedPagings = { next: false, prev: false };
     this.state = AUTO_START ? 'enable' : 'disable';
     this.shouldLoadAll = false;
     var self = this;
     var url = getNextURL(info.nextLink, document, location.href);
     if (!url) {
         debug("getNextURL(next) returns null.", info.nextLink);
+        this.terminatedPagings.next = true;
     }
     // get prev page url
     var urlPrev = getNextURL(info.prevLink, document, location.href);
     if (!urlPrev) {
         debug("getNextURL(prev) returns null.", info.prevLink);
+        this.terminatedPagings.prev = true;
     }
 
     if( !url && !urlPrev ){
     }
 }
 
-var terminatedPagings = { next: false, prev: false };
 AutoPager.prototype.terminate = function( direction ) {
-    terminatedPagings[direction] = true;
+    this.terminatedPagings[direction] = true;
     var allTerminated = true;
-    for(var key in terminatedPagings) {
-        if (terminatedPagings.hasOwnProperty(key)){
-            if( !terminatedPagings[key] ) {
+    for(var key in this.terminatedPagings) {
+        if (this.terminatedPagings.hasOwnProperty(key)){
+            if( !this.terminatedPagings[key] ) {
                 allTerminated = false;
                 break;
             }