FANDOM


This page lists additional JavaScript code you may need to customize some features of BotoneraPopups that depend on the content language of the wiki where it's being used, that do not necessarily match your preferred language. That's why it's not included in the language messages.

Those additional code includes:

  • Namespace canonical names: Standard namespace names that have a canonical name in English and a different name in the language of the wiki.
  • Special page aliases: Aliases of special pages, specially for detecting Special:Contributions and Special:Upload links which feature special links.
  • Custom rollbak summary prefix: Text that will go before your custom rollback summary, saved with the edit on the history page.

The code below is already wrapped inside an if clause that checks for the content language of the wiki, so it won't affect on wikis with a different language, so you can safely place that code in your global.js.

English

English wikis do not really need any additional code since there are no alternate special page aliases needed for special purposes and the custom rollback summary prefix by default is already localized.

Polish

// BEGIN Content language support for BotoneraPopups in polish wikis
// This code will be executed only on wikis where the content language is polish
if (window.wgContentLanguage == 'pl') {
	if (!window.BotoneraPopups) {
		window.BotoneraPopups = {};
	}
	window.BotoneraPopups.wikisiteinfo = $.extend(true, window.BotoneraPopups.wikisiteinfo, {"namespaces":{"-2":{"canonical":"Media"},"-1":{"canonical":"Special"},"1":{"canonical":"Talk"},"2":{"canonical":"User"},"3":{"canonical":"User talk"},"4":{"canonical":"Project"},"5":{"canonical":"Project talk"},"6":{"canonical":"File"},"7":{"canonical":"File talk"},"8":{"canonical":"MediaWiki"},"9":{"canonical":"MediaWiki talk"},"10":{"canonical":"Template"},"11":{"canonical":"Template talk"},"12":{"canonical":"Help"},"13":{"canonical":"Help talk"},"14":{"canonical":"Category"},"15":{"canonical":"Category talk"},"110":{"canonical":"Forum"},"111":{"canonical":"Forum talk"},"500":{"canonical":"Blog użytkownika"},"501":{"canonical":"Komentarz na blogu"},"502":{"canonical":"Blog"},"503":{"canonical":"Dyskusja blogu"},"1100":{"canonical":"Powiązane filmy"},"1200":{"canonical":"Tablica wiadomości"},"1201":{"canonical":"Wątek"},"1202":{"canonical":"Nagłówek tablicy"}},"specialpagealiases":[{"realname":"Contributions","aliases":["Wkład"]},{"realname":"Log","aliases":["Rejestr"]},{"realname":"Movepage","aliases":["Przenieś"]},{"realname":"Prefixindex","aliases":["Strony_według_prefiksu"]},{"realname":"Search","aliases":["Szukaj"]},{"realname":"Undelete","aliases":["Odtwórz"]},{"realname":"Upload","aliases":["Prześlij"]},{"realname":"Whatlinkshere","aliases":["Linkujące"]}]});
	window.BotoneraPopups.rollbackSummaryPrefix = 'Wycofano edycje użytkownika [[Special:Contributions/$1|$1]]: ';
}
// END

Spanish

// BEGIN Soporte de idioma para BotoneraPopups en wikis en español
// Este código solo será efectivo en wikis cuyo idioma sea español
if (window.wgContentLanguage == 'es') {
	if (!window.BotoneraPopups) {
		window.BotoneraPopups = {};
	}
	window.BotoneraPopups.wikisiteinfo = $.extend(true, window.BotoneraPopups.wikisiteinfo, {namespaces:{'-2':{canonical:'Media'},'-1':{canonical:'Special'},'1':{canonical:'Talk'},'2':{canonical:'User'},'3':{canonical:'User talk'},'4':{canonical:'Project'},'5':{canonical:'Project talk'},'6':{canonical:'File'},'7':{canonical:'File talk'},'9':{canonical:'MediaWiki talk'},'10':{canonical:'Template'},'11':{canonical:'Template talk'},'12':{canonical:'Help'},'13':{canonical:'Help talk'},'14':{canonical:'Category'},'15':{canonical:'Category talk'}}, specialpagealiases:[{realname:'Upload',aliases:['SubirArchivo']},{realname:'Prefixindex',aliases:['PáginasPorPrefijo']},{realname:'Contributions',aliases:['Contribuciones']},{realname:'Whatlinkshere',aliases:['LoQueEnlazaAquí']},{realname:'Movepage',aliases:['MoverPágina']},{realname:'Log',aliases:['Registro']},{realname:'Blockip',aliases:['Bloquear']},{realname:'Undelete',aliases:['Restaurar']},{realname:'Search',aliases:['Buscar']}]});
	window.BotoneraPopups.rollbackSummaryPrefix = 'Revertidos los cambios de [[Special:Contributions/$1|$1]]: ';
}
// END

Other languages

If you plan to use this tool in wikis with languages other than English and feel that there are special links that don't work as expected, try to build your configuration here or ask the author to add your language here.

You can generate the BotoneraPopups.wikisiteinfo configuration code using this JavaScript code (use in your Special:Mypage/monobook.js, under monobook in the wiki you're going to use it, and hit preview):

function getConfig(data) {
	var str = 'window.BotoneraPopups.wikisiteinfo = $.extend(true, window.BotoneraPopups.wikisiteinfo, ' + parseConfig(data) + ');',
		$dlg = $('<div/>').appendTo(document.body);
	$('<textarea/>').css({width:'550px',height:'250px'}).val(str).appendTo($dlg);
	$dlg.dialog({height:300, width:600, modal:true});
}
 
function parseConfig(data) {
	var aliasesneeded = 'Upload,Prefixindex,Contributions,Whatlinkshere,Movepage,Log,Blockip,Undelete,Search'.split(','),
		result = {namespaces: {}, specialpagealiases: []}, aliaskeys = {};
	for (var nsid in data.query.namespaces) {
		if (nsid != '0') {
			result.namespaces[nsid] = {canonical: data.query.namespaces[nsid].canonical};
		}
	}
	for (var i = 0; i < aliasesneeded.length; i++) {
		aliaskeys[aliasesneeded[i]] = true;
	}
	for (var i = 0, spa = data.query.specialpagealiases; i < spa.length; i++) {
		if (aliaskeys[spa[i].realname]) {
			result.specialpagealiases.push({realname:spa[i].realname, aliases:[spa[i].aliases[0]]});
		}
	}
	return JSON.stringify(result);
}
 
$(function() {
	mw.loader.using(['mediawiki.api', 'jquery.ui.dialog'], function() {
		var api = new mw.Api();
		api.get({action:'query', meta:'siteinfo', siprop:'namespaces|specialpagealiases', format:'json'}, {ok: getConfig});
	});
});

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.