Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//importScript("User:Gerbrant/hidePane.js");
//importScript('User:TheDJ/Gadget-HotCat.js');

// Storage:
// importScript('User:Twp/tineye.js');
// importScript("User:Blue-Haired Lawyer/footnote popups.js");
// importScript('User:Lupin/recent2.js');

//importScript('User:TheJosh/Scripts/NewPagePatrol.js');

importScript('User:Ais523/watchlistnotifier.js');
importScript('User:Steven Zhang/DRW.js');

//prevent wikiED from jumping down and turn off duplicate warnings
var wikEdConfig = { 'scrollToEdit': false, 'scrollToPreview': false, 'doCloneWarnings': false };

//Modification by SDG of ("User:PleaseStand/subsearch.js") to search current page and subpages, not just subpages
//   line below was: textbox.value += " prefix:" + nsPrefix + wgTitle + "/";
//   Script will not work, author says, in Vector

/*global window, addOnloadHook, addHandler, SubsearchJsConfig,
wgNamespaceNumber, wgFormattedNamespaces, wgTitle*/

// Global variables
var SubsearchJsCheckbox;

// Event handler called when a search is performed
function SubsearchJsSubmitHandler() {
    // Local variables
    var textbox; var nsPrefix = "";
   
    if(SubsearchJsCheckbox.checked) {
        // Note that the main namespace (0) has no prefix.
        if(mw.config.get('wgNamespaceNumber')) {
            nsPrefix = mw.config.get('wgFormattedNamespaces')[mw.config.get('wgNamespaceNumber')] + ":";
        }
        textbox = window.document.getElementById("searchInput");
        textbox.value += " prefix:" + nsPrefix + mw.config.get('wgTitle');
        SubsearchJsCheckbox.checked = false;
    }
    return true;
}

$(function () {
    // Local variables
    var label; var labelText; var searchform;
   
    try {
    if(typeof SubsearchJsConfig != "object") {
       
        // Default configuration
        SubsearchJsConfig = {
            text: "\u00a0Subpages only",
            tooltip: "Search only the subpages of the current page",
            accesskey: "",
            style: "display: block; font-size: 80%; margin-top: 0.4em;",
            namespaces: // Update the following line from http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=namespaces&format=json
            {"query":{"namespaces":{"-2":{"id":-2,"*":"Media","canonical":"Media"},"-1":{"id":-1,"*":"Special","canonical":"Special"},"0":{"id":0,"*":"","content":""},"1":{"id":1,"*":"Talk","subpages":"","canonical":"Talk"},"2":{"id":2,"*":"User","subpages":"","canonical":"User"},"3":{"id":3,"*":"User talk","subpages":"","canonical":"User talk"},"4":{"id":4,"*":"Wikipedia","subpages":"","canonical":"Project"},"5":{"id":5,"*":"Wikipedia talk","subpages":"","canonical":"Project talk"},"6":{"id":6,"*":"File","canonical":"File"},"7":{"id":7,"*":"File talk","subpages":"","canonical":"File talk"},"8":{"id":8,"*":"MediaWiki","canonical":"MediaWiki"},"9":{"id":9,"*":"MediaWiki talk","subpages":"","canonical":"MediaWiki talk"},"10":{"id":10,"*":"Template","subpages":"","canonical":"Template"},"11":{"id":11,"*":"Template talk","subpages":"","canonical":"Template talk"},"12":{"id":12,"*":"Help","subpages":"","canonical":"Help"},"13":{"id":13,"*":"Help talk","subpages":"","canonical":"Help talk"},"14":{"id":14,"*":"Category","canonical":"Category"},"15":{"id":15,"*":"Category talk","subpages":"","canonical":"Category talk"},"100":{"id":100,"*":"Portal","subpages":"","canonical":"Portal"},"101":{"id":101,"*":"Portal talk","subpages":"","canonical":"Portal talk"},"108":{"id":108,"*":"Book","subpages":"","canonical":"Book"},"109":{"id":109,"*":"Book talk","subpages":"","canonical":"Book talk"}}}}
        };
       
    }
   
    // Make sure the current page's namespace has subpages turned on.
    if(!SubsearchJsConfig.namespaces.query.namespaces[mw.config.get('wgNamespaceNumber')].
    hasOwnProperty("subpages")) {
        return false;
    }
   
    // Add the checkbox if so.
    label = window.document.createElement("label");
    label.setAttribute("title", SubsearchJsConfig.tooltip);
    label.setAttribute("style", SubsearchJsConfig.style);
    SubsearchJsCheckbox = window.document.createElement("input");
    SubsearchJsCheckbox.setAttribute("type", "checkbox");
    SubsearchJsCheckbox.setAttribute("accesskey", SubsearchJsConfig.accesskey);
    label.appendChild(SubsearchJsCheckbox);
    labelText = window.document.createTextNode(SubsearchJsConfig.text);
    label.appendChild(labelText);
    searchform = window.document.getElementById("searchform");
    searchform.appendChild(label);
   
    // Add the submit handler to the search form.
    addHandler(searchform, "submit", SubsearchJsSubmitHandler);
   
    } catch(e) {}
    return false;
});

//Modification by SDG of ("User:PleaseStand/subsearch.js") ends