|
|
| 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);
| |
| });
| |