User:TransporterMan/vector.js

//importScript("User:Gerbrant/hidePane.js"); //importScript('User:TheDJ/Gadget-HotCat.js'); // Storage: // importScript('User:Twp/tineye.

//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

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.