MediaWiki:Common.js: Difference between revisions

From EQOA Sandstorm Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 4: Line 4:
     $("#p-search").remove();
     $("#p-search").remove();


     // Insert top search bar AFTER the tabs container
     // Insert search bar into the header container
     var searchBar = $(`
    // We put it AFTER the logo, so header tabs are not blocked
     var searchBar = `
         <div id="top-search-bar">
         <div id="top-search-bar">
             <form action="/index.php" method="get">
             <form action="/index.php" id="searchform">
                 <input type="hidden" name="title" value="Special:Search">
                 <div id="simpleSearch">
                <input type="search" name="search" placeholder="Search..." />
                    <div id="searchInput-container">
                        <input type="search" name="search" placeholder="Search the Wiki" aria-label="Search the Wiki" id="searchInput" />
                    </div>
                    <input type="hidden" name="title" value="Special:Search" />
                    <input class="searchButton mw-fallbackSearchButton" type="submit" name="fulltext" title="Search the pages for this text" value="Search" />
                    <input class="searchButton" type="submit" name="go" title="Go to a page with this exact name" value="Go" />
                </div>
             </form>
             </form>
         </div>
         </div>
     `);
     `;


    // Insert after personal and namespaces tabs
     $("#p-logo-text").after(searchBar);
     $("#p-namespaces").after(searchBar);
});
});

Revision as of 11:36, 25 November 2025

/* Any JavaScript here will be loaded for all users on every page load. */
$(document).ready(function () {
    // Remove sidebar search
    $("#p-search").remove();

    // Insert search bar into the header container
    // We put it AFTER the logo, so header tabs are not blocked
    var searchBar = `
        <div id="top-search-bar">
            <form action="/index.php" id="searchform">
                <div id="simpleSearch">
                    <div id="searchInput-container">
                        <input type="search" name="search" placeholder="Search the Wiki" aria-label="Search the Wiki" id="searchInput" />
                    </div>
                    <input type="hidden" name="title" value="Special:Search" />
                    <input class="searchButton mw-fallbackSearchButton" type="submit" name="fulltext" title="Search the pages for this text" value="Search" />
                    <input class="searchButton" type="submit" name="go" title="Go to a page with this exact name" value="Go" />
                </div>
            </form>
        </div>
    `;

    $("#p-logo-text").after(searchBar);
});