MediaWiki:Common.js: Difference between revisions

From Wizards and Warlords
Jump to navigation Jump to search
No edit summary
No edit summary
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* Bottom collapse controls */
/* Bottom collapse controls */
mw.loader.using('jquery.makeCollapsible').then(function () {
mw.loader.using('jquery.makeCollapsible').then(function () {
var exampleTableQuery = window.matchMedia('(max-width: 899px)');
function updateExampleTableState($table) {
$table
.children('caption')
.attr('aria-expanded', $table.hasClass('mw-collapsed') ? 'false' : 'true');
}
function initialiseExampleTables() {
$('.wizlords-example-table.mw-collapsible').each(function () {
var $table = $(this);
var $caption = $table.children('caption');
if (exampleTableQuery.matches) {
$caption
.attr('role', 'button')
.attr('tabindex', '0');
updateExampleTableState($table);
} else {
$caption
.removeAttr('role')
.removeAttr('tabindex')
.removeAttr('aria-expanded');
}
});
}
$(initialiseExampleTables);
if (exampleTableQuery.addEventListener) {
exampleTableQuery.addEventListener('change', initialiseExampleTables);
} else if (exampleTableQuery.addListener) {
exampleTableQuery.addListener(initialiseExampleTables);
}
$(document).on('click', '.wizlords-example-table.mw-collapsible > caption', function (event) {
if (!exampleTableQuery.matches) {
return;
}
if ($(event.target).closest('.mw-collapsible-toggle').length) {
return;
}
var $table = $(this).closest('.wizlords-example-table');
var $toggle = $table.find('> caption .mw-collapsible-toggle').first();
if ($toggle.length) {
$toggle.trigger('click');
window.setTimeout(function () {
updateExampleTableState($table);
}, 0);
}
});
$(document).on('keydown', '.wizlords-example-table.mw-collapsible > caption', function (event) {
if (!exampleTableQuery.matches) {
return;
}
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
$(this).trigger('click');
}
});
function collapseFromBottom(toggleClass, collapsibleId) {
function collapseFromBottom(toggleClass, collapsibleId) {
$(document).on('click', toggleClass, function (event) {
$(document).on('click', toggleClass, function (event) {
Line 92: Line 159:
event.preventDefault();
event.preventDefault();
toggleClassCard(this);
toggleClassCard(this);
}
});
}() );
/* Mobile/tablet class category accordions */
( function () {
var classCategoryQuery = window.matchMedia('(max-width: 899px)');
var classCategoryIcons = [
{
selector: '.wizlords-class-category-accordion-martial',
fileName: 'MartialIcon.png'
},
{
selector: '.wizlords-class-category-accordion-arcane',
fileName: 'ArcaneIcon.png'
},
{
selector: '.wizlords-class-category-accordion-divine',
fileName: 'DivineIcon.png'
}
];
function getClassCategoryAccordionIcon(fileName) {
var scriptPath = mw.config.get('wgScriptPath') || '';
return $('<img>')
.attr('src', scriptPath + '/index.php/Special:FilePath/' + encodeURIComponent(fileName))
.attr('alt', '')
.attr('loading', 'lazy')
.attr('decoding', 'async');
}
function initialiseClassCategoryAccordionIcons() {
classCategoryIcons.forEach(function (category) {
$(category.selector).each(function () {
var $icon = $(this).find('.wizlords-class-category-accordion-icon').first();
if ($icon.length && !$icon.children('img').length) {
$icon.empty().append(getClassCategoryAccordionIcon(category.fileName));
}
});
});
}
function initialiseClassCategoryAccordions() {
initialiseClassCategoryAccordionIcons();
$('.wizlords-class-category-accordion').each(function () {
var $accordion = $(this);
var $heading = $accordion.children('.wizlords-class-category-accordion-heading').first();
var isMobileCitizen = classCategoryQuery.matches && $('body').hasClass('skin-citizen');
var isOpen = $accordion.hasClass('is-open');
if (isMobileCitizen) {
$heading
.attr('role', 'button')
.attr('tabindex', '0')
.attr('aria-expanded', isOpen ? 'true' : 'false');
} else {
$accordion.removeClass('is-open');
$heading
.removeAttr('role')
.removeAttr('tabindex')
.removeAttr('aria-expanded');
}
});
}
function toggleClassCategoryAccordion(heading) {
if (!classCategoryQuery.matches || !$('body').hasClass('skin-citizen')) {
return;
}
var $heading = $(heading);
var $accordion = $heading.closest('.wizlords-class-category-accordion');
var isOpen = $accordion.hasClass('is-open');
$accordion.toggleClass('is-open', !isOpen);
$heading.attr('aria-expanded', isOpen ? 'false' : 'true');
}
$(initialiseClassCategoryAccordions);
if (classCategoryQuery.addEventListener) {
classCategoryQuery.addEventListener('change', initialiseClassCategoryAccordions);
} else if (classCategoryQuery.addListener) {
classCategoryQuery.addListener(initialiseClassCategoryAccordions);
}
$(document).on('click', '.wizlords-class-category-accordion-heading', function () {
toggleClassCategoryAccordion(this);
});
$(document).on('keydown', '.wizlords-class-category-accordion-heading', function (event) {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
toggleClassCategoryAccordion(this);
}
});
}() );
/* Mobile/tablet race culture cards */
( function () {
var cultureCardQuery = window.matchMedia('(max-width: 899px)');
function isMobileCitizenCultureLayout() {
return cultureCardQuery.matches && $('body').hasClass('skin-citizen');
}
function initialiseCultureCards() {
var isActive = isMobileCitizenCultureLayout();
$('.wizlords-culture-card').each(function () {
var $card = $(this);
var isOpen = $card.hasClass('is-open');
if (isActive) {
$card
.attr('data-wizlords-mobile-culture-card', '1')
.attr('role', 'button')
.attr('tabindex', '0')
.attr('aria-expanded', isOpen ? 'true' : 'false');
} else {
$card
.removeClass('is-open')
.removeAttr('data-wizlords-mobile-culture-card')
.removeAttr('role')
.removeAttr('tabindex')
.removeAttr('aria-expanded');
}
});
}
function toggleCultureCard(card) {
if (!isMobileCitizenCultureLayout()) {
return;
}
var $card = $(card);
var isOpen = $card.hasClass('is-open');
$card
.toggleClass('is-open', !isOpen)
.attr('aria-expanded', isOpen ? 'false' : 'true');
}
$(initialiseCultureCards);
if (cultureCardQuery.addEventListener) {
cultureCardQuery.addEventListener('change', initialiseCultureCards);
} else if (cultureCardQuery.addListener) {
cultureCardQuery.addListener(initialiseCultureCards);
}
$(document).on('click', '.wizlords-culture-card', function (event) {
var isCultureHeaderLink = $(event.target).closest('.wizlords-culture-card-header a, .wizlords-culture-card-title a').length;
if (isMobileCitizenCultureLayout() && isCultureHeaderLink) {
event.preventDefault();
event.stopPropagation();
toggleCultureCard(this);
return;
}
if ($(event.target).closest('a').length) {
return;
}
toggleCultureCard(this);
});
$(document).on('keydown', '.wizlords-culture-card', function (event) {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
toggleCultureCard(this);
}
});
}() );
/* Responsive race Available Classes lists */
( function () {
function initialiseRaceAvailableClassLists() {
$('.wizlords-culture-classes + ul, .wizlords-shared-classes ul').each(function () {
var $list = $(this);
var itemCount = $list.children('li').length;
var $sharedClasses = $list.closest('.wizlords-shared-classes');
var isDrakelingList = $sharedClasses
.children('.wizlords-shared-classes-title')
.first()
.text()
.indexOf('Drakelings') !== -1;
$list
.removeClass(function (index, className) {
return (className.match(/(^|\s)count-\d+/g) || []).join(' ');
})
.addClass('wizlords-available-classes-list count-' + itemCount)
.toggleClass('is-multicolumn', itemCount > 4)
.toggleClass('is-short', itemCount <= 4)
.toggleClass('is-drakeling-list', isDrakelingList);
$list
.closest('.wizlords-culture-card-body, .wizlords-shared-classes')
.addClass('wizlords-available-classes');
});
}
$(initialiseRaceAvailableClassLists);
}() );
/* Mobile/tablet spellbook builder and collapse controls */
( function () {
var spellbookQuery = window.matchMedia('(max-width: 899px)');
var hasBuiltMobileSpellbooks = false;
var spellSummaries = {
'Arcane Weapon': 'Imbues a one-handed weapon with arcane energy, allowing it to strike with magical force.',
'Greater Arcane Weapon': 'Empowers a two-handed weapon with potent arcane magic, greatly enhancing its destructive power.',
'Arcane Armour': 'Wraps an ally in protective arcane energy, increasing their resilience against harm.',
'Arcane Ward': 'Enchants a shield with magical protection, allowing it to deflect hostile spells.',
'Arcane Bolt': 'Channels raw arcane energy into a magical projectile that blasts through enemy defences.',
'Arcane Force': 'Unleashes a burst of telekinetic power that hurls enemies away from the caster.',
'Nullify': 'Dispels magical effects within the surrounding area, disrupting spells and summoned creatures alike.',
'Mage Walk': 'Allows the caster to briefly walk across water as though it were solid ground.',
'Arcane Bridge': 'Creates a temporary bridge of magical energy, allowing allies to safely cross dangerous terrain.',
'Arcane Bridge Lv1': 'Creates a temporary bridge of magical energy, allowing allies to safely cross dangerous terrain.',
'Arcane Bridge Lv2': 'Creates a temporary bridge of magical energy, allowing allies to safely cross dangerous terrain.',
'Arcane Bind': 'Pins an enemy in place with invisible magical force, preventing them from escaping.',
'Summon Minor Arcane Servant - Defend': 'Summons a lesser arcane spirit that remains close to its master, defending them from nearby threats.',
'Summon Minor Arcane Servant - Attack': 'Summons a lesser arcane spirit that relentlessly pursues and attacks a chosen enemy.',
'Summon Arcane Servant - Defend': 'Calls forth a powerful guardian spirit dedicated to protecting its summoner.',
'Summon Arcane Servant - Attack': 'Summons a powerful arcane warrior that hunts down enemies with unwavering determination.',
'Summon Greater Arcane Servant': 'Calls forth a sentient arcane servant capable of acting independently on the battlefield.',
'Blessing': 'Fills an ally with divine favour, strengthening their body and shielding them from hostile magic.',
'Blessed Weapon': 'Consecrates a one-handed weapon so it strikes with holy power.',
'Greater Blessed Weapon': 'Infuses a two-handed weapon with divine might, allowing it to smite evil with every blow.',
'Holy Ward': 'Blesses a shield with sacred protection, turning aside magical attacks.',
'Sanctuary': 'Creates a holy sanctuary that wards away magical beings and protects the faithful.',
'Heal': 'Channels divine energy to mend wounds and restore an ally\'s vitality.',
'Full Heal': 'Completely restores a living ally, closing wounds and renewing their strength.',
'Mass Heal': 'Calls upon divine power to restore multiple wounded allies at once.',
'Resurrection': 'Returns a fallen ally to life through the power of divine intervention.',
'Bind Person': 'Calls upon divine authority to hold a mortal in place, preventing their escape.',
'Bind Person Lv1': 'Calls upon divine authority to hold a mortal in place, preventing their escape.',
'Bind Person Lv2': 'Calls upon divine authority to hold a mortal in place, preventing their escape.',
'Immobilise': 'Overwhelms a target with sacred power, leaving them completely unable to move or fight.',
'Taunt': 'Compels magical creatures to focus their attention upon the caster through divine command.',
'Taunt Lv1': 'Compels magical creatures to focus their attention upon the caster through divine command.',
'Taunt Lv2': 'Compels magical creatures to focus their attention upon the caster through divine command.',
'Banish': 'Drives magical creatures and summoned beings away with overwhelming divine authority.'
};
var mobileSpellTitles = {
'Summon Arcane Servant - Attack': 'Servant - Attack',
'Summon Arcane Servant - Defend': 'Servant - Defend',
'Summon Minor Arcane Servant - Attack': 'Minor Servant - Attack',
'Summon Minor Arcane Servant - Defend': 'Minor Servant - Defend',
'Summon Greater Arcane Servant': 'Greater Servant'
};
var tabletSpellTitles = {
'Summon Arcane Servant - Attack': 'Arcane Servant – Attack',
'Summon Arcane Servant - Defend': 'Arcane Servant – Defend',
'Summon Minor Arcane Servant - Attack': 'Minor Arcane Servant – Attack',
'Summon Minor Arcane Servant - Defend': 'Minor Arcane Servant – Defend',
'Summon Greater Arcane Servant': 'Greater Arcane Servant'
};
function getMobileSpellTitle(title) {
if (window.matchMedia('(min-width: 600px) and (max-width: 899px)').matches) {
return tabletSpellTitles[title] || title;
}
return mobileSpellTitles[title] || title;
}
function updateMobileSpellTitles() {
$('.wizlords-mobile-spell-card-title[data-wizlords-source-title]').each(function () {
var $title = $(this);
$title.text(getMobileSpellTitle($title.attr('data-wizlords-source-title')));
});
}
function getSpellIcon(iconType) {
var fileName = iconType === 'divine' ? 'DivineIcon.png' : 'ArcaneIcon.png';
var scriptPath = mw.config.get('wgScriptPath') || '';
return $('<img>')
.attr('src', scriptPath + '/index.php/Special:FilePath/' + encodeURIComponent(fileName))
.attr('alt', '')
.attr('loading', 'lazy')
.attr('decoding', 'async');
}
function getSpellbookIcon(iconType) {
var fileName = iconType === 'divine' ? 'DivineSpellbookIcon.png' : 'ArcaneSpellbookIcon.png';
var scriptPath = mw.config.get('wgScriptPath') || '';
return $('<img>')
.attr('src', scriptPath + '/index.php/Special:FilePath/' + encodeURIComponent(fileName))
.attr('alt', '')
.attr('loading', 'lazy')
.attr('decoding', 'async');
}
function buildMobileSpellCard($sourceCard, iconType) {
var title = $.trim($sourceCard.children('.wizlords-spell-card-title').first().text());
var $card = $('<div>').addClass('wizlords-mobile-spell-card');
var $icon = $('<div>').addClass('wizlords-mobile-spell-card-icon').append(getSpellIcon(iconType));
var $title = $('<div>')
.addClass('wizlords-mobile-spell-card-title')
.attr('data-wizlords-source-title', title)
.text(getMobileSpellTitle(title));
var $summary = $('<div>').addClass('wizlords-mobile-spell-card-summary').text(spellSummaries[title] || '');
var $rules = $('<div>').addClass('wizlords-mobile-spell-card-rules');
$sourceCard.children().not('.wizlords-spell-card-title').each(function () {
$rules.append($(this).clone());
});
return $card
.append($icon)
.append($title)
.append($summary)
.append($rules);
}
function buildMobileServantRulesCard($sourceRules) {
var title = $.trim($sourceRules.children('.wizlords-servant-rules-title').first().text());
var $card = $('<div>')
.addClass('wizlords-mobile-servant-rules-card')
.attr('role', 'button')
.attr('tabindex', '0')
.attr('aria-expanded', 'false');
var $title = $('<div>').addClass('wizlords-mobile-servant-rules-title').text(title);
var $rules = $('<div>').addClass('wizlords-mobile-servant-rules-content');
var $content = $sourceRules.children('.mw-collapsible-content').first();
$rules.append($content.children().clone());
return $card
.append($title)
.append($rules);
}
function buildMobileSpellbook(sourceSelector, title, variantClass, iconType) {
var $source = $(sourceSelector);
var $content = $source.children('.mw-collapsible-content').first();
var $book = $('<div>').addClass('wizlords-mobile-spellbook ' + variantClass);
var $header = $('<div>')
.addClass('wizlords-mobile-spellbook-header')
.attr('role', 'button')
.attr('tabindex', '0')
.attr('aria-expanded', 'false');
var $body = $('<div>').addClass('wizlords-mobile-spellbook-body');
var $currentCategory = null;
$header
.append($('<span>').addClass('wizlords-mobile-spellbook-title').text(title))
.append($('<span>').addClass('wizlords-mobile-spellbook-icon').append(getSpellbookIcon(iconType)));
$book.append($header).append($body);
$content.children().each(function () {
var $node = $(this);
if ($node.hasClass('wizlords-spell-category-heading')) {
$currentCategory = $('<div>').addClass('wizlords-mobile-spell-category');
$currentCategory.append($('<div>').addClass('wizlords-mobile-spell-category-heading').text($.trim($node.text())));
$body.append($currentCategory);
return;
}
if ($node.hasClass('wizlords-spell-category-description') && $currentCategory) {
$currentCategory.append($node.clone().removeClass('wizlords-spell-category-description').addClass('wizlords-mobile-spell-category-description'));
return;
}
if ($node.hasClass('wizlords-spell-card-grid')) {
if (!$currentCategory) {
$currentCategory = $('<div>').addClass('wizlords-mobile-spell-category');
$body.append($currentCategory);
}
$node.children('.wizlords-spell-card').each(function () {
$currentCategory.append(buildMobileSpellCard($(this), iconType));
});
}
if ($node.hasClass('wizlords-servant-rules')) {
if (!$currentCategory) {
$currentCategory = $('<div>').addClass('wizlords-mobile-spell-category');
$body.append($currentCategory);
}
$currentCategory
.append($('<div>').addClass('wizlords-mobile-servant-rules-divider'))
.append(buildMobileServantRulesCard($node));
}
});
$body.append(
$('<div>')
.addClass('wizlords-mobile-spellbook-collapse')
.attr('role', 'button')
.attr('tabindex', '0')
.attr('aria-label', 'Collapse ' + title)
);
return $book;
}
function buildMobileSpellbooks() {
var $target = $('.wizlords-spellbooks-mobile');
if (hasBuiltMobileSpellbooks || !$target.length) {
return;
}
$target
.empty()
.append(buildMobileSpellbook('#wizlords-arcane-spellbook', 'Arcane Spellbook', 'wizlords-mobile-spellbook-arcane', 'arcane'))
.append(buildMobileSpellbook('#wizlords-divine-spellbook', 'Divine Spellbook', 'wizlords-mobile-spellbook-divine', 'divine'));
hasBuiltMobileSpellbooks = true;
}
function initialiseMobileSpellCards() {
buildMobileSpellbooks();
updateMobileSpellTitles();
$('.wizlords-spellbooks-mobile').attr('aria-hidden', spellbookQuery.matches ? 'false' : 'true');
$('.wizlords-mobile-spellbook-header').each(function () {
var $header = $(this);
var isOpen = $header.closest('.wizlords-mobile-spellbook').hasClass('is-open');
if (spellbookQuery.matches) {
$header.attr('aria-expanded', isOpen ? 'true' : 'false');
} else {
$header.removeAttr('aria-expanded');
}
});
$('.wizlords-mobile-spellbook-collapse').each(function () {
var $control = $(this);
var isOpen = $control.closest('.wizlords-mobile-spellbook').hasClass('is-open');
if (spellbookQuery.matches) {
$control.attr('aria-expanded', isOpen ? 'true' : 'false');
} else {
$control.removeAttr('aria-expanded');
}
});
$('.wizlords-mobile-spell-card').each(function () {
var $card = $(this);
if (spellbookQuery.matches) {
if (!$card.attr('data-wizlords-mobile-spell-card')) {
$card
.attr('data-wizlords-mobile-spell-card', '1')
.attr('role', 'button')
.attr('tabindex', '0');
}
if (!$card.hasClass('is-open')) {
$card.attr('aria-expanded', 'false');
}
} else {
$card
.removeAttr('data-wizlords-mobile-spell-card')
.removeAttr('role')
.removeAttr('tabindex')
.removeAttr('aria-expanded')
.removeClass('is-open');
}
});
$('.wizlords-mobile-servant-rules-card').each(function () {
var $card = $(this);
if (spellbookQuery.matches) {
$card
.attr('role', 'button')
.attr('tabindex', '0');
if (!$card.hasClass('is-open')) {
$card.attr('aria-expanded', 'false');
}
} else {
$card
.removeAttr('role')
.removeAttr('tabindex')
.removeAttr('aria-expanded')
.removeClass('is-open');
}
});
}
function toggleMobileSpellCard(card) {
if (!spellbookQuery.matches) {
return;
}
var $card = $(card);
var isOpen = $card.hasClass('is-open');
$card
.toggleClass('is-open', !isOpen)
.attr('aria-expanded', isOpen ? 'false' : 'true');
}
function toggleMobileSpellbook(header) {
if (!spellbookQuery.matches) {
return;
}
var $header = $(header);
var $book = $header.closest('.wizlords-mobile-spellbook');
var isOpen = $book.hasClass('is-open');
$book.toggleClass('is-open', !isOpen);
$book
.find('.wizlords-mobile-spellbook-header, .wizlords-mobile-spellbook-collapse')
.attr('aria-expanded', isOpen ? 'false' : 'true');
}
function toggleMobileServantRulesCard(card) {
if (!spellbookQuery.matches) {
return;
}
var $card = $(card);
var isOpen = $card.hasClass('is-open');
$card
.toggleClass('is-open', !isOpen)
.attr('aria-expanded', isOpen ? 'false' : 'true');
}
$(initialiseMobileSpellCards);
if (spellbookQuery.addEventListener) {
spellbookQuery.addEventListener('change', initialiseMobileSpellCards);
} else if (spellbookQuery.addListener) {
spellbookQuery.addListener(initialiseMobileSpellCards);
}
$(document).on('click', '.wizlords-mobile-spell-card', function (event) {
if ($(event.target).closest('a').length) {
return;
}
toggleMobileSpellCard(this);
});
$(document).on('click', '.wizlords-mobile-servant-rules-card', function (event) {
if ($(event.target).closest('a').length) {
return;
}
toggleMobileServantRulesCard(this);
});
$(document).on('click', '.wizlords-mobile-spellbook-header', function () {
toggleMobileSpellbook(this);
});
$(document).on('click', '.wizlords-mobile-spellbook-collapse', function () {
toggleMobileSpellbook($(this).closest('.wizlords-mobile-spellbook').children('.wizlords-mobile-spellbook-header').first());
});
$(document).on('keydown', '.wizlords-mobile-spell-card', function (event) {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
toggleMobileSpellCard(this);
}
});
$(document).on('keydown', '.wizlords-mobile-servant-rules-card', function (event) {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
toggleMobileServantRulesCard(this);
}
});
$(document).on('keydown', '.wizlords-mobile-spellbook-header', function (event) {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
toggleMobileSpellbook(this);
}
});
$(document).on('keydown', '.wizlords-mobile-spellbook-collapse', function (event) {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
toggleMobileSpellbook($(this).closest('.wizlords-mobile-spellbook').children('.wizlords-mobile-spellbook-header').first());
}
}
});
});
}() );
}() );

Latest revision as of 21:47, 30 June 2026

/* Bottom collapse controls */
mw.loader.using('jquery.makeCollapsible').then(function () {
	var exampleTableQuery = window.matchMedia('(max-width: 899px)');

	function updateExampleTableState($table) {
		$table
			.children('caption')
			.attr('aria-expanded', $table.hasClass('mw-collapsed') ? 'false' : 'true');
	}

	function initialiseExampleTables() {
		$('.wizlords-example-table.mw-collapsible').each(function () {
			var $table = $(this);
			var $caption = $table.children('caption');

			if (exampleTableQuery.matches) {
				$caption
					.attr('role', 'button')
					.attr('tabindex', '0');

				updateExampleTableState($table);
			} else {
				$caption
					.removeAttr('role')
					.removeAttr('tabindex')
					.removeAttr('aria-expanded');
			}
		});
	}

	$(initialiseExampleTables);

	if (exampleTableQuery.addEventListener) {
		exampleTableQuery.addEventListener('change', initialiseExampleTables);
	} else if (exampleTableQuery.addListener) {
		exampleTableQuery.addListener(initialiseExampleTables);
	}

	$(document).on('click', '.wizlords-example-table.mw-collapsible > caption', function (event) {
		if (!exampleTableQuery.matches) {
			return;
		}

		if ($(event.target).closest('.mw-collapsible-toggle').length) {
			return;
		}

		var $table = $(this).closest('.wizlords-example-table');
		var $toggle = $table.find('> caption .mw-collapsible-toggle').first();

		if ($toggle.length) {
			$toggle.trigger('click');
			window.setTimeout(function () {
				updateExampleTableState($table);
			}, 0);
		}
	});

	$(document).on('keydown', '.wizlords-example-table.mw-collapsible > caption', function (event) {
		if (!exampleTableQuery.matches) {
			return;
		}

		if (event.key === 'Enter' || event.key === ' ') {
			event.preventDefault();
			$(this).trigger('click');
		}
	});

	function collapseFromBottom(toggleClass, collapsibleId) {
		$(document).on('click', toggleClass, function (event) {
			event.preventDefault();

			var $collapsible = $('#' + collapsibleId);
			var $topToggle = $collapsible.children('.mw-collapsible-toggle').first();

			if ($topToggle.length) {
				$topToggle.trigger('click');
			}
		});
	}

	collapseFromBottom('.wizlords-spellbook-collapse-arcane', 'wizlords-arcane-spellbook');
	collapseFromBottom('.wizlords-spellbook-collapse-divine', 'wizlords-divine-spellbook');

	$(document).on('click', '.wizlords-collapsible-section-bottom-toggle', function (event) {
		event.preventDefault();

		var $collapsible = $(this).closest('.wizlords-collapsible-section');
		var $topToggle = $collapsible.children('.mw-collapsible-toggle').first();

		if ($topToggle.length) {
			$topToggle.trigger('click');
		}
	});
});

/* Mobile class-card collapse controls */
( function () {
	var mobileQuery = window.matchMedia('(max-width: 599px)');

	function initialiseClassCards() {
		$('.wizlords-class-card').each(function () {
			var $card = $(this);

			if (mobileQuery.matches) {
				if (!$card.attr('data-wizlords-mobile-class-card')) {
					$card
						.attr('data-wizlords-mobile-class-card', '1')
						.attr('role', 'button')
						.attr('tabindex', '0');
				}

				if (!$card.hasClass('is-open')) {
					$card.attr('aria-expanded', 'false');
				}
			} else {
				$card
					.removeAttr('data-wizlords-mobile-class-card')
					.removeAttr('role')
					.removeAttr('tabindex')
					.removeAttr('aria-expanded')
					.removeClass('is-open');
			}
		});
	}

	function toggleClassCard(card) {
		if (!mobileQuery.matches) {
			return;
		}

		var $card = $(card);
		var isOpen = $card.hasClass('is-open');

		$card
			.toggleClass('is-open', !isOpen)
			.attr('aria-expanded', isOpen ? 'false' : 'true');
	}

	$(initialiseClassCards);

	if (mobileQuery.addEventListener) {
		mobileQuery.addEventListener('change', initialiseClassCards);
	} else if (mobileQuery.addListener) {
		mobileQuery.addListener(initialiseClassCards);
	}

	$(document).on('click', '.wizlords-class-card', function (event) {
		if ($(event.target).closest('a').length) {
			return;
		}

		toggleClassCard(this);
	});

	$(document).on('keydown', '.wizlords-class-card', function (event) {
		if (event.key === 'Enter' || event.key === ' ') {
			event.preventDefault();
			toggleClassCard(this);
		}
	});
}() );

/* Mobile/tablet class category accordions */
( function () {
	var classCategoryQuery = window.matchMedia('(max-width: 899px)');
	var classCategoryIcons = [
		{
			selector: '.wizlords-class-category-accordion-martial',
			fileName: 'MartialIcon.png'
		},
		{
			selector: '.wizlords-class-category-accordion-arcane',
			fileName: 'ArcaneIcon.png'
		},
		{
			selector: '.wizlords-class-category-accordion-divine',
			fileName: 'DivineIcon.png'
		}
	];

	function getClassCategoryAccordionIcon(fileName) {
		var scriptPath = mw.config.get('wgScriptPath') || '';

		return $('<img>')
			.attr('src', scriptPath + '/index.php/Special:FilePath/' + encodeURIComponent(fileName))
			.attr('alt', '')
			.attr('loading', 'lazy')
			.attr('decoding', 'async');
	}

	function initialiseClassCategoryAccordionIcons() {
		classCategoryIcons.forEach(function (category) {
			$(category.selector).each(function () {
				var $icon = $(this).find('.wizlords-class-category-accordion-icon').first();

				if ($icon.length && !$icon.children('img').length) {
					$icon.empty().append(getClassCategoryAccordionIcon(category.fileName));
				}
			});
		});
	}

	function initialiseClassCategoryAccordions() {
		initialiseClassCategoryAccordionIcons();

		$('.wizlords-class-category-accordion').each(function () {
			var $accordion = $(this);
			var $heading = $accordion.children('.wizlords-class-category-accordion-heading').first();
			var isMobileCitizen = classCategoryQuery.matches && $('body').hasClass('skin-citizen');
			var isOpen = $accordion.hasClass('is-open');

			if (isMobileCitizen) {
				$heading
					.attr('role', 'button')
					.attr('tabindex', '0')
					.attr('aria-expanded', isOpen ? 'true' : 'false');
			} else {
				$accordion.removeClass('is-open');
				$heading
					.removeAttr('role')
					.removeAttr('tabindex')
					.removeAttr('aria-expanded');
			}
		});
	}

	function toggleClassCategoryAccordion(heading) {
		if (!classCategoryQuery.matches || !$('body').hasClass('skin-citizen')) {
			return;
		}

		var $heading = $(heading);
		var $accordion = $heading.closest('.wizlords-class-category-accordion');
		var isOpen = $accordion.hasClass('is-open');

		$accordion.toggleClass('is-open', !isOpen);
		$heading.attr('aria-expanded', isOpen ? 'false' : 'true');
	}

	$(initialiseClassCategoryAccordions);

	if (classCategoryQuery.addEventListener) {
		classCategoryQuery.addEventListener('change', initialiseClassCategoryAccordions);
	} else if (classCategoryQuery.addListener) {
		classCategoryQuery.addListener(initialiseClassCategoryAccordions);
	}

	$(document).on('click', '.wizlords-class-category-accordion-heading', function () {
		toggleClassCategoryAccordion(this);
	});

	$(document).on('keydown', '.wizlords-class-category-accordion-heading', function (event) {
		if (event.key === 'Enter' || event.key === ' ') {
			event.preventDefault();
			toggleClassCategoryAccordion(this);
		}
	});
}() );

/* Mobile/tablet race culture cards */
( function () {
	var cultureCardQuery = window.matchMedia('(max-width: 899px)');

	function isMobileCitizenCultureLayout() {
		return cultureCardQuery.matches && $('body').hasClass('skin-citizen');
	}

	function initialiseCultureCards() {
		var isActive = isMobileCitizenCultureLayout();

		$('.wizlords-culture-card').each(function () {
			var $card = $(this);
			var isOpen = $card.hasClass('is-open');

			if (isActive) {
				$card
					.attr('data-wizlords-mobile-culture-card', '1')
					.attr('role', 'button')
					.attr('tabindex', '0')
					.attr('aria-expanded', isOpen ? 'true' : 'false');
			} else {
				$card
					.removeClass('is-open')
					.removeAttr('data-wizlords-mobile-culture-card')
					.removeAttr('role')
					.removeAttr('tabindex')
					.removeAttr('aria-expanded');
			}
		});
	}

	function toggleCultureCard(card) {
		if (!isMobileCitizenCultureLayout()) {
			return;
		}

		var $card = $(card);
		var isOpen = $card.hasClass('is-open');

		$card
			.toggleClass('is-open', !isOpen)
			.attr('aria-expanded', isOpen ? 'false' : 'true');
	}

	$(initialiseCultureCards);

	if (cultureCardQuery.addEventListener) {
		cultureCardQuery.addEventListener('change', initialiseCultureCards);
	} else if (cultureCardQuery.addListener) {
		cultureCardQuery.addListener(initialiseCultureCards);
	}

	$(document).on('click', '.wizlords-culture-card', function (event) {
		var isCultureHeaderLink = $(event.target).closest('.wizlords-culture-card-header a, .wizlords-culture-card-title a').length;

		if (isMobileCitizenCultureLayout() && isCultureHeaderLink) {
			event.preventDefault();
			event.stopPropagation();
			toggleCultureCard(this);
			return;
		}

		if ($(event.target).closest('a').length) {
			return;
		}

		toggleCultureCard(this);
	});

	$(document).on('keydown', '.wizlords-culture-card', function (event) {
		if (event.key === 'Enter' || event.key === ' ') {
			event.preventDefault();
			toggleCultureCard(this);
		}
	});
}() );

/* Responsive race Available Classes lists */
( function () {
	function initialiseRaceAvailableClassLists() {
		$('.wizlords-culture-classes + ul, .wizlords-shared-classes ul').each(function () {
			var $list = $(this);
			var itemCount = $list.children('li').length;
			var $sharedClasses = $list.closest('.wizlords-shared-classes');
			var isDrakelingList = $sharedClasses
				.children('.wizlords-shared-classes-title')
				.first()
				.text()
				.indexOf('Drakelings') !== -1;

			$list
				.removeClass(function (index, className) {
					return (className.match(/(^|\s)count-\d+/g) || []).join(' ');
				})
				.addClass('wizlords-available-classes-list count-' + itemCount)
				.toggleClass('is-multicolumn', itemCount > 4)
				.toggleClass('is-short', itemCount <= 4)
				.toggleClass('is-drakeling-list', isDrakelingList);

			$list
				.closest('.wizlords-culture-card-body, .wizlords-shared-classes')
				.addClass('wizlords-available-classes');
		});
	}

	$(initialiseRaceAvailableClassLists);
}() );

/* Mobile/tablet spellbook builder and collapse controls */
( function () {
	var spellbookQuery = window.matchMedia('(max-width: 899px)');
	var hasBuiltMobileSpellbooks = false;

	var spellSummaries = {
		'Arcane Weapon': 'Imbues a one-handed weapon with arcane energy, allowing it to strike with magical force.',
		'Greater Arcane Weapon': 'Empowers a two-handed weapon with potent arcane magic, greatly enhancing its destructive power.',
		'Arcane Armour': 'Wraps an ally in protective arcane energy, increasing their resilience against harm.',
		'Arcane Ward': 'Enchants a shield with magical protection, allowing it to deflect hostile spells.',
		'Arcane Bolt': 'Channels raw arcane energy into a magical projectile that blasts through enemy defences.',
		'Arcane Force': 'Unleashes a burst of telekinetic power that hurls enemies away from the caster.',
		'Nullify': 'Dispels magical effects within the surrounding area, disrupting spells and summoned creatures alike.',
		'Mage Walk': 'Allows the caster to briefly walk across water as though it were solid ground.',
		'Arcane Bridge': 'Creates a temporary bridge of magical energy, allowing allies to safely cross dangerous terrain.',
		'Arcane Bridge Lv1': 'Creates a temporary bridge of magical energy, allowing allies to safely cross dangerous terrain.',
		'Arcane Bridge Lv2': 'Creates a temporary bridge of magical energy, allowing allies to safely cross dangerous terrain.',
		'Arcane Bind': 'Pins an enemy in place with invisible magical force, preventing them from escaping.',
		'Summon Minor Arcane Servant - Defend': 'Summons a lesser arcane spirit that remains close to its master, defending them from nearby threats.',
		'Summon Minor Arcane Servant - Attack': 'Summons a lesser arcane spirit that relentlessly pursues and attacks a chosen enemy.',
		'Summon Arcane Servant - Defend': 'Calls forth a powerful guardian spirit dedicated to protecting its summoner.',
		'Summon Arcane Servant - Attack': 'Summons a powerful arcane warrior that hunts down enemies with unwavering determination.',
		'Summon Greater Arcane Servant': 'Calls forth a sentient arcane servant capable of acting independently on the battlefield.',
		'Blessing': 'Fills an ally with divine favour, strengthening their body and shielding them from hostile magic.',
		'Blessed Weapon': 'Consecrates a one-handed weapon so it strikes with holy power.',
		'Greater Blessed Weapon': 'Infuses a two-handed weapon with divine might, allowing it to smite evil with every blow.',
		'Holy Ward': 'Blesses a shield with sacred protection, turning aside magical attacks.',
		'Sanctuary': 'Creates a holy sanctuary that wards away magical beings and protects the faithful.',
		'Heal': 'Channels divine energy to mend wounds and restore an ally\'s vitality.',
		'Full Heal': 'Completely restores a living ally, closing wounds and renewing their strength.',
		'Mass Heal': 'Calls upon divine power to restore multiple wounded allies at once.',
		'Resurrection': 'Returns a fallen ally to life through the power of divine intervention.',
		'Bind Person': 'Calls upon divine authority to hold a mortal in place, preventing their escape.',
		'Bind Person Lv1': 'Calls upon divine authority to hold a mortal in place, preventing their escape.',
		'Bind Person Lv2': 'Calls upon divine authority to hold a mortal in place, preventing their escape.',
		'Immobilise': 'Overwhelms a target with sacred power, leaving them completely unable to move or fight.',
		'Taunt': 'Compels magical creatures to focus their attention upon the caster through divine command.',
		'Taunt Lv1': 'Compels magical creatures to focus their attention upon the caster through divine command.',
		'Taunt Lv2': 'Compels magical creatures to focus their attention upon the caster through divine command.',
		'Banish': 'Drives magical creatures and summoned beings away with overwhelming divine authority.'
	};

	var mobileSpellTitles = {
		'Summon Arcane Servant - Attack': 'Servant - Attack',
		'Summon Arcane Servant - Defend': 'Servant - Defend',
		'Summon Minor Arcane Servant - Attack': 'Minor Servant - Attack',
		'Summon Minor Arcane Servant - Defend': 'Minor Servant - Defend',
		'Summon Greater Arcane Servant': 'Greater Servant'
	};

	var tabletSpellTitles = {
		'Summon Arcane Servant - Attack': 'Arcane Servant – Attack',
		'Summon Arcane Servant - Defend': 'Arcane Servant – Defend',
		'Summon Minor Arcane Servant - Attack': 'Minor Arcane Servant – Attack',
		'Summon Minor Arcane Servant - Defend': 'Minor Arcane Servant – Defend',
		'Summon Greater Arcane Servant': 'Greater Arcane Servant'
	};

	function getMobileSpellTitle(title) {
		if (window.matchMedia('(min-width: 600px) and (max-width: 899px)').matches) {
			return tabletSpellTitles[title] || title;
		}

		return mobileSpellTitles[title] || title;
	}

	function updateMobileSpellTitles() {
		$('.wizlords-mobile-spell-card-title[data-wizlords-source-title]').each(function () {
			var $title = $(this);

			$title.text(getMobileSpellTitle($title.attr('data-wizlords-source-title')));
		});
	}

	function getSpellIcon(iconType) {
		var fileName = iconType === 'divine' ? 'DivineIcon.png' : 'ArcaneIcon.png';
		var scriptPath = mw.config.get('wgScriptPath') || '';

		return $('<img>')
			.attr('src', scriptPath + '/index.php/Special:FilePath/' + encodeURIComponent(fileName))
			.attr('alt', '')
			.attr('loading', 'lazy')
			.attr('decoding', 'async');
	}

	function getSpellbookIcon(iconType) {
		var fileName = iconType === 'divine' ? 'DivineSpellbookIcon.png' : 'ArcaneSpellbookIcon.png';
		var scriptPath = mw.config.get('wgScriptPath') || '';

		return $('<img>')
			.attr('src', scriptPath + '/index.php/Special:FilePath/' + encodeURIComponent(fileName))
			.attr('alt', '')
			.attr('loading', 'lazy')
			.attr('decoding', 'async');
	}

	function buildMobileSpellCard($sourceCard, iconType) {
		var title = $.trim($sourceCard.children('.wizlords-spell-card-title').first().text());
		var $card = $('<div>').addClass('wizlords-mobile-spell-card');
		var $icon = $('<div>').addClass('wizlords-mobile-spell-card-icon').append(getSpellIcon(iconType));
		var $title = $('<div>')
			.addClass('wizlords-mobile-spell-card-title')
			.attr('data-wizlords-source-title', title)
			.text(getMobileSpellTitle(title));
		var $summary = $('<div>').addClass('wizlords-mobile-spell-card-summary').text(spellSummaries[title] || '');
		var $rules = $('<div>').addClass('wizlords-mobile-spell-card-rules');

		$sourceCard.children().not('.wizlords-spell-card-title').each(function () {
			$rules.append($(this).clone());
		});

		return $card
			.append($icon)
			.append($title)
			.append($summary)
			.append($rules);
	}

	function buildMobileServantRulesCard($sourceRules) {
		var title = $.trim($sourceRules.children('.wizlords-servant-rules-title').first().text());
		var $card = $('<div>')
			.addClass('wizlords-mobile-servant-rules-card')
			.attr('role', 'button')
			.attr('tabindex', '0')
			.attr('aria-expanded', 'false');
		var $title = $('<div>').addClass('wizlords-mobile-servant-rules-title').text(title);
		var $rules = $('<div>').addClass('wizlords-mobile-servant-rules-content');
		var $content = $sourceRules.children('.mw-collapsible-content').first();

		$rules.append($content.children().clone());

		return $card
			.append($title)
			.append($rules);
	}

	function buildMobileSpellbook(sourceSelector, title, variantClass, iconType) {
		var $source = $(sourceSelector);
		var $content = $source.children('.mw-collapsible-content').first();
		var $book = $('<div>').addClass('wizlords-mobile-spellbook ' + variantClass);
		var $header = $('<div>')
			.addClass('wizlords-mobile-spellbook-header')
			.attr('role', 'button')
			.attr('tabindex', '0')
			.attr('aria-expanded', 'false');
		var $body = $('<div>').addClass('wizlords-mobile-spellbook-body');
		var $currentCategory = null;

		$header
			.append($('<span>').addClass('wizlords-mobile-spellbook-title').text(title))
			.append($('<span>').addClass('wizlords-mobile-spellbook-icon').append(getSpellbookIcon(iconType)));

		$book.append($header).append($body);

		$content.children().each(function () {
			var $node = $(this);

			if ($node.hasClass('wizlords-spell-category-heading')) {
				$currentCategory = $('<div>').addClass('wizlords-mobile-spell-category');
				$currentCategory.append($('<div>').addClass('wizlords-mobile-spell-category-heading').text($.trim($node.text())));
				$body.append($currentCategory);
				return;
			}

			if ($node.hasClass('wizlords-spell-category-description') && $currentCategory) {
				$currentCategory.append($node.clone().removeClass('wizlords-spell-category-description').addClass('wizlords-mobile-spell-category-description'));
				return;
			}

			if ($node.hasClass('wizlords-spell-card-grid')) {
				if (!$currentCategory) {
					$currentCategory = $('<div>').addClass('wizlords-mobile-spell-category');
					$body.append($currentCategory);
				}

				$node.children('.wizlords-spell-card').each(function () {
					$currentCategory.append(buildMobileSpellCard($(this), iconType));
				});
			}

			if ($node.hasClass('wizlords-servant-rules')) {
				if (!$currentCategory) {
					$currentCategory = $('<div>').addClass('wizlords-mobile-spell-category');
					$body.append($currentCategory);
				}

				$currentCategory
					.append($('<div>').addClass('wizlords-mobile-servant-rules-divider'))
					.append(buildMobileServantRulesCard($node));
			}
		});

		$body.append(
			$('<div>')
				.addClass('wizlords-mobile-spellbook-collapse')
				.attr('role', 'button')
				.attr('tabindex', '0')
				.attr('aria-label', 'Collapse ' + title)
		);

		return $book;
	}

	function buildMobileSpellbooks() {
		var $target = $('.wizlords-spellbooks-mobile');

		if (hasBuiltMobileSpellbooks || !$target.length) {
			return;
		}

		$target
			.empty()
			.append(buildMobileSpellbook('#wizlords-arcane-spellbook', 'Arcane Spellbook', 'wizlords-mobile-spellbook-arcane', 'arcane'))
			.append(buildMobileSpellbook('#wizlords-divine-spellbook', 'Divine Spellbook', 'wizlords-mobile-spellbook-divine', 'divine'));

		hasBuiltMobileSpellbooks = true;
	}

	function initialiseMobileSpellCards() {
		buildMobileSpellbooks();
		updateMobileSpellTitles();

		$('.wizlords-spellbooks-mobile').attr('aria-hidden', spellbookQuery.matches ? 'false' : 'true');

		$('.wizlords-mobile-spellbook-header').each(function () {
			var $header = $(this);
			var isOpen = $header.closest('.wizlords-mobile-spellbook').hasClass('is-open');

			if (spellbookQuery.matches) {
				$header.attr('aria-expanded', isOpen ? 'true' : 'false');
			} else {
				$header.removeAttr('aria-expanded');
			}
		});

		$('.wizlords-mobile-spellbook-collapse').each(function () {
			var $control = $(this);
			var isOpen = $control.closest('.wizlords-mobile-spellbook').hasClass('is-open');

			if (spellbookQuery.matches) {
				$control.attr('aria-expanded', isOpen ? 'true' : 'false');
			} else {
				$control.removeAttr('aria-expanded');
			}
		});

		$('.wizlords-mobile-spell-card').each(function () {
			var $card = $(this);

			if (spellbookQuery.matches) {
				if (!$card.attr('data-wizlords-mobile-spell-card')) {
					$card
						.attr('data-wizlords-mobile-spell-card', '1')
						.attr('role', 'button')
						.attr('tabindex', '0');
				}

				if (!$card.hasClass('is-open')) {
					$card.attr('aria-expanded', 'false');
				}
			} else {
				$card
					.removeAttr('data-wizlords-mobile-spell-card')
					.removeAttr('role')
					.removeAttr('tabindex')
					.removeAttr('aria-expanded')
					.removeClass('is-open');
			}
		});

		$('.wizlords-mobile-servant-rules-card').each(function () {
			var $card = $(this);

			if (spellbookQuery.matches) {
				$card
					.attr('role', 'button')
					.attr('tabindex', '0');

				if (!$card.hasClass('is-open')) {
					$card.attr('aria-expanded', 'false');
				}
			} else {
				$card
					.removeAttr('role')
					.removeAttr('tabindex')
					.removeAttr('aria-expanded')
					.removeClass('is-open');
			}
		});
	}

	function toggleMobileSpellCard(card) {
		if (!spellbookQuery.matches) {
			return;
		}

		var $card = $(card);
		var isOpen = $card.hasClass('is-open');

		$card
			.toggleClass('is-open', !isOpen)
			.attr('aria-expanded', isOpen ? 'false' : 'true');
	}

	function toggleMobileSpellbook(header) {
		if (!spellbookQuery.matches) {
			return;
		}

		var $header = $(header);
		var $book = $header.closest('.wizlords-mobile-spellbook');
		var isOpen = $book.hasClass('is-open');

		$book.toggleClass('is-open', !isOpen);
		$book
			.find('.wizlords-mobile-spellbook-header, .wizlords-mobile-spellbook-collapse')
			.attr('aria-expanded', isOpen ? 'false' : 'true');
	}

	function toggleMobileServantRulesCard(card) {
		if (!spellbookQuery.matches) {
			return;
		}

		var $card = $(card);
		var isOpen = $card.hasClass('is-open');

		$card
			.toggleClass('is-open', !isOpen)
			.attr('aria-expanded', isOpen ? 'false' : 'true');
	}

	$(initialiseMobileSpellCards);

	if (spellbookQuery.addEventListener) {
		spellbookQuery.addEventListener('change', initialiseMobileSpellCards);
	} else if (spellbookQuery.addListener) {
		spellbookQuery.addListener(initialiseMobileSpellCards);
	}

	$(document).on('click', '.wizlords-mobile-spell-card', function (event) {
		if ($(event.target).closest('a').length) {
			return;
		}

		toggleMobileSpellCard(this);
	});

	$(document).on('click', '.wizlords-mobile-servant-rules-card', function (event) {
		if ($(event.target).closest('a').length) {
			return;
		}

		toggleMobileServantRulesCard(this);
	});

	$(document).on('click', '.wizlords-mobile-spellbook-header', function () {
		toggleMobileSpellbook(this);
	});

	$(document).on('click', '.wizlords-mobile-spellbook-collapse', function () {
		toggleMobileSpellbook($(this).closest('.wizlords-mobile-spellbook').children('.wizlords-mobile-spellbook-header').first());
	});

	$(document).on('keydown', '.wizlords-mobile-spell-card', function (event) {
		if (event.key === 'Enter' || event.key === ' ') {
			event.preventDefault();
			toggleMobileSpellCard(this);
		}
	});

	$(document).on('keydown', '.wizlords-mobile-servant-rules-card', function (event) {
		if (event.key === 'Enter' || event.key === ' ') {
			event.preventDefault();
			toggleMobileServantRulesCard(this);
		}
	});

	$(document).on('keydown', '.wizlords-mobile-spellbook-header', function (event) {
		if (event.key === 'Enter' || event.key === ' ') {
			event.preventDefault();
			toggleMobileSpellbook(this);
		}
	});

	$(document).on('keydown', '.wizlords-mobile-spellbook-collapse', function (event) {
		if (event.key === 'Enter' || event.key === ' ') {
			event.preventDefault();
			toggleMobileSpellbook($(this).closest('.wizlords-mobile-spellbook').children('.wizlords-mobile-spellbook-header').first());
		}
	});
}() );