Jump to content
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
Content deleted Content added
No edit summary
DivošiRunner (talk | contribs)
Restore theme-aware Discord and Roblox icons in Citizen navigation
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the Citizen skin */
/* All JavaScript here will be loaded for users of the Citizen skin. */


// Community shortcuts using Citizen's current header button markup.
// Discord Button
$(document).ready( function () {
$( function () {
const drawer = document.querySelector( '.citizen-drawer' );
$('.citizen-drawer').after($('<div class="citizen-discord citizen-header__item"><a href="{{Discord|Join our Discord}}"><div class="citizen-discord__button citizen-header__button"><div class="disc-icon"><label id="citizen-discord__buttonCheckbox" class="mw-checkbox-hack-button citizen-header__buttonCheckbox" for="citizen-discord__checkbox" title="Join us on Discord!" aria-hidden="true"><span>Join us on Discord!</span></label></div></div></a></div>'));
if ( !drawer ) {
⚫
});
return;
}

let previous = drawer;
[
{ name: 'discord', label: 'Join us on Discord!', href: 'https://discord.gg/sarkic' },
{ name: 'roblox', label: 'Sarkic Cults on Roblox', href: 'https://www.roblox.com/groups/3388048' }
].forEach( function ( service ) {
const existing = document.querySelector( '.citizen-social--' + service.name );
if ( existing ) {
previous = existing;
return;
}

const item = document.createElement( 'div' );
item.className = 'citizen-social citizen-social--' + service.name + ' citizen-header__item';
const link = document.createElement( 'a' );
link.className = 'citizen-' + service.name + ' citizen-cdx-button--size-large cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--icon-only cdx-button--weight-quiet';
link.href = service.href;
link.target = '_blank';
link.rel = 'noopener noreferrer';
link.title = service.label;
link.setAttribute( 'aria-label', service.label );
const icon = document.createElement( 'span' );
icon.className = 'citizen-social__icon citizen-social__icon--' + service.name;
icon.setAttribute( 'aria-hidden', 'true' );
link.appendChild( icon );
item.appendChild( link );
previous.insertAdjacentElement( 'afterend', item );
previous = item;
} );
⚫
} );

Latest revision as of 15:40, 5 October 2026

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

// Community shortcuts using Citizen's current header button markup.
$( function () {
	const drawer = document.querySelector( '.citizen-drawer' );
	if ( !drawer ) {
		return;
	}

	let previous = drawer;
	[
		{ name: 'discord', label: 'Join us on Discord!', href: 'https://discord.gg/sarkic' },
		{ name: 'roblox', label: 'Sarkic Cults on Roblox', href: 'https://www.roblox.com/groups/3388048' }
	].forEach( function ( service ) {
		const existing = document.querySelector( '.citizen-social--' + service.name );
		if ( existing ) {
			previous = existing;
			return;
		}

		const item = document.createElement( 'div' );
		item.className = 'citizen-social citizen-social--' + service.name + ' citizen-header__item';
		const link = document.createElement( 'a' );
		link.className = 'citizen-' + service.name + ' citizen-cdx-button--size-large cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--icon-only cdx-button--weight-quiet';
		link.href = service.href;
		link.target = '_blank';
		link.rel = 'noopener noreferrer';
		link.title = service.label;
		link.setAttribute( 'aria-label', service.label );
		const icon = document.createElement( 'span' );
		icon.className = 'citizen-social__icon citizen-social__icon--' + service.name;
		icon.setAttribute( 'aria-hidden', 'true' );
		link.appendChild( icon );
		item.appendChild( link );
		previous.insertAdjacentElement( 'afterend', item );
		previous = item;
	} );
} );