FANDOM


  • Okay. So my limited knowledge of JS is not enough to understand what is going on with this script. I am trying to make a script that will auto-advance the pages when viewing a category using category exhibition mode. It seems to work for the most part except that, after advancing the paginator once, it then reloads the page. This doesn't happen when you just click the paginator manually so it must be something with my script. Could someone please educate me as to what I am doing wrong?


    Edit:

    Also, apparently resetting back to the first page isn't working either.

      Loading editor
    • where did you try the script? for me document.querySelector("#mw-pages > .category-gallery-paginator > .wikia-paginator") returns null.

      found the right page. there is something wrong with your "paginator", probably because of lost link to the actual node (on pagination, all nodes are rewritten). working advance function:
      function advance() {
          var next = $('#mw-pages .paginator-page.active').closest('li').next('li').find('.paginator-page');
          if (!next.length) next = $('#mw-pages .paginator-page').first();
          next.click();
      }
        Loading editor
    • Yeah. Sorry about that. As a frequent CC contributor, I should have known better than to not post a link to the page I was using to test it. Either way, thanks so much! You nailed the problem right on the head. I changed the script to always re-find the paginator and now it works perfectly! I knew the list was getting replaced but I didn't stop to think that the entire paginator might be getting replaced. Totally makes sense now that you pointed that out.

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message
Community content is available under CC-BY-SA unless otherwise noted.