Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
No edit summary
Blanked the page
Tag: Blanking
 
Line 1: Line 1:
document.addEventListener('DOMContentLoaded', function () {
    // Citizen search button
    const citizenToggle = document.querySelector('.citizen-search-toggle');


    // Hotkey version (optional, keep it)
    document.addEventListener('keydown', function (e) {
        if (e.altKey && e.shiftKey && e.key.toLowerCase() === 'f') {
            e.preventDefault();
            if (citizenToggle) citizenToggle.click();
        }
    });
    // Insert a visible UI button into the page
    const btn = document.createElement('div');
    btn.className = 'custom-search-btn';
    btn.textContent = 'Search';
    btn.addEventListener('click', function () {
        if (citizenToggle) citizenToggle.click();
    });
    // Add it at the top of every page content
    const content = document.querySelector('#content, .mw-body');
    if (content) content.prepend(btn);
});

Latest revision as of 15:32, 8 November 2025