MediaWiki:Gadget-enumItems.js

De WikiMinecraft
Revisión del 08:57 9 abr 2014 de Bth0 (discusión | contribuciones) (Página creada con «/* * enumItems — Move to the previous or the next Wikidata item * (C) 2012, 2013 Arkanosis <jroquet@arkanosis.net> * Released under the MIT/Expat license * * Thanks ...»)
(dif) ← Revisión anterior | Revisión actual (dif) | Revisión siguiente → (dif)
Saltar a: navegación, buscar
/*
 * enumItems — Move to the previous or the next Wikidata item
 * (C) 2012, 2013 Arkanosis <jroquet@arkanosis.net>
 * Released under the MIT/Expat license
 *
 * Thanks to the following contributors: Raoli, Dalton2, NordNordWest, Zanka, Stryn, Helder.wiki, Grondin, Rzuwig, Wiki13, Reza1615, 분당선M, Vivaelcelta, ValterVB, Kristian Vangen
 */

( function ( mw, $ ) {

	var i18n = ( function () {

		var l10n = {
			ca: {
				previousQ: 'Element precedent',
				nextQ: 'Element següent'
			},
			de: {
				previousQ: 'Vorheriges Datenelement',
				nextQ: 'Nächstes Datenelement',
				previousP: 'Vorherige Eigenschaft',
				nextP: 'Nächste Eigenschaft'
			},
			en: {
				previousQ: 'Go to the previous item',
				nextQ: 'Go to the next item',
				previousP: 'Go to the previous property',
				nextP: 'Go to the next property'
			},
			es: {
				previousQ: 'Ir al elemento anterior',
				nextQ: 'Ir al elemento siguiente',
				previousP: 'Ir a la propiedad anterior',
				nextP: 'Ir a la propiedad siguiente'
			},
                        fa: {
                                previousQ: 'به آیتم قبلی برو',
                                nextQ: 'به آیتم بعدی برو',
                                previousP: 'به ویژگی قبلی برو',
                                nextP: 'به ویژگی بعدی برو'
                        },
			fi: {
				previousQ: 'Siirry edelliseen kohteeseen',
				nextQ: 'Siirry seuraavaan kohteeseen',
				previousP: 'Siirry edelliseen ominaisuuteen',
				nextP: 'Siirry seuraavaan ominaisuuteen'
			},
			fr: {
				previousQ: 'Aller à l\'élément précédent',
				nextQ: 'Aller à l\'élément suivant',
				previousP: 'Aller à la propriété précédente',
				nextP: 'Aller à la propriété suivante'
			},
			gl: {
				previousQ: 'Ir ó elemento anterior',
				nextQ: 'Ir ó elemento seguinte',
				previousP: 'Ir á propiedade anterior',
				nextP: 'Ir á propiedade seguinte'
			},
                        id: {
                                previousQ: 'Ke item sebelumnya',
                                nextQ: 'Ke item selanjutnya',
                                previousP: 'Ke properti sebelumnya',
                                nextP: 'Ke properti selanjutnya'
                        },
			it: {
				previousQ: 'Elemento precedente',
				nextQ: 'Elemento successivo',
				previousP: 'Proprietà precedente',
				nextP: 'Proprietà successiva'
                        },
			ko: {
				previousQ: '이전 항목으로 이동합니다',
				nextQ: '다음 항목으로 이동합니다',
                                previousP: '이전 속성으로 이동합니다',
                                nextP: '다음 속성으로 이동합니다'
                        },
                        min: {
                                previousQ: 'Ka item sabalumnyo',
                                nextQ: 'Ka item salanjuiknyo',
                                previousP: 'Ka properti sabalumnyo',
                                nextP: 'Ka properti salanjuiknyo'
                        },
                        mk: {
                                previousQ: 'Претходен предмет',
                                nextQ: 'Следен предмет',
                                previousP: 'Претходно својство',
                                nextP: 'Следно својство'
                        },
                        nb: {
                                previousQ: 'Gå til forrige datasett',
                                nextQ: 'Gå til neste datasett',
                                previousP: 'Gå til forrige egenskap',
                                nextP: 'Gå til neste egenskap'
                        },
			nl: {
				previousQ: 'Ga naar het vorige item',
				nextQ: 'Ga naar het volgende item',
				previousP: 'Ga naar de vorige eigenschap',
				nextP: 'Ga naar de volgende eigenschap'
			},
			pl: {
				previousQ: 'Przejdź do poprzedniego elementu',
				nextQ: 'Przejdź do następnego elementu',
				previousP: 'Przejdź do poprzedniej właściwości',
				nextP: 'Przejdź do następnej właściwości'
			},
			pt: {
				previousQ: 'Ir para o item anterior',
				nextQ: 'Ir para o item posterior',
				previousP: 'Ir para a propriedade anterior',
				nextP: 'Ir para a propriedade posterior'
			},
			ru: {
				previousQ: 'Предыдущий объект',
				nextQ: 'Следующий объект'
			},
			'zh-hans': {
				previousQ: '至前一项',
				nextQ: '至下一项',
				previousP: '至前一属性',
				nextP: '至下一属性'
			},
			'zh-hant': {
				previousQ: '至前一項',
				nextQ: '至下一項',
				previousP: '至前一屬性',
				nextP: '至下一屬性'
			}
		};
		l10n['pt-br'] = l10n.pt;

		var lang = mw.config.get( 'wgUserLanguage' );
		if ( ! l10n.hasOwnProperty( lang ) ) {
			lang = 'en';
		}

		return function ( key ) {
			if ( l10n[ lang ][ key ] ) {
				return l10n[ lang ][ key ];
			} else {
				return l10n[ 'en' ][ key ];
			}
		};

	} )();

	$( document ).ready( function () {

		var page = mw.config.get( 'wgTitle' );
		if ( page && page.length > 1) {

			var pageType = page.charAt( 0 );
			if ( ( mw.config.get( 'wgNamespaceNumber' ) === 0 && pageType === 'Q' ) ||
				( mw.config.get( 'wgNamespaceNumber' ) === 120 && pageType === 'P' ) ) {

				var pageNamespace = mw.config.get( 'wgCanonicalNamespace' );
				if ( pageNamespace.length > 0 ) {
					pageNamespace += ':';
				}

				var pageId = parseInt( page.slice( 1 ), 10 );
				if ( pageId > 1 ) {
					mw.util.addPortletLink( 'p-views', mw.util.getUrl( pageNamespace + pageType + (pageId - 1) ), '⇦', 't-prev', i18n( 'previous' + pageType ) );
				}
				mw.util.addPortletLink( 'p-views', mw.util.getUrl( pageNamespace + pageType + (pageId + 1) ), '⇨', 't-next', i18n( 'next' + pageType ) );

			}

		}

	} );

} ( mediaWiki, jQuery ) );