<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-switch-infobox-sandbox.js</id>
	<title>MediaWiki:Gadget-switch-infobox-sandbox.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-switch-infobox-sandbox.js"/>
	<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-switch-infobox-sandbox.js&amp;action=history"/>
	<updated>2026-05-16T07:42:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-switch-infobox-sandbox.js&amp;diff=42218&amp;oldid=prev</id>
		<title>Alex at 11:06, 20 October 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-switch-infobox-sandbox.js&amp;diff=42218&amp;oldid=prev"/>
		<updated>2024-10-20T11:06:22Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-switch-infobox-sandbox.js&amp;amp;diff=42218&amp;amp;oldid=39091&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-switch-infobox-sandbox.js&amp;diff=39091&amp;oldid=prev</id>
		<title>Alex at 16:15, 17 October 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-switch-infobox-sandbox.js&amp;diff=39091&amp;oldid=prev"/>
		<updated>2024-10-17T16:15:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:15, 17 October 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 763:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 763:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			return;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			return;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		}&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		// mirror rsw-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mw.&lt;/del&gt;util&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		// mirror rsw-util&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		try {&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		try {&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			localStorage.setItem(&#039;test&#039;, &#039;test&#039;);&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			localStorage.setItem(&#039;test&#039;, &#039;test&#039;);&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-34672:rev-39091:wikidiff2=table:1.13.0:bc2a06be --&gt;
&lt;/table&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-switch-infobox-sandbox.js&amp;diff=34672&amp;oldid=prev</id>
		<title>Alex at 23:10, 16 October 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-switch-infobox-sandbox.js&amp;diff=34672&amp;oldid=prev"/>
		<updated>2024-10-16T23:10:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:10, 17 October 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 763:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 763:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			return;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			return;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		}&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		// mirror rsw-util&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		// mirror rsw-&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mw.&lt;/ins&gt;util&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		try {&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		try {&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			localStorage.setItem(&#039;test&#039;, &#039;test&#039;);&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			localStorage.setItem(&#039;test&#039;, &#039;test&#039;);&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-942:rev-34672:wikidiff2=table:1.13.0:bc2a06be --&gt;
&lt;/table&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-switch-infobox-sandbox.js&amp;diff=942&amp;oldid=prev</id>
		<title>Alex: Created page with &quot;/* switch infobox code for infoboxes  * contains switching code for both:  * * originalInfoboxes:  *		older infobox switching, such as Template:Infobox Bonuses  *		which works my generating complete infoboxes for each version  * * moduleInfoboxes:  *		newer switching, as implemented by Module:Infobox  *		which generates one infobox and a resources pool for switching  * * synced switches  *		as generated by Module:Synced switch and its template  *   * The scri...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-switch-infobox-sandbox.js&amp;diff=942&amp;oldid=prev"/>
		<updated>2024-10-13T01:08:31Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;/* switch infobox code for infoboxes  * contains switching code for both:  * * originalInfoboxes:  *		older infobox switching, such as &lt;a href=&quot;/w/Template:Infobox_Bonuses&quot; title=&quot;Template:Infobox Bonuses&quot;&gt;Template:Infobox Bonuses&lt;/a&gt;  *		which works my generating complete infoboxes for each version  * * moduleInfoboxes:  *		newer switching, as implemented by &lt;a href=&quot;/w/Module:Infobox&quot; title=&quot;Module:Infobox&quot;&gt;Module:Infobox&lt;/a&gt;  *		which generates one infobox and a resources pool for switching  * * synced switches  *		as generated by &lt;a href=&quot;/w/Module:Synced_switch&quot; title=&quot;Module:Synced switch&quot;&gt;Module:Synced switch&lt;/a&gt; and its template  *   * The scri...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;/* switch infobox code for infoboxes&lt;br /&gt;
 * contains switching code for both:&lt;br /&gt;
 * * originalInfoboxes:&lt;br /&gt;
 *		older infobox switching, such as [[Template:Infobox Bonuses]]&lt;br /&gt;
 *		which works my generating complete infoboxes for each version&lt;br /&gt;
 * * moduleInfoboxes:&lt;br /&gt;
 *		newer switching, as implemented by [[Module:Infobox]]&lt;br /&gt;
 *		which generates one infobox and a resources pool for switching&lt;br /&gt;
 * * synced switches&lt;br /&gt;
 *		as generated by [[Module:Synced switch]] and its template&lt;br /&gt;
 * &lt;br /&gt;
 * The script also facilitates synchronising infoboxes, so that if a button of one is pressed&lt;br /&gt;
 *	and another switchfobox on the same page also has that button, it will &amp;#039;press&amp;#039; itself&lt;br /&gt;
 * This only activates if there are matching version parameters in the infoboxes (i.e. the button text is the same)&lt;br /&gt;
 * - thus it works best if the version parameters are all identical&lt;br /&gt;
 * &lt;br /&gt;
 * TODO: OOUI? (probably not, its a little clunky and large for this. It&amp;#039;d need so much styling it isn&amp;#039;t worthwhile)&lt;br /&gt;
 */&lt;br /&gt;
$(function () {&lt;br /&gt;
	var SWITCH_REF_REGEX = /^\$(\d+)/,&lt;br /&gt;
		CAN_LOCAL_STORAGE = true;&lt;br /&gt;
	function getGenderFromLS() {&lt;br /&gt;
		if (CAN_LOCAL_STORAGE) {&lt;br /&gt;
			var x = window.localStorage.getItem(&amp;#039;gender-render&amp;#039;);&lt;br /&gt;
			if ([&amp;#039;m&amp;#039;, &amp;#039;f&amp;#039;].indexOf(x) &amp;gt; -1) {&lt;br /&gt;
				return x;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		return &amp;#039;m&amp;#039;;&lt;br /&gt;
	}&lt;br /&gt;
	/**&lt;br /&gt;
	 * Switch infobox psuedo-interface&lt;br /&gt;
	 * &lt;br /&gt;
	 * Switch infoboxes are given several similar functions so that they can be called similarly&lt;br /&gt;
	 * This is essentially like an interface or class structure, except I&amp;#039;m too lazy to implement that&lt;br /&gt;
	 * &lt;br /&gt;
	 * 		switchfo.beginSwitchEvent(event)&lt;br /&gt;
	 * 			the reactionary event to buttons being clicked/selects being selected/etc&lt;br /&gt;
	 * 			tells SwitchEventManager to switch all the boxes&lt;br /&gt;
	 * 			should extract an index and anchor from the currentTarget and pass that to the SwitchEventManager.trigger function&lt;br /&gt;
	 * 			event		the jQuery event fired from $.click/$.change/etc&lt;br /&gt;
	 * &lt;br /&gt;
	 * 		switchfo.switch(index, anchor)&lt;br /&gt;
	 * 			do all the actual switching of the infobox to the infobox specified by the anchor and index&lt;br /&gt;
	 * 			prefer using the anchor if there is a conflict&lt;br /&gt;
	 * &lt;br /&gt;
	 * 		switchfo.defaultVer()&lt;br /&gt;
	 * 			called during script init&lt;br /&gt;
	 * 			returns either an anchor for the default version, if manually specified, or false if there is no default specified&lt;br /&gt;
	 * 			the page will automatically switch to the default version, or to version 1, when loaded.&lt;br /&gt;
	 * &lt;br /&gt;
	 */&lt;br /&gt;
	/** &lt;br /&gt;
	 * Switch Infoboxes based on [[Module:Infobox]]&lt;br /&gt;
	 * &lt;br /&gt;
	 * - the preferred way to do switch infoboxes&lt;br /&gt;
	 * - generates one table and a resources table, swaps resources into the table as required&lt;br /&gt;
	 * - with enough buttons, becomes a dropdown &amp;lt;select&amp;gt;&lt;br /&gt;
	 * &lt;br /&gt;
	 * parameters&lt;br /&gt;
	 *	  $box	jQuery object representing the infobox itself (.infobox-switch)&lt;br /&gt;
	 *	  index   index of this infobox, from $.each&lt;br /&gt;
	 */&lt;br /&gt;
	function SwitchInfobox($box, index, version_index_offset) {&lt;br /&gt;
		var self = this;&lt;br /&gt;
		this.index = index;&lt;br /&gt;
		this.version_index_offset = version_index_offset;&lt;br /&gt;
		this.$infobox = $box;&lt;br /&gt;
		this.$infobox.data(&amp;#039;SwitchInfobox&amp;#039;, self);&lt;br /&gt;
		this.$resources = self.$infobox.next();&lt;br /&gt;
		this.$buttons = self.$infobox.find(&amp;#039;div.infobox-buttons&amp;#039;);&lt;br /&gt;
		this.version_count = this.$buttons.find(&amp;#039;span.button&amp;#039;).length;&lt;br /&gt;
		this.isSelect = self.$buttons.hasClass(&amp;#039;infobox-buttons-select&amp;#039;);&lt;br /&gt;
		this.$select = null;&lt;br /&gt;
		this.originalClasses = {};&lt;br /&gt;
&lt;br /&gt;
		/* click/change event - triggers switch event manager */&lt;br /&gt;
		this.beginSwitchEvent = function(e) {&lt;br /&gt;
			var $tgt = $(e.currentTarget);&lt;br /&gt;
			mw.log(&amp;#039;beginSwitchEvent triggered in module infobox, id &amp;#039;+self.index);&lt;br /&gt;
			if (self.isSelect) {&lt;br /&gt;
				window.switchEventManager.trigger($tgt.val(), $tgt.find(&amp;#039; &amp;gt; option[data-switch-index=&amp;#039;+$tgt.val()+&amp;#039;]&amp;#039;).attr(&amp;#039;data-switch-anchor&amp;#039;), self);&lt;br /&gt;
			} else {&lt;br /&gt;
				window.switchEventManager.trigger($tgt.attr(&amp;#039;data-switch-index&amp;#039;), $tgt.attr(&amp;#039;data-switch-anchor&amp;#039;), self);&lt;br /&gt;
			}&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
		/* switch event, triggered by manager */&lt;br /&gt;
		this.switchInfobox = function(index, text) {&lt;br /&gt;
			if (text === &amp;#039;@init@&amp;#039;) {&lt;br /&gt;
				text = self.$buttons.find(&amp;#039;[data-switch-index=&amp;quot;1&amp;quot;]&amp;#039;).attr(&amp;#039;data-switch-anchor&amp;#039;);&lt;br /&gt;
			}&lt;br /&gt;
			var ind, txt, $thisButton = self.$buttons.find(&amp;#039;[data-switch-anchor=&amp;quot;&amp;#039;+text+&amp;#039;&amp;quot;]&amp;#039;);&lt;br /&gt;
			mw.log(&amp;#039;switching module infobox, id &amp;#039;+self.index);&lt;br /&gt;
			// prefer text&lt;br /&gt;
			if ($thisButton.length) {&lt;br /&gt;
				txt = text;&lt;br /&gt;
				ind = $thisButton.attr(&amp;#039;data-switch-index&amp;#039;);&lt;br /&gt;
			} &lt;br /&gt;
			if (ind === undefined) {&lt;br /&gt;
				return;&lt;br /&gt;
				/*ind = index;&lt;br /&gt;
				$thisButton = self.$buttons.find(&amp;#039;[data-switch-index=&amp;quot;&amp;#039;+ind+&amp;#039;&amp;quot;]&amp;#039;);&lt;br /&gt;
				if ($thisButton.length) {&lt;br /&gt;
					txt = $thisButton.attr(&amp;#039;data-switch-anchor&amp;#039;);&lt;br /&gt;
				}*/&lt;br /&gt;
			}&lt;br /&gt;
			if (txt === undefined) {&lt;br /&gt;
				return;&lt;br /&gt;
			}&lt;br /&gt;
			if (self.isSelect) {&lt;br /&gt;
				self.$select.val(ind);&lt;br /&gt;
			} else {&lt;br /&gt;
				self.$buttons.find(&amp;#039;span.button&amp;#039;).removeClass(&amp;#039;button-selected&amp;#039;);&lt;br /&gt;
				$thisButton.addClass(&amp;#039;button-selected&amp;#039;);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			self.$infobox.find(&amp;#039;[data-attr-param][data-attr-param!=&amp;quot;&amp;quot;]&amp;#039;).each(function(i,e) {&lt;br /&gt;
				var $e = $(e),&lt;br /&gt;
					param = $e.attr(&amp;#039;data-attr-param&amp;#039;),&lt;br /&gt;
					$switches = self.$resources.find(&amp;#039;span[data-attr-param=&amp;quot;&amp;#039;+param+&amp;#039;&amp;quot;]&amp;#039;),&lt;br /&gt;
					m,&lt;br /&gt;
					$val,&lt;br /&gt;
					$classTgt;&lt;br /&gt;
				&lt;br /&gt;
				// check if we found some switch data&lt;br /&gt;
				if (!$switches.length) return;&lt;br /&gt;
&lt;br /&gt;
				// find value&lt;br /&gt;
				$val = $switches.find(&amp;#039;span[data-attr-index=&amp;quot;&amp;#039;+ind+&amp;#039;&amp;quot;]&amp;#039;);&lt;br /&gt;
				if (!$val.length) {&lt;br /&gt;
					// didn&amp;#039;t find it, use default value&lt;br /&gt;
					$val = $switches.find(&amp;#039;span[data-attr-index=&amp;quot;0&amp;quot;]&amp;#039;);&lt;br /&gt;
					if (!$val.length) return;&lt;br /&gt;
				}&lt;br /&gt;
				// switch references support - $2 -&amp;gt; use the value for index 2&lt;br /&gt;
				m = SWITCH_REF_REGEX.exec($val.html());&lt;br /&gt;
				if (m) { // m is null if no matches&lt;br /&gt;
					$val = $switches.find(&amp;#039;span[data-attr-index=&amp;quot;&amp;#039;+m[1]+&amp;#039;&amp;quot;]&amp;#039;); // m is [ entire match, capture ]&lt;br /&gt;
					if (!$val.length) {&lt;br /&gt;
						$val = $switches.find(&amp;#039;span[data-attr-index=&amp;quot;0&amp;quot;]&amp;#039;); // fallback again&lt;br /&gt;
						if (!$val.length) return;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
				$val = $val.clone(true,true);&lt;br /&gt;
				$e.empty().append($val.contents());&lt;br /&gt;
&lt;br /&gt;
				// class switching&lt;br /&gt;
				// find the thing we&amp;#039;re switching classes for&lt;br /&gt;
				if ($e.is(&amp;#039;td, th&amp;#039;)) {&lt;br /&gt;
					$classTgt = $e.parent(&amp;#039;tr&amp;#039;);&lt;br /&gt;
				} else {&lt;br /&gt;
					$classTgt = $e;&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// reset classes&lt;br /&gt;
				if (self.originalClasses.hasOwnProperty(param)) {&lt;br /&gt;
					$classTgt.attr(&amp;#039;class&amp;#039;, self.originalClasses[param]);&lt;br /&gt;
				} else {&lt;br /&gt;
					$classTgt.removeAttr(&amp;#039;class&amp;#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// change classes if needed&lt;br /&gt;
				if ($val.attr(&amp;#039;data-addclass&amp;#039;) !== undefined) {&lt;br /&gt;
					$classTgt.addClass($val.attr(&amp;#039;data-addclass&amp;#039;));&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
			// trigger complete event for inter-script functions&lt;br /&gt;
			self.$buttons.trigger(&amp;#039;switchinfoboxComplete&amp;#039;, {txt:txt, num:ind});&lt;br /&gt;
			//re-initialise quantity boxes, if any&lt;br /&gt;
			if (window.rswiki &amp;amp;&amp;amp; typeof(rswiki.initQtyBox) == &amp;#039;function&amp;#039;) {&lt;br /&gt;
				rswiki.initQtyBox(self.$infobox)&lt;br /&gt;
			}&lt;br /&gt;
			//console.log(this);&lt;br /&gt;
		};&lt;br /&gt;
		&lt;br /&gt;
		/* default version, return the anchor of the switchable if it exists */&lt;br /&gt;
		this.defaultVer = function () {&lt;br /&gt;
			var defver = self.$buttons.attr(&amp;#039;data-default-version&amp;#039;);&lt;br /&gt;
			if (defver !== undefined) {&lt;br /&gt;
				return { idx: defver, txt: self.$buttons.find(&amp;#039;[data-switch-index=&amp;quot;&amp;#039;+defver+&amp;#039;&amp;quot;]&amp;#039;).attr(&amp;#039;data-switch-anchor&amp;#039;) };&lt;br /&gt;
			}&lt;br /&gt;
			return false;&lt;br /&gt;
		};&lt;br /&gt;
		&lt;br /&gt;
		this.isParentOf = function ($triggerer) {&lt;br /&gt;
			return self.$infobox.find($triggerer).length &amp;gt; 0;&lt;br /&gt;
		};&lt;br /&gt;
		&lt;br /&gt;
		this.currentlyShowing = function(){&lt;br /&gt;
			if (self.isSelect) {&lt;br /&gt;
				var sel = self.$select.val();&lt;br /&gt;
				return {index: sel, text: self.$select.find(&amp;#039;option[value=&amp;quot;&amp;#039;+sel+&amp;#039;&amp;quot;]&amp;#039;).attr(&amp;#039;data-switch-anchor&amp;#039;)}&lt;br /&gt;
			} else {&lt;br /&gt;
				var buttn = self.$buttons.find(&amp;#039;.button-selected&amp;#039;);&lt;br /&gt;
				return {index: buttn.attr(&amp;#039;data-switch-index&amp;#039;), text: buttn.attr(&amp;#039;data-switch-anchor&amp;#039;)}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		/* init */&lt;br /&gt;
		mw.log(&amp;#039;setting up module infobox, id &amp;#039;+self.index);&lt;br /&gt;
		// setup original classes&lt;br /&gt;
		this.$infobox.find(&amp;#039;[data-attr-param][data-attr-param!=&amp;quot;&amp;quot;]&amp;#039;).each(function(i,e){&lt;br /&gt;
			var $e = $(e), $classElem = $e, clas;&lt;br /&gt;
			if ($e.is(&amp;#039;td, th&amp;#039;)) {&lt;br /&gt;
				$classElem = $e.parent(&amp;#039;tr&amp;#039;);&lt;br /&gt;
			}&lt;br /&gt;
			clas = $classElem.attr(&amp;#039;class&amp;#039;);&lt;br /&gt;
			if (typeof clas === &amp;#039;string&amp;#039;) {&lt;br /&gt;
				self.originalClasses[$e.attr(&amp;#039;data-attr-param&amp;#039;)] = clas;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// setup select/buttons and events&lt;br /&gt;
		if (self.isSelect) {&lt;br /&gt;
			self.$select = $(&amp;#039;&amp;lt;select&amp;gt;&amp;#039;)&lt;br /&gt;
				.attr({&lt;br /&gt;
					id: &amp;#039;infobox-select-&amp;#039; + self.index,&lt;br /&gt;
					name: &amp;#039;infobox-select-&amp;#039; + self.index,&lt;br /&gt;
				});&lt;br /&gt;
			self.$buttons.find(&amp;#039;span.button&amp;#039;).each(function(i, e){&lt;br /&gt;
				var $e = $(e);&lt;br /&gt;
				self.$select.append(&lt;br /&gt;
					$(&amp;#039;&amp;lt;option&amp;gt;&amp;#039;).attr({&lt;br /&gt;
						value: $e.attr(&amp;#039;data-switch-index&amp;#039;),&lt;br /&gt;
						&amp;#039;data-switch-index&amp;#039;: $e.attr(&amp;#039;data-switch-index&amp;#039;),&lt;br /&gt;
						&amp;#039;data-switch-anchor&amp;#039;: $e.attr(&amp;#039;data-switch-anchor&amp;#039;)&lt;br /&gt;
					}).text($e.text())&lt;br /&gt;
				);&lt;br /&gt;
			});&lt;br /&gt;
			self.$buttons.empty().append(self.$select);&lt;br /&gt;
			self.$select.change(self.beginSwitchEvent);&lt;br /&gt;
		} else {&lt;br /&gt;
			self.$buttons&lt;br /&gt;
				.attr({&lt;br /&gt;
					id: &amp;#039;infobox-buttons-&amp;#039;+self.index&lt;br /&gt;
				})&lt;br /&gt;
				.find(&amp;#039;span&amp;#039;).each(function(i,e) {&lt;br /&gt;
					$(e).click(self.beginSwitchEvent);&lt;br /&gt;
				});&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		self.$buttons.css(&amp;#039;display&amp;#039;, &amp;#039;flex&amp;#039;);&lt;br /&gt;
		self.switchInfobox(1, &amp;#039;@init@&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
		window.switchEventManager.addSwitchInfobox(this);&lt;br /&gt;
		if (this.$infobox.find(&amp;#039;.infobox-bonuses-image.render-m&amp;#039;).length === 1 &amp;amp;&amp;amp; this.$infobox.find(&amp;#039;.infobox-bonuses-image.render-f&amp;#039;).length === 1) {&lt;br /&gt;
			this.genderswitch = new GenderRenderSwitcher(this.$infobox, this.index);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	/**&lt;br /&gt;
	 * Special support for gender render switching in infobox bonuses (&amp;amp; synced switch)&lt;br /&gt;
	 * Currently specifically only supports male &amp;amp; female&lt;br /&gt;
	 * potential TODO: generalise?&lt;br /&gt;
	 * &lt;br /&gt;
	 * parameters&lt;br /&gt;
	 *	  $box	jQuery object representing the infobox itself (.infobox-switch)&lt;br /&gt;
	 */&lt;br /&gt;
	function GenderRenderSwitcher($box, index, version_index_offset) {&lt;br /&gt;
		var self = this;&lt;br /&gt;
		this.$box = $box;&lt;br /&gt;
		this.$box.data(&amp;#039;SwitchInfobox&amp;#039;, self);&lt;br /&gt;
		this.index = index;&lt;br /&gt;
		this.version_index_offset = version_index_offset;&lt;br /&gt;
		this.version_count = 2;&lt;br /&gt;
		this.$buttons = $(&amp;#039;&amp;lt;div&amp;gt;&amp;#039;).addClass(&amp;#039;infobox-buttons&amp;#039;).css(&amp;#039;display&amp;#039;, &amp;#039;flex&amp;#039;);&lt;br /&gt;
		this.button = {&lt;br /&gt;
			m: $(&amp;#039;&amp;lt;span&amp;gt;&amp;#039;).addClass(&amp;#039;button&amp;#039;).attr(&amp;#039;data-gender-render&amp;#039;, &amp;#039;m&amp;#039;).text(&amp;#039;Male&amp;#039;),&lt;br /&gt;
			f: $(&amp;#039;&amp;lt;span&amp;gt;&amp;#039;).addClass(&amp;#039;button&amp;#039;).attr(&amp;#039;data-gender-render&amp;#039;, &amp;#039;f&amp;#039;).text(&amp;#039;Female&amp;#039;)&lt;br /&gt;
		};&lt;br /&gt;
		this.$td = $(&amp;#039;&amp;lt;td&amp;gt;&amp;#039;);&lt;br /&gt;
		this.$td_inner = $(&amp;#039;&amp;lt;div class=&amp;quot;gender-render-inner&amp;quot;&amp;gt;&amp;#039;);&lt;br /&gt;
		this.visible_gender = &amp;#039;&amp;#039;;&lt;br /&gt;
		&lt;br /&gt;
		// from interface, we can just get the SyncedSwitches to switch&lt;br /&gt;
		this.beginSwitchEvent = function(event){&lt;br /&gt;
			var $e = $(event.currentTarget);&lt;br /&gt;
			var gen = $e.attr(&amp;#039;data-gender-render&amp;#039;);&lt;br /&gt;
			mw.log(&amp;#039;beginSwitchEvent for genderswitcher &amp;#039;+self.index+&amp;#039; - switching to &amp;#039;+gen);&lt;br /&gt;
			window.switchEventManager.triggerGenderRenderSwitch(gen);&lt;br /&gt;
			if (CAN_LOCAL_STORAGE) {&lt;br /&gt;
				window.localStorage.setItem(&amp;#039;gender-render&amp;#039;, gen);&lt;br /&gt;
			}&lt;br /&gt;
		};&lt;br /&gt;
		// do the actual switching&lt;br /&gt;
		this.genderSwitch = function(gender) {&lt;br /&gt;
			mw.log(&amp;#039;switching gender for genderswitcher for &amp;#039;+self.index+&amp;#039; to &amp;#039;+gender);&lt;br /&gt;
			self.$buttons.find(&amp;#039;.button-selected&amp;#039;).removeClass(&amp;#039;button-selected&amp;#039;);&lt;br /&gt;
			self.button[gender].addClass(&amp;#039;button-selected&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
			var x = self.$box.find(&amp;#039;.infobox-bonuses-image.render-&amp;#039;+gender+&amp;#039;&amp;#039;);&lt;br /&gt;
			self.$td_inner.empty().append(x.find(&amp;#039;&amp;gt;*&amp;#039;).clone());&lt;br /&gt;
			self.visible_gender = gender;&lt;br /&gt;
		};&lt;br /&gt;
		this.refreshImage = function(index,anchor) {&lt;br /&gt;
			// for when a main infobox switch happens&lt;br /&gt;
			// this is a post-switch function so the new images are in the original cells&lt;br /&gt;
			// we just gotta clone them into the visible cell again&lt;br /&gt;
			self.genderSwitch(self.visible_gender);&lt;br /&gt;
			mw.log(&amp;#039;refreshed image for genderswitcher &amp;#039;+self.index);&lt;br /&gt;
		};&lt;br /&gt;
		this.currentlyShowing = function(){&lt;br /&gt;
			return {index: -1, text: self.visible_gender}&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// other &amp;#039;interface&amp;#039; methods just so stuff doesn&amp;#039;t break, just in case&lt;br /&gt;
		this.switchInfobox = function(ind,anchor){/* do nothing */};&lt;br /&gt;
		this.defaultVer = function(){ return false; };&lt;br /&gt;
&lt;br /&gt;
		mw.log(&amp;#039;Initialising genderswitcher for &amp;#039;+self.index);&lt;br /&gt;
		var $c_m = this.$box.find(&amp;#039;.infobox-bonuses-image.render-m&amp;#039;), $c_f=this.$box.find(&amp;#039;.infobox-bonuses-image.render-f&amp;#039;);&lt;br /&gt;
		this.$td.addClass(&amp;#039;gender-render&amp;#039;).attr({&lt;br /&gt;
			&amp;#039;style&amp;#039;: $c_m.attr(&amp;#039;style&amp;#039;),&lt;br /&gt;
			&amp;#039;rowspan&amp;#039;: $c_m.attr(&amp;#039;rowspan&amp;#039;)&lt;br /&gt;
		}).append(this.$td_inner);&lt;br /&gt;
		$c_m.parent().append(this.$td);&lt;br /&gt;
		this.$buttons.append(this.button.m, this.button.f);&lt;br /&gt;
		this.$td.append(this.$buttons);&lt;br /&gt;
		this.$buttons.find(&amp;#039;span.button&amp;#039;).on(&amp;#039;click&amp;#039;, this.beginSwitchEvent);&lt;br /&gt;
&lt;br /&gt;
		$c_m.addClass(&amp;#039;gender-render-hidden&amp;#039;).attr(&amp;#039;data-gender-render&amp;#039;, &amp;#039;m&amp;#039;);&lt;br /&gt;
		$c_f.addClass(&amp;#039;gender-render-hidden&amp;#039;).attr(&amp;#039;data-gender-render&amp;#039;, &amp;#039;f&amp;#039;);&lt;br /&gt;
		window.switchEventManager.addGenderRenderSwitch(self);&lt;br /&gt;
		window.switchEventManager.addPostSwitchEvent(this.refreshImage);&lt;br /&gt;
		this.genderSwitch(getGenderFromLS());&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Legacy switch infoboxes, as generated by [[Template:Switch infobox]]&lt;br /&gt;
	 * &lt;br /&gt;
	 * &lt;br /&gt;
	 * parameters&lt;br /&gt;
	 *	  $box	jQuery object representing the infobox itself (.switch-infobox)&lt;br /&gt;
	 *	  index   index of this infobox, from $.each&lt;br /&gt;
	 */&lt;br /&gt;
	function LegacySwitchInfobox($box, index, version_index_offset) {&lt;br /&gt;
		var self = this;&lt;br /&gt;
		this.$infobox = $box;&lt;br /&gt;
		this.$infobox.data(&amp;#039;SwitchInfobox&amp;#039;, self);&lt;br /&gt;
		this.$parent = $box;&lt;br /&gt;
		this.index = index;&lt;br /&gt;
		this.version_index_offset = version_index_offset;&lt;br /&gt;
		this.$originalButtons = self.$parent.find(&amp;#039;.switch-infobox-triggers&amp;#039;);&lt;br /&gt;
		this.$items = self.$parent.find(&amp;#039;.item&amp;#039;);&lt;br /&gt;
		this.version_count = self.$originalButtons.find(&amp;#039;span.trigger.button&amp;#039;).length;&lt;br /&gt;
&lt;br /&gt;
		/* click/change event - triggers switch event manager */&lt;br /&gt;
		this.beginSwitchEvent = function(e) {&lt;br /&gt;
			var $tgt = $(e.currentTarget);&lt;br /&gt;
			mw.log(&amp;#039;beginSwitchEvent triggered in legacy infobox, id &amp;#039;+self.index);&lt;br /&gt;
			window.switchEventManager.trigger($tgt.attr(&amp;#039;data-id&amp;#039;), $tgt.attr(&amp;#039;data-anchor&amp;#039;), self);&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
		/* click/change event - triggers switch event manager */&lt;br /&gt;
		this.switchInfobox = function(index, text){&lt;br /&gt;
			if (text === &amp;#039;@init@&amp;#039;) {&lt;br /&gt;
				text = self.$buttons.find(&amp;#039;[data-id=&amp;quot;1&amp;quot;]&amp;#039;).attr(&amp;#039;data-anchor&amp;#039;);&lt;br /&gt;
			}&lt;br /&gt;
			var ind, txt, $thisButton = self.$buttons.find(&amp;#039;[data-anchor=&amp;quot;&amp;#039;+text+&amp;#039;&amp;quot;]&amp;#039;).first();&lt;br /&gt;
			mw.log(&amp;#039;switching legacy infobox, id &amp;#039;+self.index);&lt;br /&gt;
			if ($thisButton.length) {&lt;br /&gt;
				txt = text;&lt;br /&gt;
				ind = $thisButton.attr(&amp;#039;data-id&amp;#039;);&lt;br /&gt;
			} else {&lt;br /&gt;
				return;&lt;br /&gt;
				/*ind = index;&lt;br /&gt;
				$thisButton = self.$buttons.find(&amp;#039;[data-id=&amp;quot;&amp;#039;+ind+&amp;#039;&amp;quot;]&amp;#039;);&lt;br /&gt;
				if ($thisButton.length) {&lt;br /&gt;
					txt = $thisButton.attr(&amp;#039;data-anchor&amp;#039;);&lt;br /&gt;
				}*/&lt;br /&gt;
			}&lt;br /&gt;
			if (txt === undefined) {&lt;br /&gt;
				return;&lt;br /&gt;
			}&lt;br /&gt;
			self.$buttons.find(&amp;#039;.trigger&amp;#039;).removeClass(&amp;#039;button-selected&amp;#039;);&lt;br /&gt;
			self.$buttons.find(&amp;#039;.trigger[data-id=&amp;quot;&amp;#039;+ind+&amp;#039;&amp;quot;]&amp;#039;).addClass(&amp;#039;button-selected&amp;#039;);&lt;br /&gt;
			&lt;br /&gt;
			self.$items.filter(&amp;#039;.showing&amp;#039;).removeClass(&amp;#039;showing&amp;#039;);&lt;br /&gt;
			self.$items.filter(&amp;#039;[data-id=&amp;quot;&amp;#039;+ind+&amp;#039;&amp;quot;]&amp;#039;).addClass(&amp;#039;showing&amp;#039;);&lt;br /&gt;
		};&lt;br /&gt;
		&lt;br /&gt;
		/* default version - not supported by legacy, always false */&lt;br /&gt;
		this.defaultVer = function () { return false; };&lt;br /&gt;
		&lt;br /&gt;
		this.isParentOf = function ($triggerer) {&lt;br /&gt;
			return self.$parent.find($triggerer).length &amp;gt; 0;&lt;br /&gt;
		};&lt;br /&gt;
		this.currentlyShowing = function(){&lt;br /&gt;
			var buttn = self.$buttons.find(&amp;#039;.button-selected&amp;#039;);&lt;br /&gt;
			return {index: buttn.attr(&amp;#039;data-id&amp;#039;), text: buttn.attr(&amp;#039;data-anchor&amp;#039;)}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		/* init */&lt;br /&gt;
		mw.log(&amp;#039;setting up legacy infobox, id &amp;#039;+self.index);&lt;br /&gt;
		// add anchor text&lt;br /&gt;
		self.$originalButtons.find(&amp;#039;span.trigger.button&amp;#039;).each(function(i,e){&lt;br /&gt;
			var $e = $(e);&lt;br /&gt;
			var anchorText = $e.text().split(&amp;#039; &amp;#039;).join(&amp;#039;_&amp;#039;);&lt;br /&gt;
			$e.attr(&amp;#039;data-anchor&amp;#039;, &amp;#039;#&amp;#039;+anchorText);&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// append triggers to every item&lt;br /&gt;
		// if contents has a infobox, add to a caption of that&lt;br /&gt;
		// else just put at top&lt;br /&gt;
		self.$items.each(function(i,e){&lt;br /&gt;
			var $item = $(e);&lt;br /&gt;
			if ($item.find(&amp;#039;table.infobox&amp;#039;).length &amp;gt; 0) {&lt;br /&gt;
				if ($item.find(&amp;#039;table.infobox caption&amp;#039;).length &amp;lt; 1) {&lt;br /&gt;
					$item.find(&amp;#039;table.infobox&amp;#039;).prepend(&amp;#039;&amp;lt;caption&amp;gt;&amp;#039;);&lt;br /&gt;
				}&lt;br /&gt;
				$item.find(&amp;#039;table.infobox caption&amp;#039;).first().prepend(self.$originalButtons.clone());&lt;br /&gt;
			} else {&lt;br /&gt;
				$item.prepend(self.$originalButtons.clone());&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
		// remove buttons from current location&lt;br /&gt;
		self.$originalButtons.remove();&lt;br /&gt;
&lt;br /&gt;
		// update selection&lt;br /&gt;
		this.$buttons = self.$parent.find(&amp;#039;.switch-infobox-triggers&amp;#039;);&lt;br /&gt;
		self.$buttons.find(&amp;#039;.trigger&amp;#039;).each(function (i,e) {&lt;br /&gt;
			$(e).click(self.beginSwitchEvent);&lt;br /&gt;
		});&lt;br /&gt;
		self.switchInfobox(1, &amp;#039;@init@&amp;#039;);&lt;br /&gt;
		&lt;br /&gt;
		window.switchEventManager.addSwitchInfobox(this);&lt;br /&gt;
		self.$parent.removeClass(&amp;#039;loading&amp;#039;).find(&amp;#039;span.loading-button&amp;#039;).remove();&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Synced switches, as generated by [[Template:Synced switch]]&lt;br /&gt;
	 * &lt;br /&gt;
	 * &lt;br /&gt;
	 * parameters&lt;br /&gt;
	 *	  $box	jQuery object representing the synced switch itself (.rsw-synced-switch)&lt;br /&gt;
	 *	  index   index of this infobox, from $.each&lt;br /&gt;
	 */&lt;br /&gt;
	function SyncedSwitch($box, index, version_index_offset) {&lt;br /&gt;
		var self = this;&lt;br /&gt;
		this.index = index;&lt;br /&gt;
		this.version_index_offset = version_index_offset; //not actually used&lt;br /&gt;
		this.version_count = 0; // we don&amp;#039;t increment from this&lt;br /&gt;
		this.$syncedswitch = $box;&lt;br /&gt;
		this.$syncedswitch.data(&amp;#039;SwitchInfobox&amp;#039;, self);&lt;br /&gt;
		this.attachedLabels = false;&lt;br /&gt;
		this.is_synced_switch = true;&lt;br /&gt;
&lt;br /&gt;
		/* filling in interface - synced switch has no buttons to press so cannot trigger an event by itself */&lt;br /&gt;
		this.beginSwitchEvent = function (){};&lt;br /&gt;
&lt;br /&gt;
		this.switchInfobox = function(index, text){&lt;br /&gt;
			mw.log(&amp;#039;switching synced switch, id &amp;#039;+self.index+&amp;quot;, looking for &amp;quot;+index+&amp;#039; - &amp;#039;+text);&lt;br /&gt;
			if (text === &amp;#039;@init@&amp;#039;) {&lt;br /&gt;
				text = self.$syncedswitch.find(&amp;#039;[data-item=&amp;quot;1&amp;quot;]&amp;#039;).attr(&amp;#039;data-item-text&amp;#039;);&lt;br /&gt;
			}&lt;br /&gt;
			var $toShow = self.$syncedswitch.find(&amp;#039;[data-item-text=&amp;quot;&amp;#039;+text+&amp;#039;&amp;quot;]&amp;#039;);&lt;br /&gt;
			if (!(self.attachedLabels &amp;amp;&amp;amp; $toShow.length)) {&lt;br /&gt;
				//return;&lt;br /&gt;
				$toShow = self.$syncedswitch.find(&amp;#039;[data-item=&amp;quot;&amp;#039;+index+&amp;#039;&amp;quot;]&amp;#039;);&lt;br /&gt;
			}&lt;br /&gt;
			if (!$toShow.length) {&lt;br /&gt;
				// show default instead&lt;br /&gt;
				self.$syncedswitch.find(&amp;#039;.rsw-synced-switch-item&amp;#039;).removeClass(&amp;#039;showing&amp;#039;);&lt;br /&gt;
				self.$syncedswitch.find(&amp;#039;[data-item=&amp;quot;0&amp;quot;]&amp;#039;).addClass(&amp;#039;showing&amp;#039;);&lt;br /&gt;
			} else {&lt;br /&gt;
				self.$syncedswitch.find(&amp;#039;.rsw-synced-switch-item&amp;#039;).removeClass(&amp;#039;showing&amp;#039;);&lt;br /&gt;
				$toShow.addClass(&amp;#039;showing&amp;#039;);&lt;br /&gt;
			}&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
		this.genderSwitch = function(gender){&lt;br /&gt;
			var $gens = self.$syncedswitch.find(&amp;#039;.render-m, .render-f&amp;#039;);&lt;br /&gt;
			var srch = &amp;#039;.render-&amp;#039;+gender;&lt;br /&gt;
			if ($gens.length) {&lt;br /&gt;
				$gens.each(function(i,e){&lt;br /&gt;
					var $e = $(e);&lt;br /&gt;
					if ($e.is(srch)) {&lt;br /&gt;
						$e.removeClass(&amp;#039;gender-render-hidden&amp;#039;).addClass(&amp;#039;gender-render-showing&amp;#039;);&lt;br /&gt;
					} else {&lt;br /&gt;
						$e.removeClass(&amp;#039;gender-render-showing&amp;#039;).addClass(&amp;#039;gender-render-hidden&amp;#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		};&lt;br /&gt;
		&lt;br /&gt;
		/* default version - not supported by synced switches, always false */&lt;br /&gt;
		this.defaultVer = function () { return false; };&lt;br /&gt;
		&lt;br /&gt;
		this.isParentOf = function ($triggerer) {&lt;br /&gt;
			return self.$syncedswitch.find($triggerer).length &amp;gt; 0;&lt;br /&gt;
		};&lt;br /&gt;
		this.currentlyShowing = function(){&lt;br /&gt;
			var buttn = self.$syncedswitch.find(&amp;#039;.rsw-synced-switch-item.showing&amp;#039;);&lt;br /&gt;
			return {index: buttn.attr(&amp;#039;data-item&amp;#039;), text: buttn.attr(&amp;#039;data-item-text&amp;#039;)}&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		/* init */&lt;br /&gt;
		mw.log(&amp;#039;setting up synced switch, id &amp;#039;+self.index);&lt;br /&gt;
		// attempt to apply some button text from a SwitchInfobox&lt;br /&gt;
		if ($(&amp;#039;.infobox.infobox-switch&amp;#039;).length &amp;amp;&amp;amp; !$(&amp;#039;.multi-infobox&amp;#039;).length) {&lt;br /&gt;
			self.attachedLabels = true;&lt;br /&gt;
			var $linkedButtonTextInfobox = $(&amp;#039;.infobox.infobox-switch&amp;#039;).first();&lt;br /&gt;
			self.$syncedswitch.find(&amp;#039;.rsw-synced-switch-item&amp;#039;).each(function(i,e){&lt;br /&gt;
				var $e = $(e);&lt;br /&gt;
				if ($e.attr(&amp;#039;data-item-text&amp;#039;) === undefined) {&lt;br /&gt;
					$e.attr(&amp;#039;data-item-text&amp;#039;, $linkedButtonTextInfobox.find(&amp;#039;[data-switch-index=&amp;quot;&amp;#039;+i+&amp;#039;&amp;quot;]&amp;#039;).attr(&amp;#039;data-switch-anchor&amp;#039;));&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		self.switchInfobox(1, &amp;#039;@init@&amp;#039;);&lt;br /&gt;
		window.switchEventManager.addSwitchInfobox(this);&lt;br /&gt;
		if (self.$syncedswitch.find(&amp;#039;.render-m, .render-f&amp;#039;).length) {&lt;br /&gt;
			window.switchEventManager.addGenderRenderSwitch(self);&lt;br /&gt;
			this.genderSwitch(getGenderFromLS());&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	/** &lt;br /&gt;
	 * An infobox that doesn&amp;#039;t switch&lt;br /&gt;
	 * used to make sure MultiInfoboxes interact with SyncedSwitches correctly&lt;br /&gt;
	 * &lt;br /&gt;
	 */&lt;br /&gt;
	function NonSwitchingInfobox($box, index, version_index_offset){&lt;br /&gt;
		var self = this;&lt;br /&gt;
		this.$infobox = $box;&lt;br /&gt;
		this.index = index;&lt;br /&gt;
		this.version_index_offset = version_index_offset;&lt;br /&gt;
		this.$infobox.data(&amp;#039;SwitchInfobox&amp;#039;, self);&lt;br /&gt;
		this.version_count = 1;&lt;br /&gt;
		&lt;br /&gt;
		this.beginSwitchEvent = function (){}; //do nothing&lt;br /&gt;
		this.switchInfobox = function(index, text){return}; //do nothing&lt;br /&gt;
		this.defaultVer = function () {return true;};&lt;br /&gt;
		this.isParentOf = function ($triggerer) {return false;};&lt;br /&gt;
		this.currentlyShowing = function(){&lt;br /&gt;
			return {text:null, index: 1};&lt;br /&gt;
		};&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Event manager&lt;br /&gt;
	 * Observer pattern&lt;br /&gt;
	 * Globally available as window.switchEventManager&lt;br /&gt;
	 * &lt;br /&gt;
	 * Methods&lt;br /&gt;
	 *	  addSwitchInfobox(l)&lt;br /&gt;
	 *		  adds switch infobox (of any type) to the list of switch infoboxes listening to trigger events&lt;br /&gt;
	 *		  l	   switch infobox&lt;br /&gt;
	 * &lt;br /&gt;
	 * 		addPreSwitchEvent(f)&lt;br /&gt;
	 * 			adds the function to a list of functions that runs when the switch event is triggered but before any other action is taken&lt;br /&gt;
	 * 			the function is passed the index and anchor (in that order) that was passed to the trigger function&lt;br /&gt;
	 * 			returning the boolean true from the function will cancel the switch event&lt;br /&gt;
	 * 			trying to add a non-function is a noop&lt;br /&gt;
	 * 			e		function to run&lt;br /&gt;
	 * &lt;br /&gt;
	 * 		addPostSwitchEvent(f)&lt;br /&gt;
	 * 			adds the function to a list of functions that runs when the switch event is completed, after all of the switching is completed (including the hash change)&lt;br /&gt;
	 * 			the function is passed the index and anchor (in that order) that was passed to the trigger function&lt;br /&gt;
	 * 			the return value is ignored&lt;br /&gt;
	 * 			trying to add a non-function is a noop&lt;br /&gt;
	 * 			e		function to run&lt;br /&gt;
	 * &lt;br /&gt;
	 *	  trigger(i, a)&lt;br /&gt;
	 *		  triggers the switch event on all listeners&lt;br /&gt;
	 *		  will prefer switching to the anchor if available&lt;br /&gt;
	 *		  i	   index to switch to&lt;br /&gt;
	 *		  a	   anchor to switch to&lt;br /&gt;
	 * &lt;br /&gt;
	 * 		makeSwitchInfobox($box)&lt;br /&gt;
	 * 			creates the correct object for the passed switch infobox, based on the classes of the infobox&lt;br /&gt;
	 * 			is a noop if it does not match any of the selectors&lt;br /&gt;
	 * 			infobox is given an index based on the internal counter for the switch&lt;br /&gt;
	 * 			$box		jQuery object for the switch infobox (the jQuery object passed to the above functions, see above for selectors checked)&lt;br /&gt;
	 * &lt;br /&gt;
	 * 		addIndex(i)&lt;br /&gt;
	 * 			updates the internal counter by adding i to it&lt;br /&gt;
	 * 			if i is not a number or is negative, is a noop&lt;br /&gt;
	 * 			used for manually setting up infoboxes (init) or creating a new type to plugin&lt;br /&gt;
	 * 			i	number to add&lt;br /&gt;
	 */&lt;br /&gt;
&lt;br /&gt;
	function SwitchEventManager() {&lt;br /&gt;
		var self = this, switchInfoboxes = [], syncedSwitches=[], genderRenderSwitchers = [], preSwitchEvents = [], postSwitchEvents = [], index = 0, version_offset = 0;&lt;br /&gt;
		window.switchEventManager = this;&lt;br /&gt;
		&lt;br /&gt;
		// actual switch infoboxes to change&lt;br /&gt;
		this.addSwitchInfobox = function(l) {&lt;br /&gt;
			switchInfoboxes.push(l);&lt;br /&gt;
			if (l.is_synced_switch) {&lt;br /&gt;
				syncedSwitches.push(l);&lt;br /&gt;
			}&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
		this.addGenderRenderSwitch = function(gs) {&lt;br /&gt;
			gs.version_index_offset = version_offset;&lt;br /&gt;
			genderRenderSwitchers.push(gs);&lt;br /&gt;
			version_offset += gs.version_count;&lt;br /&gt;
		};&lt;br /&gt;
		&lt;br /&gt;
		// things to do when switch button is clicked but before any switching&lt;br /&gt;
		this.addPreSwitchEvent = function(e) {&lt;br /&gt;
			if (typeof(e) === &amp;#039;function&amp;#039;) {&lt;br /&gt;
				preSwitchEvents.push(e);&lt;br /&gt;
			}&lt;br /&gt;
		};&lt;br /&gt;
		this.addPostSwitchEvent = function(e) {&lt;br /&gt;
			if (typeof(e) === &amp;#039;function&amp;#039;) {&lt;br /&gt;
				postSwitchEvents.push(e);&lt;br /&gt;
			}&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
		this.trigger = function(index, anchor, triggerer) {&lt;br /&gt;
			mw.log(&amp;#039;Triggering switch event for index &amp;#039;+index+&amp;#039;; text &amp;#039;+anchor);&lt;br /&gt;
			// using a real for loop so we can use return to exit the trigger function&lt;br /&gt;
			for (var i=0; i &amp;lt; preSwitchEvents.length; i++){&lt;br /&gt;
				var ret = preSwitchEvents[i](index,anchor);&lt;br /&gt;
				if (typeof(ret) === &amp;#039;boolean&amp;#039;) {&lt;br /&gt;
					if (ret) {&lt;br /&gt;
						mw.log(&amp;#039;switching was cancelled&amp;#039;);&lt;br /&gt;
						return;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// close all tooltips on the page&lt;br /&gt;
			$(&amp;#039;.js-tooltip-wrapper&amp;#039;).trigger(&amp;#039;js-tooltip-close&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
			// trigger switching on listeners&lt;br /&gt;
			switchInfoboxes.forEach(function (e) {&lt;br /&gt;
				if (triggerer === null || !e.isParentOf(triggerer.$infobox)) {&lt;br /&gt;
					if (e.is_synced_switch &amp;amp;&amp;amp; triggerer !== null) {&lt;br /&gt;
						e.switchInfobox(parseInt(index)+triggerer.version_index_offset, anchor);&lt;br /&gt;
					} else {&lt;br /&gt;
						e.switchInfobox(index, anchor);&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// update hash&lt;br /&gt;
			if (typeof anchor === &amp;#039;string&amp;#039;) {&lt;br /&gt;
				var _anchor = anchor;&lt;br /&gt;
				if (_anchor === &amp;#039;@init@&amp;#039;) {&lt;br /&gt;
					_anchor = &amp;#039;&amp;#039;;&lt;br /&gt;
				}&lt;br /&gt;
				&lt;br /&gt;
				if (window.history &amp;amp;&amp;amp; window.history.replaceState) {&lt;br /&gt;
					if (window.location.hash !== &amp;#039;&amp;#039;) {&lt;br /&gt;
						window.history.replaceState({}, &amp;#039;&amp;#039;, window.location.href.replace(window.location.hash, _anchor));&lt;br /&gt;
					} else {&lt;br /&gt;
						window.history.replaceState({}, &amp;#039;&amp;#039;, window.location.href + _anchor);&lt;br /&gt;
					}&lt;br /&gt;
				} else {&lt;br /&gt;
					// replaceState not supported, I guess we just change the hash normally?&lt;br /&gt;
					window.location.hash = _anchor;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			postSwitchEvents.forEach(function(e){&lt;br /&gt;
				e(index, anchor);&lt;br /&gt;
			});&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
		this.triggerGenderRenderSwitch = function(gender){&lt;br /&gt;
			mw.log(genderRenderSwitchers);&lt;br /&gt;
			for (var i = 0; i&amp;lt;genderRenderSwitchers.length; i++) {&lt;br /&gt;
				genderRenderSwitchers[i].genderSwitch(gender);&lt;br /&gt;
			}&lt;br /&gt;
		};&lt;br /&gt;
		&lt;br /&gt;
		this.triggerMultiInfoboxTabChange = function($multiInfobox) {&lt;br /&gt;
			mw.log(&amp;#039;switching syncedswitches from tabber click&amp;#039;, $multiInfobox)&lt;br /&gt;
			setTimeout(function(){&lt;br /&gt;
				var $tabcontents = $multiInfobox.find(&amp;#039;div.tabber &amp;gt; div.tabbertab[style=&amp;quot;&amp;quot;]&amp;#039;);&lt;br /&gt;
				var $infobox = $tabcontents.find(&amp;#039;.infobox&amp;#039;).first();&lt;br /&gt;
				var swinfo = $infobox.data(&amp;#039;SwitchInfobox&amp;#039;);&lt;br /&gt;
				mw.log(&amp;#039;switchingdata&amp;#039;, $tabcontents, $infobox, swinfo);&lt;br /&gt;
				if (swinfo !== null &amp;amp;&amp;amp; swinfo !== undefined) {&lt;br /&gt;
					var cs = swinfo.currentlyShowing();&lt;br /&gt;
					var ind = parseInt(cs.index) + swinfo.version_index_offset;&lt;br /&gt;
					mw.log(&amp;#039;inside if&amp;#039;, cs, ind)&lt;br /&gt;
					syncedSwitches.forEach(function (e) {&lt;br /&gt;
						mw.log(&amp;#039;inside foreach&amp;#039;, e);&lt;br /&gt;
						e.switchInfobox(ind, &amp;#039;&amp;#039;);&lt;br /&gt;
					});&lt;br /&gt;
				} else {mw.log(&amp;#039;swinfo is undefnull&amp;#039;);}&lt;br /&gt;
			}, 20);&lt;br /&gt;
		};&lt;br /&gt;
		&lt;br /&gt;
		/* attempts to detect what type of switch infobox this is and applies the relevant type */&lt;br /&gt;
		// mostly for external access&lt;br /&gt;
		this.makeSwitchInfobox = function($e) {&lt;br /&gt;
			if ($e.is(&amp;#039;.infobox-switch&amp;#039;)) {&lt;br /&gt;
				return new SwitchInfobox($e, index++, version_offset);&lt;br /&gt;
			}&lt;br /&gt;
			if ($e.hasClass(&amp;#039;switch-infobox&amp;#039;)) {&lt;br /&gt;
				return new LegacySwitchInfobox($e, index++, version_offset);&lt;br /&gt;
			}&lt;br /&gt;
			if ($e.hasClass(&amp;#039;rsw-synced-switch&amp;#039;)) {&lt;br /&gt;
				return new SyncedSwitch($e, index++, version_offset);&lt;br /&gt;
			}&lt;br /&gt;
			if ($e.hasClass(&amp;#039;infobox&amp;#039;)) {&lt;br /&gt;
				return new NonSwitchingInfobox($e, index++, version_offset);&lt;br /&gt;
			}&lt;br /&gt;
			console.log(&amp;#039;Invalid element sent to SwitchEventManager.makeSwitchInfobox:&amp;#039;, $e)&lt;br /&gt;
		};&lt;br /&gt;
		this.addIndex = function(i) {&lt;br /&gt;
			if (typeof(i) === &amp;#039;number&amp;#039;) {&lt;br /&gt;
				 i += Math.max(Math.floor(i), 0);&lt;br /&gt;
			}&lt;br /&gt;
		};&lt;br /&gt;
		this.applyDefaultVersion = function() {&lt;br /&gt;
			if (window.location.hash !== &amp;#039;&amp;#039;) {&lt;br /&gt;
				self.trigger(1, window.location.hash, null);&lt;br /&gt;
				return;&lt;br /&gt;
			} else {&lt;br /&gt;
			// real for loop so we can return out of the function&lt;br /&gt;
				for (var i = 0; i&amp;lt;switchInfoboxes.length; i++) {&lt;br /&gt;
					var defver = switchInfoboxes[i].defaultVer();&lt;br /&gt;
					if (typeof(defver) === &amp;#039;object&amp;#039;) {&lt;br /&gt;
						self.trigger(defver.idx, defver.txt, null);&lt;br /&gt;
						return;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			self.trigger(1, &amp;#039;@init@&amp;#039;, null);&lt;br /&gt;
		};&lt;br /&gt;
		&lt;br /&gt;
		// init&lt;br /&gt;
		this.init = function(){&lt;br /&gt;
			$(&amp;#039;.infobox, .switch-infobox, .rsw-synced-switch&amp;#039;).each(function(i,e){&lt;br /&gt;
				var obj = self.makeSwitchInfobox($(e));&lt;br /&gt;
				version_offset += obj.version_count;&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			&lt;br /&gt;
			// for {{Multi Infobox}}&lt;br /&gt;
			// there isn&amp;#039;t a hook for tabber being ready, so we just gotta check until it is&lt;br /&gt;
			function initMultiInfobox(){&lt;br /&gt;
				if ($(&amp;#039;#mw-content-text .multi-infobox .tabber.tabberlive&amp;#039;).length) { // class tabberlive is added when it is ready&lt;br /&gt;
					$(&amp;#039;#mw-content-text .multi-infobox&amp;#039;).each(function(i,e){&lt;br /&gt;
						$(e).find(&amp;#039;.tabber &amp;gt; ul.tabbernav &amp;gt; li&amp;#039;).click(function(ev){&lt;br /&gt;
							self.triggerMultiInfoboxTabChange($(ev.currentTarget).parents(&amp;#039;.multi-infobox&amp;#039;));&lt;br /&gt;
						});&lt;br /&gt;
					});&lt;br /&gt;
					$(&amp;#039;#mw-content-text .multi-infobox .tabber.tabberlive ul.tabbernav li.tabberactive&amp;#039;).click(); //trigger event once now&lt;br /&gt;
				} else {&lt;br /&gt;
					window.setTimeout(initMultiInfobox, 20);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			if ($(&amp;#039;#mw-content-text .multi-infobox&amp;#039;).length) {&lt;br /&gt;
				initMultiInfobox();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			self.applyDefaultVersion();&lt;br /&gt;
		}&lt;br /&gt;
		this.init();&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	mw.hook(&amp;#039;wikipage.content&amp;#039;).add(function init( $content ) {&lt;br /&gt;
		if (!($content.find(&amp;#039;.switch-infobox&amp;#039;).length || $content.find(&amp;#039;.infobox-buttons&amp;#039;).length)) {&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		// mirror rsw-util&lt;br /&gt;
		try {&lt;br /&gt;
			localStorage.setItem(&amp;#039;test&amp;#039;, &amp;#039;test&amp;#039;);&lt;br /&gt;
			localStorage.removeItem(&amp;#039;test&amp;#039;);&lt;br /&gt;
			CAN_LOCAL_STORAGE = true;&lt;br /&gt;
		} catch (e) {&lt;br /&gt;
			CAN_LOCAL_STORAGE = false;&lt;br /&gt;
		}&lt;br /&gt;
		window.switchEventManager = new SwitchEventManager();&lt;br /&gt;
&lt;br /&gt;
		// reinitialize any kartographer map frames added due to a switch&lt;br /&gt;
		if ($content.find(&amp;#039;.infobox-switch .mw-kartographer-map&amp;#039;).length&lt;br /&gt;
		|| $content.find(&amp;#039;.infobox-switch-resources .mw-kartographer-map&amp;#039;).length&lt;br /&gt;
		|| $content.find(&amp;#039;.switch-infobox .mw-kartographer-map&amp;#039;).length&lt;br /&gt;
		|| $content.find(&amp;#039;.rsw-synced-switch .mw-kartographer-map&amp;#039;).length) {&lt;br /&gt;
			window.switchEventManager.addPostSwitchEvent(function() {&lt;br /&gt;
				mw.hook(&amp;#039;wikipage.content&amp;#039;).fire($content.find(&amp;#039;a.mw-kartographer-map&amp;#039;).parent());&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
})&lt;/div&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
</feed>