This is a documentation subpage for Template:InterProject. It may contain usage information, categories and other content that is not part of the original template page. |
This template is used to generate links to sister projects similar to Interlanguage links. The template creates a box with the listed links above the display of interwiki links in the sidebar. It is not intended for use in the article namespace.
Usage
edit{{InterProject |meta= |metaglobal= |commons= |b= |n= |q= |s= |v= |d= |wikt= |voy= |species= |incubator= |mw= }}
Parameters
editFor every parameter the page name must be entered separately. It should be noted that the localized name of the target wiki or the international name is used for the namespace (for example, user for the user-namespaces). A leading colon is not required.
For every sister project you can exactly specify one link. In sister projects with different languages (like Wikibooks), however, you can link to languages other than English: with {{Interprojekt|b=de:User:Example}}
you link to the German-language Wikibooks.
Programming
editJavaScript must be enabled to use this template. To apply this template to a different wiki, the following javascript code is needed (see also MediaWiki:Common.js for the current code; see also wikt:de:MediaWiki:InterProject.js):
/*
## ProjektLinks ##
by Skript von [[user:Merlissimo]] (Idee basierend auf http://de.wiktionary.org/wiki/MediaWiki:Common.js von [[User:Pathoschild]] und [[wikt:de:User:Melancholie]])
erzeugt Sitebar-Interwiki zu Schwesterprojekten aufgrund von Vorlage [[Vorlage:InterProjekt]]
siehe auch Feature-Request [[bugzilla:708]]
*/
if( mw.config.get( 'wgNamespaceNumber' ) > 0 ) {
mw.loader.using( [ 'mediawiki.util' ], function() { $( function() {
var iProject = $( '#interProject' );
if( !iProject.length ) {
return;
}
var sistersibling = $( '#p-lang' );
if( !sistersibling.length ) {
sistersibling = $( '#p-tb' );
}
if( !sistersibling.length ) {
return;
}
//Link auf Parennode des Portletmenues
var sisterparent = sistersibling.parent();
//Erzeuge neues Portletmenue
var sisterprojectnav = $( document.createElement( 'div' ) );
sisterprojectnav.attr( 'id', 'p-sisterprojects' );
sisterprojectnav.attr( 'class', sistersibling.attr( 'class' ) );
var header = $( document.createElement( 'h3' ) );
header.text( $( '#sisterProjects:first' ).text() );
sisterprojectnav.append( header );
var portletDiv = $( document.createElement( 'div' ) );
var sistersiblingsub = sistersibling.find( 'div:first' );
if( sistersiblingsub.length ) {
portletDiv.attr( 'class', sistersiblingsub.attr( 'class' ) );
} else {
portletDiv.attr( 'class', 'pBody' );
}
sisterprojectnav.append( portletDiv );
//Wenn möglich vor den Interwikis einfügen
if ( sisterparent.has( '#p-lang' ).length ) {
sisterprojectnav.insertBefore( '#p-lang' );
} else {
sisterparent.append( sisterprojectnav );
}
//Schwesterlinks ermitteln und einfügen
iProject.find( 'a' ).each( function() {
$this = $( this );
var sistername = $this.text();
mw.util.addPortletLink(
'p-sisterprojects',
$this.attr( 'href' ) + '?uselang=' + mw.util.rawurlencode( mw.config.get( 'wgUserLanguage' ) ),
sistername,
'sister-' + sistername,
sistername
);
});
})});
}
/** End of code for Template:Interproject */