MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

// __NOWYSIWYG__ /** * Countdown * * @version 2.1 * * @author Pecoes  * @author Asaba  * * Version 1 authors: * - Splarka  * - Eladkse  * * documentation and examples at: *  */ /*jshint jquery:true, browser:true, devel:true, camelcase:true, curly:false, undef:true, bitwise:true, eqeqeq:true, forin:true, immed:true, latedef:true, newcap:true, noarg:true, unused:true, regexp:true, strict:true, trailing:false */ /*global mediaWiki:true*/ 'use strict'; var translations = $.extend(true, {		// Language list - start		// Arabic (العربية)		ar: {			and: 'و',			second: 'ثانية',			seconds: 'ثواني',			minute: 'دقيقة',			minutes: 'دقائق',			hour: 'ساعة',			hours: 'ساعات',			day: 'يوم',			days: 'أيام'		},		// Belarusian (Беларуская)		be: {			and: 'і',			second: 'секунда',			seconds: 'секунд',			minute: 'хвіліна',			minutes: 'хвілін',			hour: 'гадзіну',			hours: 'гадзін',			day: 'дзень',			days: 'дзён'		},		// Catalan (Català)		ca: {			and: 'i',			second: 'segon',			seconds: 'segons',			minute: 'minut',			minutes: 'minuts',			hour: 'hora',			hours: 'hores',			day: 'dia',			days: 'dies'		},		// German (Deutsch)		de: {			and: 'und',			second: 'Sekunde',			seconds: 'Sekunden',			minute: 'Minute',			minutes: 'Minuten',			hour: 'Stunde',			hours: 'Stunden',			day: 'Tag',			days: 'Tage'		},		// English (English)		en: {			and: 'and',			second: 'second', seconds: 'seconds', minute: 'minute', minutes: 'minutes', hour: 'hour', hours: 'hours', day: 'day', days: 'days' },		// Greek (Ελληνικά) el: { and: 'και', second: 'δευτερόλεπτο', seconds: 'δευτερόλεπτα', minute: 'λεπτό', minutes: 'λεπτά', hour: 'ώρα', hours: 'ώρες', day: 'ημέρα', days: 'ημέρες' },		// Spanish (Español) es: { and: 'y', second: 'segundo', seconds: 'segundos', minute: 'minuto', minutes: 'minutos', hour: 'hora', hours: 'horas', day: 'día', days: 'días' },		// French (Français) fr: { and: 'et', second: 'seconde', seconds: 'secondes', minute: 'minute', minutes: 'minutes', hour: 'heure', hours: 'heures', day: 'jour', days: 'jours' },		//Hindi (हिंदी) hi: { and: 'और', second: 'सेकंड', seconds: 'सेकंड', minute: 'मिनट', minutes: 'मिनट', hour: 'घंटा', hours: 'घंटे', day: 'दिन', days: 'दिन' },		// Hungarian (Magyar) hu: { and: 'és', second: 'másodperc', seconds: 'másodperc', minute: 'perc', minutes: 'perc', hour: 'óra', hours: 'óra', day: 'nap', days: 'nap' },		// Indonesia (Bahasa Indonesia) id: { and: 'dan', second: 'detik', seconds: 'detik', minute: 'menit', minutes: 'menit', hour: 'jam', hours: 'jam', day: 'hari', days: 'hari' },		// Italian (Italiano) it: { and: 'e', second: 'secondo', seconds: 'secondi', minute: 'minuto', minutes: 'minuti', hour: 'ora', hours: 'ore', day: 'giorno', days: 'giorni' },		// Japanese (日本語) ja: { and: '', second: '秒', seconds: '秒', minute: '分', minutes: '分', hour: '時間', hours: '時間', day: '日', days: '日' },		// Korean (한국어) ko:{ and: ' ', second: '초', seconds: '초', minute: '분', minutes: '분', hour: '시간', hours: '시간', day: '일', days: '일' },		// Malay (Bahasa Melayu) ms: { and: 'dan', second: 'saat', seconds: 'saat', minute: 'minit', minutes: 'minit', hour: 'jam', hours: 'jam', day: 'hari', days: 'hari' },		// Dutch (Nederlands) nl: { and: 'en', second: 'seconde', seconds: 'seconden', minute: 'minuut', minutes: 'minuten', hour: 'uur', hours: 'uur', day: 'dag', days: 'dagen' },		// Polish (Polski) pl: { and: 'i', second: 'sekunda', seconds: 'sekund(y)', minute: 'minuta', minutes: 'minut(y)', hour: 'godzina', hours: 'godzin(y)', day: 'dzień', days: 'dni' },		// Portuguese (Português) pt: { and: 'e', second: 'segundo', seconds: 'segundos', minute: 'minuto', minutes: 'minutos', hour: 'hora', hours: 'horas', day: 'dia', days: 'dias' },		// Brazilian Portuguese (Português do Brasil) 'pt-br': { and: 'e', second: 'segundo', seconds: 'segundos', minute: 'minuto', minutes: 'minutos', hour: 'hora', hours: 'horas', day: 'dia', days: 'dias' },		// Romanian (Română) ro: { and: 'și', second: 'secundă', seconds: 'secunde', minute: 'minut', minutes: 'minute', hour: 'oră', hours: 'ore', day: 'zi', days: 'zile', },		// Russian (русский) ru: { and: 'и', second: 'секунда', seconds: 'секунд', minute: 'минута', minutes: 'минут', hour: 'час', hours: 'часов', day: 'день', days: 'дней' },		// Serbian (српски језик) sr: { and: 'i', second: 'sekundu', seconds: 'sekunde/-i', minute: 'minutu', minutes: 'minute/-a', hour: 'sat', hours: 'sata/-i', day: 'dan', days: 'dana' },		// Tagalog tl: { and: 'at', second: 'segundo', seconds: 'mga segundo', minute: 'minuto', minutes: 'mga minuto', hour: 'oras', hours: 'mga oras', day: 'araw', days: 'mga araw' },		// Turkish (Türkçe) tr: { and: 've', second: 'saniye', seconds: 'saniye', minute: 'dakika', minutes: 'dakika', hour: 'saat', hours: 'saat', day: 'gün', days: 'gün' },		// Ukrainian (Українська) uk: { and: 'та', second: 'секунда', seconds: 'секунд', minute: 'хвилина', minutes: 'хвилин', hour: 'годину', hours: 'годин', day: 'день', days: 'днів' },		// Vietnamese (Tiếng Việt) vi: { and: 'và', second: 'giây', seconds: 'giây', minute: 'phút', minutes: 'phút', hour: 'giờ', hours: 'giờ', day: 'ngày', days: 'ngày' },		// Chinese (简体中文) zh: { and: ' ', second: '秒', seconds: '秒', minute: '分', minutes: '分', hour: '时', hours: '时', day: '天', days: '天' },		// Chinese (台湾繁體中文) 'zh-tw':{ and: ' ', second: '秒', seconds: '秒', minute: '分', minutes: '分', hour: '時', hours: '時', day: '天', days: '天' },		// Chinese (香港繁體中文) 'zh-hk':{ and: ' ', second: '秒', seconds: '秒', minute: '分', minutes: '分', hour: '時', hours: '時', day: '天', days: '天' }		// Language list - stop }, module.translations || {}),	i18n = translations[		mw.config.get('wgContentLanguage')	] || translations.en;	var countdowns = [];	var NO_LEADING_ZEROS = 1,	SHORT_FORMAT = 2,	NO_ZEROS = 4;	function output (i, diff) {		/*jshint bitwise:false*/		var delta, result, parts = [];		delta = diff % 60;		result = ' ' + i18n[delta === 1 ? 'second' : 'seconds'];		if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1);		parts.unshift(delta + result);		diff = Math.floor(diff / 60);		delta = diff % 60;		result = ' ' + i18n[delta === 1 ? 'minute' : 'minutes'];		if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1);		parts.unshift(delta + result);		diff = Math.floor(diff / 60);		delta = diff % 24;		result = ' ' + i18n[delta === 1 ? 'hour'  : 'hours'  ];		if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1);		parts.unshift(delta + result);		diff = Math.floor(diff / 24); result = ' ' + i18n[diff === 1 ? 'day'   : 'days'   ]; if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1); parts.unshift(diff + result); result = parts.pop; if (countdowns[i].opts & NO_LEADING_ZEROS) { while (parts.length && parts[0][0] === '0') { parts.shift; }		}		if (countdowns[i].opts & NO_ZEROS) { parts = parts.filter(function(part) {				return part[0] !== '0';			}); }		if (parts.length) { if (countdowns[i].opts & SHORT_FORMAT) { result = parts.join(' ') + ' ' + result; } else { result = parts.join(', ') + ' ' + i18n.and + ' ' + result; }		}		countdowns[i].node.text(result); }	function end(i) { var c = countdowns[i].node.parent; switch (c.attr('data-end')) { case 'remove': c.remove; return true; case 'stop': output(i, 0); return true; case 'toggle': var toggle = c.attr('data-toggle'); if (toggle && toggle == 'next') { c.next.css('display', 'inline'); c.css('display', 'none'); return true; }			if (toggle && $(toggle).length) { $(toggle).css('display', 'inline'); c.css('display', 'none'); return true; }			break; case 'callback': var callback = c.attr('data-callback'); if (callback && $.isFunction(module[callback])) { output(i, 0); module[callback].call(c); return true; }			break; }		countdowns[i].countup = true; output(i, 0); return false; }	function update { var now = Date.now; var countdownsToRemove = []; $.each(countdowns.slice(0), function (i, countdown) {			var diff = Math.floor((countdown.date - now) / 1000);			if (diff <= 0 && !countdown.countup) {				if (end(i)) countdownsToRemove.push(i);			} else {				output(i, Math.abs(diff));			}		}); var x;		while((x = countdownsToRemove.pop) !== undefined) { countdowns.splice(x, 1); }		if (countdowns.length) { window.setTimeout(function {				update;			}, 1000); }	}	function getOptions (node) { /*jshint bitwise:false*/ var text = node.parent.attr('data-options'), opts = 0; if (text) { if (/no-leading-zeros/.test(text)) { opts |= NO_LEADING_ZEROS; }			if (/short-format/.test(text)) { opts |= SHORT_FORMAT; }			if (/no-zeros/.test(text)) { opts |= NO_ZEROS; }		}		return opts; }	function init { var countdown = $('.countdown:not(.handled)'); if (!countdown.length) return; $('.nocountdown').css('display', 'none'); countdown .css('display', 'inline') .find('.countdowndate') .each(function {			var $this = $(this),				date = (new Date($this.text)).valueOf;			if (isNaN(date)) {				$this.text('BAD DATE');				return;			}			countdowns.push({ node: $this, opts: getOptions($this), date: date, });		});		countdown.addClass('handled'); if (countdowns.length) { update; }	}	mw.hook('wikipage.content').add(init); }(window.countdownTimer = window.countdownTimer || {}, mediaWiki, jQuery));
 * (function (module, mw, $, undefined) {

// End Countdown

$(document).ready(function {		//OOUI-based tabber		mw.hook( "wikipage.content" ).add( function ($content) { var $tabberElements = $content.find( ".no-history-tabber" ); if ($tabberElements.length > 0) { //Only load the modules and run the Javascript if there is a fehwiki-tabber in the page. mw.loader.using("oojs-ui-widgets").then(function {					var TABBER_HEADER_CLASS = "no-history-tab-header";					var TABBER_HEADER_CLASS_SELECTOR = "."+TABBER_HEADER_CLASS;					var CSS_END_REGEX = /;\s*$/;					var uniqueNumber = 0;					var INDEX_LAYOUT_OPTIONS = {						expanded: false,						autoFocus: false					};					$tabberElements.each( function(_, ele) { var tabPanelLayouts = []; var $rootTabberElement; var indexLayout = new OO.ui.IndexLayout(INDEX_LAYOUT_OPTIONS); $( ele ).children( TABBER_HEADER_CLASS_SELECTOR ).each( function (_, tabHeaderEle) {							var contents = [];							$( tabHeaderEle ).nextUntil( TABBER_HEADER_CLASS_SELECTOR ).each( function(_, node) { contents.push(node); } );							tabPanelLayouts.push(new OO.ui.TabPanelLayout(tabHeaderEle.textContent + uniqueNumber++, {								expanded: false,								label: new OO.ui.HtmlSnippet(tabHeaderEle.innerHTML),								content: contents							}));						} ); indexLayout.addTabPanels(tabPanelLayouts); if ($(ele).attr("data-tab-default") !== undefined) { const activeTabIdx = parseInt($(ele).attr("data-tab-default")) - 1; if (!isNaN(activeTabIdx) && activeTabIdx >= 0 && activeTabIdx < tabPanelLayouts.length) { indexLayout.setTabPanel(tabPanelLayouts[activeTabIdx].name); }						}						$rootTabberElement = (new OO.ui.PanelLayout( { expanded: false, content: [ indexLayout ] })).$element; //If it has one, adds the inline style the fehwiki-tabber div element has to the new tabber element $rootTabberElement.attr( "style", function(_, attr) {							var s = $( ele ).attr( "style" );							return attr ? s + (CSS_END_REGEX.test(attr) ? "" : ";") + attr : s;						} ); $( ele ).replaceWith( $rootTabberElement ); });				});			}		} );		//End tabber	}); /*     function filter(list, filter) { if (!filter.length) { return list; }
 * (function(mw, $) {

return list.filter(function(x) {                 var entry = $(list[x]).get(0);                          return filter.find(function(y) { var filterEntry = $(y).get(0); if (filterEntry.dataset.key === "rarity" || filterEntry.dataset.key === "role" || filterEntry.dataset.key === "pain" || filterEntry.dataset.key === "poison" || filterEntry.dataset.key === "crit" || filterEntry.dataset.key === "rage" || filterEntry.dataset.key === "element" || filterEntry.dataset.key === "buff" || filterEntry.dataset.key === "debuff" || filterEntry.dataset.key === "type") { return (String(entry.dataset[filterEntry.dataset.key]).toLowerCase.indexOf(String(filterEntry.dataset.value).toLowerCase) >= 0); }               return String(filterEntry.dataset.value).toLowerCase === String(entry.dataset[filterEntry.dataset.key]).toLowerCase; });           });      }      function filterText(list, text, cellNum) { if (!filter.length) { return list; }

for (var i = 0; i < list.length; i++) { // Get the skill information from the data attributes var cell = list[i].cells[cellNum].innerHTML; // Check skill name var matchesName = (cell.toUpperCase.indexOf(text) > -1); // If it matches all the filter / selects, then display the characters. // Otherwise, hide the characters. if (matchesName) { list[i].style.display = ""; } else { list[i].style.display = "none"; }           }      }

function updateFilters { var rarityFilters = $('.filter-group-rarity > .mw-ui-button.mw-ui-progressive').toArray; var weaponFilters = $('.filter-group-weapon > .mw-ui-button.mw-ui-progressive').toArray; var elementFilters = $('.filter-group-element > .mw-ui-button.mw-ui-progressive').toArray; var accessoryFilters = $('.filter-group-accessory > .mw-ui-button.mw-ui-progressive').toArray; var personalityFilters = $('.filter-group-personality > .mw-ui-button.mw-ui-progressive').toArray; var typeFilters = $('.filter-group-type > .mw-ui-button.mw-ui-progressive').toArray; var roleFilters = $('.filter-group-role > .mw-ui-button.mw-ui-progressive').toArray; var freeFilters = $('.filter-group-free > .mw-ui-button.mw-ui-progressive').toArray; var painFilters = $('.filter-group-pain > .mw-ui-button.mw-ui-progressive').toArray; var poisonFilters = $('.filter-group-poison > .mw-ui-button.mw-ui-progressive').toArray; var rageFilters = $('.filter-group-rage > .mw-ui-button.mw-ui-progressive').toArray; var critFilters = $('.filter-group-crit > .mw-ui-button.mw-ui-progressive').toArray; var buffFilters = $('.filter-group-buff > .mw-ui-button.mw-ui-progressive').toArray; var debuffFilters = $('.filter-group-debuff > .mw-ui-button.mw-ui-progressive').toArray; var typeFilters = $('.filter-group-type > .mw-ui-button.mw-ui-progressive').toArray;

var characterList = $('.character-row-entry'); var charaText = document.getElementById("chara-text").value.toUpperCase; characterList.each(function {                 this.style.display = 'none';            });

var filteredList = characterList; filteredList = filter(filteredList, rarityFilters); filteredList = filter(filteredList, weaponFilters); filteredList = filter(filteredList, elementFilters); filteredList = filter(filteredList, accessoryFilters); filteredList = filter(filteredList, personalityFilters); filteredList = filter(filteredList, typeFilters); filteredList = filter(filteredList, roleFilters); filteredList = filter(filteredList, freeFilters); filteredList = filter(filteredList, painFilters); filteredList = filter(filteredList, poisonFilters); filteredList = filter(filteredList, rageFilters); filteredList = filter(filteredList, critFilters); filteredList = filter(filteredList, buffFilters); filteredList = filter(filteredList, debuffFilters); filteredList = filter(filteredList, typeFilters);

filteredList.each(function {                 this.style.display = '';            }); filterText(filteredList, charaText, 1); }     function updateMatFilters { var typeFilters = $('.filter-group-type > .mw-ui-button.mw-ui-progressive').toArray; var matList = $('.material-row-entry');

matList.each(function {                 this.style.display = 'none';            });

var filteredList = matList; filteredList = filter(filteredList, typeFilters); filteredList.each(function {                 this.style.display = '';            }); }     function updateEquipFilters(cell) { var weaponFilters = $('.filter-group-weapon > .mw-ui-button.mw-ui-progressive').toArray; var accessoryFilters = $('.filter-group-accessory > .mw-ui-button.mw-ui-progressive').toArray; var equipList = $('.equip-row-entry'); var equipText = document.getElementById("equip-text").value.toUpperCase;

equipList.each(function {                 this.style.display = 'none';            });

var filteredList = equipList; filteredList = filter(filteredList, weaponFilters); filteredList = filter(filteredList, accessoryFilters); filteredList.each(function {                 this.style.display = '';            }); filterText(filteredList, equipText, cell); }     function updateArmorFilters(cell) { console.log(cell); var weaponFilters = $('.filter-group-weapon > .mw-ui-button.mw-ui-progressive').toArray; var accessoryFilters = $('.filter-group-accessory > .mw-ui-button.mw-ui-progressive').toArray; var equipList = $('.equip-row-entry'); var equipText = document.getElementById("armor-text").value.toUpperCase;

equipList.each(function {                 this.style.display = 'none';            });

var filteredList = equipList; filteredList = filter(filteredList, weaponFilters); filteredList = filter(filteredList, accessoryFilters); filteredList.each(function {                 this.style.display = '';            }); filterText(filteredList, equipText, cell); } $(document).ready(function {	/*   $('.character-filters label').on('click', function(event) { $(event.target).toggleClass('mw-ui-progressive'); updateFilters; });

$('.material-filters label').on('click', function(event) {       $(event.target).toggleClass('mw-ui-progressive');        updateMatFilters;    }); $('.equip-filters label').on('click', function(event) {       $(event.target).toggleClass('mw-ui-progressive');        updateEquipFilters(2);    }); $('.armor-filters label').on('click', function(event) {       $(event.target).toggleClass('mw-ui-progressive');        updateArmorFilters(1);    });

$('#chara-text').on('keyup', function(event) {       updateFilters;    }); $('#equip-text').on('keyup', function(event) {       updateEquipFilters(2);    }); $('#armor-text').on('keyup', function(event) {       updateArmorFilters(1);    }); */   $(".event-dialogue > p").each(function {        var wrapper = $(' ')        var text = $(this).text.trim;        var img = $(this).find("a:first-child");        var imgWrapper = $(' ');        var textWrapper = $(' ');

textWrapper.text(text); imgWrapper.append(img); wrapper.append(imgWrapper); wrapper.append(textWrapper);

$(this).parent.append(wrapper); $(this).remove; });   //start of font size toggle for story    $("#smallText").click(function { $(".event-dialogue").css("font-size", "0.875em"); });   $("#mediumText").click(function { $(".event-dialogue").css("font-size", "1.125em"); });   $("#largeText").click(function { $(".event-dialogue").css("font-size", "1.875em"); });   //assign custom sidebar collapsible classes    $("#site-navigation > .sidebar-inner > div > h3").addClass("sidebar-collapsible");	$("#site-navigation > .sidebar-inner > div > div.mw-portlet-body").addClass("sidebar-collapsible-content");	$("#site-navigation > .sidebar-inner").html("Expand All " + $("#site-navigation > .sidebar-inner").html)	//hide content except for the ones specified as expanded	var expandedContentTitles = ['Navigation', 'Building', 'Pets', 'Other'];	$(".sidebar-collapsible-content").each(function { if (!expandedContentTitles.includes(this.previousSibling.textContent)) { $(this.previousSibling).css("background-image", "url('https://upload.wikimedia.org/wikipedia/commons/b/bc/Vector_right_arrow_link.png')"); this.style.display = "none"; } else { $(this.previousSibling).css("background-image", "url('https://upload.wikimedia.org/wikipedia/commons/2/27/Vector_down_arrow_link.png')"); }	});

// on section title click, show/hide contents and toggle between cute little right/down arrow $(".sidebar-collapsible").click(function {		if(this.nextSibling.style.display != "none") {			this.nextSibling.style.display = "none";			$(this).css("background-image", "url('https://upload.wikimedia.org/wikipedia/commons/b/bc/Vector_right_arrow_link.png')");		} else {			this.nextSibling.style.display = "";			$(this).css("background-image", "url('https://upload.wikimedia.org/wikipedia/commons/2/27/Vector_down_arrow_link.png')");		}	}); $("#sidebar-collapsible-toggle").click(function {		if($("#sidebar-collapsible-toggle").text == "Expand All") {			$(".sidebar-collapsible-content").css('display', '');			$("#sidebar-collapsible-toggle").text("Close All");			$(".sidebar-collapsible").css("background-image", "url('https://upload.wikimedia.org/wikipedia/commons/2/27/Vector_down_arrow_link.png')");		} else {			$(".sidebar-collapsible-content").css('display', 'none');			$("#sidebar-collapsible-toggle").text("Expand All");			$(".sidebar-collapsible").css("background-image", "url('https://upload.wikimedia.org/wikipedia/commons/b/bc/Vector_right_arrow_link.png')");		}	}); });

})(mediaWiki, jQuery);

/** Tabs Extension JS **/ jQuery(function($) {     /**       * Imitates the normal feature in browsers to scroll to an id that has the same id as the url fragment/hash.       * This makes it unnecessary to use actual ids on the tabs, which could cause the same id to occur twice in the same document.       * Does not scroll to exactly the tab's height, but just a bit above it.       */      function moveToHash {            var hash = location.hash.substr(1).replace(/_/g,' ').trim;            if (!hash || $(location.hash).length) {                  return; // if there's no hash defined, or an element on the page with the same hash already, stop looking for tabs            }            $('.tabs-tabbox .tabs-label:contains('+hash+')').each(function { // double-check if the hash is indeed exactly the same as the label. // Does not match if hash is only a part of the label's contents, unlike jQuery's :contains selector if (this.innerHTML.trim !== hash) { return true; // continue the $.each function }                 this.click; // open the selected tab by default. window.scrollTo(0, $(this).offset.top); return false; // stop the $.each function after the first match. });     }

// Credit for this testing method: 2astalavista @ http://stackoverflow.com/a/21095568/1256925 // The font will be sans-serif if the :not property is supported. The margin will be 1px if the sibling selector is supported. if ($('#tabs-inputform').css('font-family').replace(/["']/g,'') === 'sans-serif' && $('#tabs-inputform').css('margin') === '1px') {           $(function {                  $('body').addClass('tabs-oldbrowserscript'); // Make the unselected tabs hide when the browser loads this script                  $('.tabs-label').click(function(e) {                        $('#'+$(this).attr('for')).click; e.preventDefault;                        return false;                  });                  $('.tabs-input').each(function {                        if (this.checked) {                              $(this).addClass('checked'); // Adds checked class to each checked box                        }                  }).change(function {                        if (!this.checked) {                              return $(this).removeClass('checked'); // for toggleboxes                        } $(this).siblings('.checked').removeClass('checked'); // Uncheck all currently checked siblings $(this).addClass('checked'); // and do check this box $(this).parents('.tabs').toggleClass('tabs').toggleClass('tabs'); // remove and readd class to recalculate styles for its children. // Credit: Fabrício Matté @ http://stackoverflow.com/a/21122724/1256925 });                 moveToHash;            }); } else { $(moveToHash); }     addEventListener('hashchange', moveToHash);

/*      * System to fix toggle boxes in Android Browser * Browser detection based on http://stackoverflow.com/a/15591516/1256925 * Idea for the use of and based on http://stackoverflow.com/q/21357641/1256925 */     var nua = navigator.userAgent; var isAndroid = (nua.indexOf('Mozilla/5.0') > -1 && nua.indexOf('Android ') > -1 && nua.indexOf('AppleWebKit') > -1 && nua.indexOf('Chrome') === -1); function replaces { //General replacement function for both tags var tagName = $(this).is('.tabs-container') ? 'details' : 'summary'; //determine the required tag name var $newNode = $('<'+tagName+'/>').html($(this).html); for (var i=0;i<this.attributes.length;i++) { //copy all attributes from the original element if (this.attributes[i].nodeName === 'for') { continue; //don't copy the label's for="" attribute, since it's not needed here. }                 $newNode.attr(this.attributes[i].nodeName, this.attributes[i].value); }           return $newNode; }     if (isAndroid) { $('.tabs-togglebox .tabs-container').not('.tabs-dropdown .tabs-container').replaceWith(replaces); //do not select dropdowns, which already work in Android $('.tabs-togglebox .tabs-label').not('.tabs-dropdown .tabs-label').each(function {                 if ($(this).prevAll('input').prop('checked')) { //preserve open state of the toggle box                        $(this).parents('details').prop('open', true);                  }            }).replaceWith(replaces); //Run this *after* the .tabs-container has finished, otherwise all .tabs-label elements will be skipped. }

.client-dark-mode, .mwe-math-fallback-image-inline { -webkit-filter: invert(1); filter: invert(1); } });