-1

https://stackoverflow.com/unanswered/tagged/apache-spark?page=101&tab=noanswers

The last page could change, e.g. 102, 101. How to ensure that the last page is always opened?

6
  • 1
    What is the use case for this?
    – Pekka
    Commented Dec 22, 2016 at 13:11
  • I would like to see the lowest voted unanswered spark questions when I open a web browser
    – 030
    Commented Dec 22, 2016 at 13:14
  • 2
    TO GIVE MOAR DOWNVOTES!
    – Cody Gray Mod
    Commented Dec 22, 2016 at 13:52
  • @CodyGray That is an assumption. I want to answer the questions
    – 030
    Commented Dec 22, 2016 at 13:54
  • Why do you want to answer downvoted questions? That sounds like a horrible idea.
    – Cerbrus
    Commented Dec 22, 2016 at 14:13
  • @Cerbrus Maybe to try having the Reversal badge (GL&HF). ;p
    – Mistalis
    Commented Dec 22, 2016 at 15:43

1 Answer 1

2

There is no built-in functionality to do that.

I have created this userscript that achieves what you want by navigating (and then bookmark it for example) to the page -1.

Here is the script that happily runs with GreaseMonkey or TamperMonkey:

// ==UserScript==
// @name        go to last page
// @namespace   https://stackoverflow.com/users/578411/rene
// @include     *//stackoverflow.com/unanswered/tagged/*?page=-1&tab=noanswers
// @version     1
// @grant       none
// ==/UserScript==

/*global $, console */

(function () {
    'use strict';
    // no regex, no glory
    var regex = /.*\/unanswered\/tagged\/((.*)\?).*/g,
        matches;

    // find the tagname
    if (((matches = regex.exec(document.location.toString())) !== null) && (matches.length === 3)) {
        // fetch first page
        $.get('/unanswered/tagged/' + matches[2] + '?page=1&pagesize=50&tab=noanswers', function (data) {
            var prev, last;
            // find the last page in the pager
            $(data).find('div.pager > a').each(function () {
                prev = last;
                last = this;
            });
            // I assumed here that there are always more than 
            // 3 pages in the pager
            if (prev) {
                // navigate to the last page
                document.location = prev.href;
            }
        });
    }
}());

After you installed it, the script does its job if you visit:

https://stackoverflow.com/unanswered/tagged/haskell?page=-1&tab=noanswers

notice the page=-1. Without the userscript you'll get an empty page. But as the userscript is only configured to run on this page it will starts its parsing and redirecting but won't interfere with other pages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .