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

MediaWiki:Citizen.js: Difference between revisions

MediaWiki interface page
No edit summary
No edit summary
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
$(function() {
$(function () {
     var header = document.querySelector('.citizen-header');
     var headerStart = document.querySelector('.citizen-header__start');
    var drawer = header.querySelector('.citizen-drawer');
     if (!headerStart) {
   
         return;
     if (header && drawer) {
         var buttonDiv = document.createElement('div');
        buttonDiv.className = 'citizen-header__item';
       
        var link = document.createElement('a');
        link.href = '/index.php/Your_Page';
        link.className = 'citizen-header__button';
        link.title = 'My Custom Button';
       
        // Match Citizen's icon pattern: mw-ui-icon-NAME + mw-ui-icon-wikimedia-NAME
                link.innerHTML = '<span class="citizen-ui-icon mw-ui-icon-add mw-ui-icon-wikimedia-add"></span>';
       
        buttonDiv.appendChild(link);
        header.insertBefore(buttonDiv, drawer);
     }
     }
    var link = document.createElement('a');
    link.href = '/index.php/Special:PageCreationWizard';
    link.className = 'citizen-header__create-page';
    link.setAttribute('role', 'button');
    link.title = 'Create a new page';
    link.setAttribute('aria-label', 'Create a new page');
    link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><path fill="currentColor" d="M13 9h5.5L13 3.5V9M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m5 10v3H8v2h3v3h2v-3h3v-2h-3v-3h-2z"/></svg>';
    headerStart.prepend(link);
});
});

Latest revision as of 14:35, 20 July 2026

$(function () {
    var headerStart = document.querySelector('.citizen-header__start');
    if (!headerStart) {
        return;
    }

    var link = document.createElement('a');
    link.href = '/index.php/Special:PageCreationWizard';
    link.className = 'citizen-header__create-page';
    link.setAttribute('role', 'button');
    link.title = 'Create a new page';
    link.setAttribute('aria-label', 'Create a new page');
    link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><path fill="currentColor" d="M13 9h5.5L13 3.5V9M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m5 10v3H8v2h3v3h2v-3h3v-2h-3v-3h-2z"/></svg>';

    headerStart.prepend(link);
});