View text source at Wikipedia


User:PleaseStand/Subpage search

Subpage search is a user script by PleaseStand that adds a checkbox below the normal search box to limit the search to only subpages of the current page. For example, to search AfD discussions, go to Wikipedia:Articles for deletion, type in your search, check the box, and click the Search button. The checkbox only appears on namespaces that allow subpages.

Installation

[edit]

On the English Wikipedia

[edit]

Add the following code to Special:MyPage/skin.js:

importScript("User:PleaseStand/subsearch.js");

Other wikis

[edit]

If you are not on the English Wikipedia, you will need to use the following code instead:

// install [[Wikipedia:User:PleaseStand/Subpage search]] navigation tool - using custom configuration
SubsearchJsConfig = {
    text: "Subpages only",
    tooltip: "Search only the subpages of the current page",
    accesskey: "",
    style: "display: block; font-size: 80%; margin-top: 0.4em;",
    namespaces:
        // Replace this line with the code from http://YOURWIKI/w/api.php?action=query&meta=siteinfo&siprop=namespaces&format=json
};
importScriptURI('http://en.wikipedia.org/w/index.php?title=' +
'User:PleaseStand/subsearch.js&action=raw&ctype=text/javascript');

You do need to fill in the line below namespaces: or the code will not work (of course). Go to the URL shown, replacing YOURWIKI with the actual hostname of your wiki. Save the code to a file and drag the file into Notepad. Copy the code and paste it in place of the comment line.

Advanced

[edit]

Source code

[edit]

The source code is available at User:PleaseStand/subsearch.js.

Configuration

[edit]

Use the code from above to configure the script, replacing the right-hand side of each assignment appropriately. Using the style parameter, it is possible to adjust the size of the text.

Maintenance

[edit]

Whenever the English Wikipedia adds a new namespace, update the code from the URL described.

Any questions?

[edit]

If you have any questions, please leave a message on my talk page.