User:Jeeputer/specialRandomPage

From Wikipedia, the free encyclopedia
Special Random Page (SPRP)
DescriptionFinds a random page based on user's preferred options
Author(s)Jeeputer
Maintainer(s)Jeeputer
First releasedMay , 2023 (May , 2023)
UpdatedMay 21, 2023
    (11 months ago)
SourceUser:Jeeputer/specialRandomPage.js

Special Random Page (also known as SPRP) is a user script which is a special version of Special:RandomPage.

It finds you a random page in a namespace you choose and opens the edit form of the page (like what Special:EditPage/Special:RandomPage does), show links to the page or open a random redirect (like Special:RandomRedirect).

Installation[edit]

Copy the following to your common.js page and click Save.

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Jeeputer/specialRandomPage.js&action=raw&ctype=text/javascript'); // Backlink: [[User:Jeeputer/specialRandomPage.js]]

You may need to clear your browser's cache after saving.

Usage[edit]

After installation, open the "More" menu and click "Random Page", select a namespace, choose one (or more) of the three available options and click "Go".

The "All" option in namespaces dropdown menu leads you to a random page in one of the other namespaces listed in that menu, not all the existing namespaces on English Wikipedia.

options[edit]

  • (Redirect): Opens a random redirect page.
  • (Edit): Opens the edit form of the page (or the redirect)
  • (What links here): Opens list of links to the random page.

Customizing options[edit]

You can choose the default namespace and the default state of other 3 options. To do so, you have to add each of the following lines you want, to your common.js file before the above code you added for installation:

  • window.SPRPpreferredNamespace = 'name' – sets the default namespace. Replace name with (Article), File, Template, Category, Draft, or Module. note that All is currently the default, so there's no need to manually set it as default.
  • window.SPRPActivateRedirect = true – sets the redirect option activated by default.
  • window.SPRPAlwaysEdit = true – leads you to the edit form of the random page by default.
  • window.SPRPActivateWLH = true – always go the WhatLinksHere page of the random page.