Difference between revisions of "Template:InterProject/doc"
imported>WOSlinker m (change source to syntaxhighlight) |
|||
| (One intermediate revision by one other user not shown) | |||
| Line 31: | Line 31: | ||
== Programming == | == Programming == | ||
JavaScript 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]]): | JavaScript 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]]): | ||
| − | < | + | <syntaxhighlight lang="javascript" style="height:30em; overflow:auto;">/* |
## ProjektLinks ## | ## 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]]) | by Skript von [[user:Merlissimo]] (Idee basierend auf http://de.wiktionary.org/wiki/MediaWiki:Common.js von [[User:Pathoschild]] und [[wikt:de:User:Melancholie]]) | ||
| Line 90: | Line 90: | ||
})}); | })}); | ||
} | } | ||
| − | /** End of code for Template:Interproject */</ | + | /** End of code for Template:Interproject */</syntaxhighlight> |
| − | <includeonly>{{ | + | <includeonly>{{Sandbox other|| |
<!-- Categories below this line, please; interwikis at Wikidata --> | <!-- Categories below this line, please; interwikis at Wikidata --> | ||
[[Category:Link templates]] | [[Category:Link templates]] | ||
}}</includeonly> | }}</includeonly> | ||
Latest revision as of 12:02, 7 July 2020
| This is a documentation subpage for Template:InterProject. It contains 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
{{InterProject
|meta=
|metaglobal=
|commons=
|b=
|n=
|q=
|s=
|v=
|d=
|wikt=
|voy=
|species=
|incubator=
|mw=
}}
Parameters
For 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
JavaScript 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 */