User:Erutuon/scripts/langCatRedirect.js

Hello, you have come here looking for the meaning of the word User:Erutuon/scripts/langCatRedirect.js. In DICTIOUS you will not only get to know all the dictionary meanings for the word User:Erutuon/scripts/langCatRedirect.js, but we will also tell you about its etymology, its characteristics and you will know how to say User:Erutuon/scripts/langCatRedirect.js in singular and plural. Everything you need to know about the word User:Erutuon/scripts/langCatRedirect.js you have here. The definition of the word User:Erutuon/scripts/langCatRedirect.js will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofUser:Erutuon/scripts/langCatRedirect.js, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
// <nowiki>

// Redirects you from Category:<language code> to Category:<language category name>;
// for instance, ] to ].

if (mw.config.get('wgNamespaceNumber') === 14 && mw.config.get('wgAction') == 'view'
&& /^{2,3}(?:-{2,3})*$/.test(mw.config.get('wgTitle'))) {
	$.getScript("//en.wiktionary.orghttps://en.wiktionary.org/w/index.php?title=User:Erutuon/scripts/apiWrapper.js&action=raw")
	.done(function() {
		'use strict';
		
		var title = mw.config.get('wgTitle');
		var luaScript = 'mw.text.jsonEncode(require "Module:languages".getByCode("' + title + '"):getCategoryName())';
		
		function handleLanguageData(languageDataJSON) {
			var categoryName = JSON.parse(languageDataJSON);
			if (categoryName)
				location.href = mw.config.get('wgArticlePath').replace('$1', 'Category:' + categoryName);
			else
				mw.notify(mw.config.get('wgTitle') + " is not a valid language code.");
		}
		
		apiWrapper.callLua(luaScript, handleLanguageData);
	})
	.fail(function () {
		mw.log("fail");
	});
}

// </nowiki>