Difference between revisions of "Template:InterProject/doc"
imported>Umherirrender m (nicht Artikelnamensraum) |
imported>Brackenheim (←Created page with '{{Documentation subpage}} <!-- Categories go at the bottom of this page and interwikis go in Wikidata. --> This template is used to generate links to sister pro...') |
||
| Line 1: | Line 1: | ||
| − | + | {{Documentation subpage}} | |
| − | + | <!-- Categories go at the bottom of this page and interwikis go in Wikidata. --> | |
| − | == | + | This template is used to generate links to sister projects similar to [[Help:Interlanguage links|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 == | ||
<pre style="white-space:pre-wrap;"> | <pre style="white-space:pre-wrap;"> | ||
| − | {{ | + | {{InterProject |
|meta= | |meta= | ||
|metaglobal= | |metaglobal= | ||
| Line 22: | Line 24: | ||
</pre> | </pre> | ||
| − | == | + | == 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 <code><nowiki>{{Interprojekt|b=de:User:Example}}</nowiki></code> 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): | |
<source lang="javascript" style="height:30em; overflow:auto;">/** Code for [[Template:InterProject]] */ | <source lang="javascript" style="height:30em; overflow:auto;">/** Code for [[Template:InterProject]] */ | ||
mw.loader.using( [ 'mediawiki.util' ], function() { jQuery( document ).ready(function() { | mw.loader.using( [ 'mediawiki.util' ], function() { jQuery( document ).ready(function() { | ||
| Line 60: | Line 62: | ||
})}); | })}); | ||
/** End of code for Template:Interproject */</source> | /** End of code for Template:Interproject */</source> | ||
| + | |||
| + | <!-- Categories go here and interwikis go in Wikidata. --> | ||
| + | [[Category:Link templates]] | ||
Revision as of 17:32, 12 February 2014
| 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):
/** Code for [[Template:InterProject]] */
mw.loader.using( [ 'mediawiki.util' ], function() { jQuery( document ).ready(function() {
var iProject = document.getElementById("interProject");
if(!iProject) return;
var sistersibling = document.getElementById("p-lang");
if(!sistersibling) sistersibling= document.getElementById("p-tb");
if(!sistersibling) return;
var sisterparent = sistersibling.parentNode;
var sisterprojectnav = document.createElement("div");
sisterprojectnav.id = "p-sisterprojects";
sisterprojectnav.className = sistersibling.className
sisterprojectnav.innerHTML = '<h5>'+document.getElementById("sisterProjects").firstChild.innerHTML+'</h5><div><ul></ul></div>';
var sistersiblingsub = sistersibling.getElementsByTagName("div")[0];
if(sistersiblingsub){
sisterprojectnav.childNodes[1].className = sistersiblingsub.className;
} else {
sisterprojectnav.childNodes[1].className = "pBody";
}
var sisternext = document.getElementById("p-lang");
if ( sisternext && sisternext.parentNode == sisterparent ){
sisterparent.insertBefore( sisterprojectnav, sisternext );
}else{
sisterparent.appendChild(sisterprojectnav);
}
var sisterlinks = iProject.getElementsByTagName("a");
for (var i = 0; i < sisterlinks.length; i++) {
var sistername = sisterlinks[i].firstChild.nodeValue
mw.util.addPortletLink('p-sisterprojects', sisterlinks[i].getAttribute("href") + '?uselang=' + mw.config.get( 'wgUserLanguage' ), sistername, "sister-"+ sistername, sistername);
}
})});
/** End of code for Template:Interproject */