<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.wiki-shangri-la.org/mw19/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-CategoryData.js</id>
	<title>MediaWiki:Gadget-CategoryData.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.wiki-shangri-la.org/mw19/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-CategoryData.js"/>
	<link rel="alternate" type="text/html" href="https://www.wiki-shangri-la.org/mw19/index.php?title=MediaWiki:Gadget-CategoryData.js&amp;action=history"/>
	<updated>2026-05-08T16:49:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://www.wiki-shangri-la.org/mw19/index.php?title=MediaWiki:Gadget-CategoryData.js&amp;diff=7093&amp;oldid=prev</id>
		<title>AccountManager: Created page with &quot;const Category = {  	init( $content ) {  		// Get automatic translations 		const translations = []; 		$content.find( &#039;#mw-pages a&#039; ).each( ( index, link ) =&gt; { 			if ( link.textContent.match( &#039;/[a-z]{2,3}$&#039; ) ) { 				const item = link.closest( &#039;li&#039; ); 				translations.push( item ); 			} 		} );  		// Hide automatic translations and show a switch to toggle them 		if ( translations.length ) { 			Category.toggleTranslations( translations ); 			Category.addSwitch( translation...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.wiki-shangri-la.org/mw19/index.php?title=MediaWiki:Gadget-CategoryData.js&amp;diff=7093&amp;oldid=prev"/>
		<updated>2025-12-23T22:03:33Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;const Category = {  	init( $content ) {  		// Get automatic translations 		const translations = []; 		$content.find( &amp;#039;#mw-pages a&amp;#039; ).each( ( index, link ) =&amp;gt; { 			if ( link.textContent.match( &amp;#039;/[a-z]{2,3}$&amp;#039; ) ) { 				const item = link.closest( &amp;#039;li&amp;#039; ); 				translations.push( item ); 			} 		} );  		// Hide automatic translations and show a switch to toggle them 		if ( translations.length ) { 			Category.toggleTranslations( translations ); 			Category.addSwitch( translation...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;const Category = {&lt;br /&gt;
&lt;br /&gt;
	init( $content ) {&lt;br /&gt;
&lt;br /&gt;
		// Get automatic translations&lt;br /&gt;
		const translations = [];&lt;br /&gt;
		$content.find( &amp;#039;#mw-pages a&amp;#039; ).each( ( index, link ) =&amp;gt; {&lt;br /&gt;
			if ( link.textContent.match( &amp;#039;/[a-z]{2,3}$&amp;#039; ) ) {&lt;br /&gt;
				const item = link.closest( &amp;#039;li&amp;#039; );&lt;br /&gt;
				translations.push( item );&lt;br /&gt;
			}&lt;br /&gt;
		} );&lt;br /&gt;
&lt;br /&gt;
		// Hide automatic translations and show a switch to toggle them&lt;br /&gt;
		if ( translations.length ) {&lt;br /&gt;
			Category.toggleTranslations( translations );&lt;br /&gt;
			Category.addSwitch( translations );&lt;br /&gt;
		}&lt;br /&gt;
	},&lt;br /&gt;
&lt;br /&gt;
	toggleTranslations( translations ) {&lt;br /&gt;
		for ( const translation of translations ) {&lt;br /&gt;
			translation.hidden = !translation.hidden;&lt;br /&gt;
		}&lt;br /&gt;
	},&lt;br /&gt;
&lt;br /&gt;
	addSwitch( translations ) {&lt;br /&gt;
		mw.loader.using( &amp;#039;@wikimedia/codex&amp;#039; ).then( require =&amp;gt; {&lt;br /&gt;
			const Vue = require( &amp;#039;vue&amp;#039; );&lt;br /&gt;
			const Codex = require( &amp;#039;@wikimedia/codex&amp;#039; );&lt;br /&gt;
			const data = { translations: translations };&lt;br /&gt;
			const app = Vue.createMwApp( Category.switchComponent, data );&lt;br /&gt;
			app.component( &amp;#039;cdx-toggle-switch&amp;#039;, Codex.CdxToggleSwitch );&lt;br /&gt;
			app.mount( &amp;#039;#toggle-translations-switch&amp;#039; );&lt;br /&gt;
		} );&lt;br /&gt;
	},&lt;br /&gt;
&lt;br /&gt;
	switchComponent: {&lt;br /&gt;
&lt;br /&gt;
		props: [ &amp;#039;translations&amp;#039; ],&lt;br /&gt;
&lt;br /&gt;
		template: `&amp;lt;cdx-toggle-switch&lt;br /&gt;
				style=&amp;quot;height: 1em; margin-left: .5em; vertical-align: middle;&amp;quot;&lt;br /&gt;
				v-model=&amp;quot;showTranslations&amp;quot;&lt;br /&gt;
				@update:model-value=&amp;quot;onUpdate&amp;quot;&lt;br /&gt;
			&amp;gt;&amp;lt;/cdx-toggle-switch&amp;gt;`,&lt;br /&gt;
&lt;br /&gt;
		data() {&lt;br /&gt;
			return {&lt;br /&gt;
				showTranslations: false&lt;br /&gt;
			};&lt;br /&gt;
		},&lt;br /&gt;
&lt;br /&gt;
		methods: {&lt;br /&gt;
			onUpdate() {&lt;br /&gt;
				Category.toggleTranslations( this.translations );&lt;br /&gt;
			}&lt;br /&gt;
		},&lt;br /&gt;
	},&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
mw.hook( &amp;#039;wikipage.content&amp;#039; ).add( Category.init );&lt;/div&gt;</summary>
		<author><name>AccountManager</name></author>
	</entry>
</feed>