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
Created page with "All JavaScript here will be loaded for users of the Citizen skin: mw.loader.using( 'mediawiki.util' ).then( function () { $( function () { var $start = $( '.citizen-header__start' ); if ( !$start.length ) return; var $btn = $( '<a>', { id: 'my-header-btn', class: 'citizen-header__button cdx-button cdx-button--icon-only cdx-button--weight-quiet', href: mw.util.getUrl( 'Special:Random' ), title: 'Random page', 'aria-label'..."
 
mNo edit summary
 
(9 intermediate revisions by the same user not shown)
Line 7: Line 7:


     var $btn = $( '<a>', {
     var $btn = $( '<a>', {
       id: 'my-header-btn',
       id: 'discord-header-btn',
       class: 'citizen-header__button cdx-button cdx-button--icon-only cdx-button--weight-quiet',
       class: 'citizen-header__button',
       href: mw.util.getUrl( 'Special:Random' ),
       href: 'https://discord.gg/bF9BgTzqZk',
       title: 'Random page',
       title: 'Join the SonyPlaza Discord',
       'aria-label': 'Random page'
       'aria-label': 'Join the SonyPlaza Discord',
     })
      target: '_blank',
    .append( $( '<span>', { class: 'mw-ui-icon mw-ui-icon-wikimedia-random' } ) );
      rel: 'noopener noreferrer'
     });
 
var svg =
  '<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false" class="discord-icon" xmlns="http://www.w3.org/2000/svg">' +
  ' <path d="M13.545 2.907a13.2 13.2 0 0 0-3.257-1.011.05.05 0 0 0-.052.025c-.141.25-.297.577-.406.833a12.2 12.2 0 0 0-3.658 0 8 8 0 0 0-.412-.833.05.05 0 0 0-.052-.025c-1.125.194-2.22.534-3.257 1.011a.04.04 0 0 0-.021.018C.356 6.024-.213 9.047.066 12.032q.003.022.021.037a13.3 13.3 0 0 0 3.995 2.02.05.05 0 0 0 .056-.019q.463-.63.818-1.329a.05.05 0 0 0-.01-.059l-.018-.011a9 9 0 0 1-1.248-.595.05.05 0 0 1-.02-.066l.015-.019q.127-.095.248-.195a.05.05 0 0 1 .051-.007c2.619 1.196 5.454 1.196 8.041 0a.05.05 0 0 1 .053.007q.121.1.248.195a.05.05 0 0 1-.004.085 8 8 0 0 1-1.249.594.05.05 0 0 0-.03.03.05.05 0 0 0 .003.041c.24.465.515.909.817 1.329a.05.05 0 0 0 .056.019 13.2 13.2 0 0 0 4.001-2.02.05.05 0 0 0 .021-.037c.334-3.451-.559-6.449-2.366-9.106a.03.03 0 0 0-.02-.019m-8.198 7.307c-.789 0-1.438-.724-1.438-1.612s.637-1.613 1.438-1.613c.807 0 1.45.73 1.438 1.613 0 .888-.637 1.612-1.438 1.612m5.316 0c-.788 0-1.438-.724-1.438-1.612s.637-1.613 1.438-1.613c.807 0 1.451.73 1.438 1.613 0 .888-.631 1.612-1.438 1.612"/>' +
  '</svg>';
 
    $btn.append( svg );


     var $hamburger = $start.find( 'button, a' ).first();
     var $hamburger = $start.find( 'button, a' ).first();
     if ( $hamburger.length ) {
     ( $hamburger.length ? $btn.insertAfter( $hamburger ) : $start.prepend( $btn ) );
      $btn.insertAfter( $hamburger );
    } else {
      $start.prepend( $btn );
    }
   } );
   } );
} );
} );

Latest revision as of 03:04, 21 October 2025

/* All JavaScript here will be loaded for users of the Citizen skin */

mw.loader.using( 'mediawiki.util' ).then( function () {
  $( function () {
    var $start = $( '.citizen-header__start' );
    if ( !$start.length ) return;

    var $btn = $( '<a>', {
      id: 'discord-header-btn',
      class: 'citizen-header__button',
      href: 'https://discord.gg/bF9BgTzqZk',
      title: 'Join the SonyPlaza Discord',
      'aria-label': 'Join the SonyPlaza Discord',
      target: '_blank',
      rel: 'noopener noreferrer'
    });

	var svg =
	  '<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false" class="discord-icon" xmlns="http://www.w3.org/2000/svg">' +
	  '  <path d="M13.545 2.907a13.2 13.2 0 0 0-3.257-1.011.05.05 0 0 0-.052.025c-.141.25-.297.577-.406.833a12.2 12.2 0 0 0-3.658 0 8 8 0 0 0-.412-.833.05.05 0 0 0-.052-.025c-1.125.194-2.22.534-3.257 1.011a.04.04 0 0 0-.021.018C.356 6.024-.213 9.047.066 12.032q.003.022.021.037a13.3 13.3 0 0 0 3.995 2.02.05.05 0 0 0 .056-.019q.463-.63.818-1.329a.05.05 0 0 0-.01-.059l-.018-.011a9 9 0 0 1-1.248-.595.05.05 0 0 1-.02-.066l.015-.019q.127-.095.248-.195a.05.05 0 0 1 .051-.007c2.619 1.196 5.454 1.196 8.041 0a.05.05 0 0 1 .053.007q.121.1.248.195a.05.05 0 0 1-.004.085 8 8 0 0 1-1.249.594.05.05 0 0 0-.03.03.05.05 0 0 0 .003.041c.24.465.515.909.817 1.329a.05.05 0 0 0 .056.019 13.2 13.2 0 0 0 4.001-2.02.05.05 0 0 0 .021-.037c.334-3.451-.559-6.449-2.366-9.106a.03.03 0 0 0-.02-.019m-8.198 7.307c-.789 0-1.438-.724-1.438-1.612s.637-1.613 1.438-1.613c.807 0 1.45.73 1.438 1.613 0 .888-.637 1.612-1.438 1.612m5.316 0c-.788 0-1.438-.724-1.438-1.612s.637-1.613 1.438-1.613c.807 0 1.451.73 1.438 1.613 0 .888-.631 1.612-1.438 1.612"/>' +
	  '</svg>';

    $btn.append( svg );

    var $hamburger = $start.find( 'button, a' ).first();
    ( $hamburger.length ? $btn.insertAfter( $hamburger ) : $start.prepend( $btn ) );
  } );
} );