Results 1 to 10 of 10
  1. #1
    Network Hub bonuswavepilot's Avatar
    Join Date
    Jun 2011
    Location
    Melbourne, Australia
    Posts
    175

    A pagination removal greasemonkey script

    Hey RPSers.

    I have hacked together a simple greasemonkey script to convert paginated articles into one long one instead. I call it "Don't Page Me, Bro!".

    Note that since the secondary pages are actually on separate web pages, it will take a few seconds to go fetch the other content.

    I have only tested it with a couple of such articles, so if you run into problems, let me know and I'll try to bug-fix.

    It should remove extraneous bylines and sharing buttons from the content that gets grabbed from other pages, though it will not try to remove 'continued on page x' type text.

    It may be found here.

    Technical info
    The script first harvests page links from the buttons in the 'pagination' div at the bottom of the first page of content. It will then grab the contents of those pages via AJAX calls, and append the contents of each 'entry' div to the bottom of this page's 'entry' div.

    Once this is done for all pages, it will run through and hide the pagination divs, any byline divs other than the first, and any social button divs other than the first and last.

    Notes:
    - Replying to an article will work, but when it reloads the page you will not end up looking at your own comment. (This is because while the site will initially load with your new comment in view, adding the extra page content will push it off screen again)
    Last edited by bonuswavepilot; 30-04-2015 at 06:08 AM.

  2. #2
    Secondary Hivemind Nexus somini's Avatar
    Join Date
    Jun 2011
    Location
    NEuro Troika Franchulate #3
    Posts
    5,070
    Thanks!

    Is there any alternative to that awesome Firefox plugin called AutoPager? It has fallen into disrepair, the newer versions just broke most of the stuff, but that was a generic version of this kind of thing.
    Steam(shots), Imgur, Flickr, Bak'laag, why do you forsake me?

  3. #3
    Network Hub bonuswavepilot's Avatar
    Join Date
    Jun 2011
    Location
    Melbourne, Australia
    Posts
    175
    Can't say I'm familiar with that plugin...

    Would seem tricky to make such a thing generic, given how many different ways paging could be implemented - although I suppose you could at least account for popular frameworks or libraries. Bit outside my bailiwick anyway I'm afraid - greasemonkey scripts just require some javascript, Firefox plugins would require a bit more research.

  4. #4
    Secondary Hivemind Nexus somini's Avatar
    Join Date
    Jun 2011
    Location
    NEuro Troika Franchulate #3
    Posts
    5,070
    Quote Originally Posted by bonuswavepilot View Post
    greasemonkey scripts just require some javascript, Firefox plugins would require a bit more research.
    The newer API are basically JS that runs with elevated privileges. There's something called Jetpack or something.
    Anyway, that's just wishful thinking.
    Steam(shots), Imgur, Flickr, Bak'laag, why do you forsake me?

  5. #5
    There are times that a firefox will suddenly crashed. Do you have any idea with this?

  6. #6
    Network Hub bonuswavepilot's Avatar
    Join Date
    Jun 2011
    Location
    Melbourne, Australia
    Posts
    175
    Erm I don't think this script is likely to cause crashes - it might use up a bit of memory on one of those articles with lots of pages, but only as much as having a few pages open in tabs; shouldn't be enough to be crashing anything. I suppose it's possible that there is a problem with the greasemonkey plugin itself?

  7. #7
    May I know what is greasemmonkey plugin?

  8. #8
    Secondary Hivemind Nexus somini's Avatar
    Join Date
    Jun 2011
    Location
    NEuro Troika Franchulate #3
    Posts
    5,070
    Quote Originally Posted by Gleedaniel13 View Post
    May I know what is greasemmonkey plugin?
    Firefox:
    https://addons.mozilla.org/en-US/fir...ey/?src=search
    Chrome/nu-Opera/General Webkit nonsense:
    https://tampermonkey.net/

    Just remeber, with great power comes great responsibility, don't go installing random scripts from any site.
    Try
    https://greasyfork.org/en
    for a repository, but you should read the code (if you can) to see if it's not doing somehting evil.
    Steam(shots), Imgur, Flickr, Bak'laag, why do you forsake me?

  9. #9
    Network Hub bonuswavepilot's Avatar
    Join Date
    Jun 2011
    Location
    Melbourne, Australia
    Posts
    175
    Yeah, those links should tell you everything you need to know. If you're allergic to reading anything but forum posts for some reason, the TL;DR is that greasemonkey allows you to install page-specific bits of javascript which will run after that page is loaded.

    In the case of this script, I have described in the OP what the code does, but as somini suggests, it is always a good idea to read through it if you can. (Some effort has been put into trying to make greasemonkey secure by sandboxing etc, but there is always another bug to be exploited.)

  10. #10
    Secondary Hivemind Nexus somini's Avatar
    Join Date
    Jun 2011
    Location
    NEuro Troika Franchulate #3
    Posts
    5,070
    Quote Originally Posted by bonuswavepilot View Post
    Yeah, those links should tell you everything you need to know. If you're allergic to reading anything but forum posts for some reason, the TL;DR is that greasemonkey allows you to install page-specific bits of javascript which will run after that page is loaded.

    In the case of this script, I have described in the OP what the code does, but as somini suggests, it is always a good idea to read through it if you can. (Some effort has been put into trying to make greasemonkey secure by sandboxing etc, but there is always another bug to be exploited.)
    The biggest red flags you can check for are in the header.
    The "@include" and "@exclude" lines tell you in what pages the script will run, if you spot stuff like "@include *" or unrelated URL you should dig deeper.
    The "@grant" lines let the script do more powerful things, which might lead to evil credential stealing. Most scripts only need "@grant none", unless they are very complex (or whoever wrote them is a lousy programmer :D). Note that the credential stealing thing is still possible with no grants.
    Steam(shots), Imgur, Flickr, Bak'laag, why do you forsake me?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •