User talk:GregU/randomlink.js

This tool adds a "Random link" option to the sidebar menu. When selected, you will travel to a random link on the current page (or specified page or pages). This is useful if you wish to view a random article that is related to the current article. It is also useful for unbiasedly selecting an article to work on from a specified category or list of articles.

The tool will consider only "normal" links in an article. It is also designed to do the right thing on special pages, considering only the "main" links. For example, on recent changes or user contributions (among many others), it will choose a title from the list, excluding user links and other links. But on history pages, it will follow only user page links, as they are the main thing there. In categories, it will choose only items... if there are any pages or files in the category. Else, it will use content links and subcategories (and parent categories, currently). However if hops > 1, it will always descend into subcategories if there are any.

The example configuration at the end shows the kinds of things you can do, adding these menu options:

  • Random link – default behavior, follows a random link on current page
  • Random back-link – goes backwards, to a random page that links here
  • Random page – loads a random article the slow way, by drilling down randomly through Special:AllPages
  • Featured article – goes to a random featured article listed on WP:FA
  • Video game article – goes to a random article in WikiProject Video games, via categories
  • Baseball article – goes to a random article in WikiProject Baseball, via What links here