mozilla

Revision 56077 of Template:domxref

  • Revision slug: Template:domxref
  • Revision title: Template:domxref
  • Revision id: 56077
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 97 words added, 94 words removed; page display name reset to default

Revision Content

/* get a page's language (Don't use page.language!) */
var u = Uri.Parts(Page.uri);
var lang = u.path[0];

/* check $0 exists */
var dest = lang + '/' + 'DOM:' + $0;
if(wiki.pageExists(dest)) {
    (web.link(wiki.uri(dest), $0));
} else {
    (web.link(wiki.uri(lang + '/' + 'DOM/' + $0), $0));
}

Parameter

  1. DOM-Element
  2. Linkbeschriftung (optional)

Beispiel

Eingabe Ausgabe
{{domxref|window.dump|dump()}} template.Domxref("window.dump", "dump()")
{{domxref|window.dump}} template.Domxref("window.dump", "")

mediawiki.internal('DOM:' + $0 + '|' + $0, "fr") mediawiki.internal('DOM:' + $0 + '|' + $0, "ja") mediawiki.internal('DOM:' + $0 + '|' + $0, "ko") mediawiki.internal('DOM:' + $0 + '|' + $0, "pl") mediawiki.internal('DOM:' + $0 + '|' + $0, "zh-cn")

Revision Source

<pre class="script">
/* get a page's language (Don't use page.language!) */
var u = Uri.Parts(Page.uri);
var lang = u.path[0];

/* check $0 exists */
var dest = lang + '/' + 'DOM:' + $0;
if(wiki.pageExists(dest)) {
    <code>(web.link(wiki.uri(dest), $0))</code>;
} else {
    <code>(web.link(wiki.uri(lang + '/' + 'DOM/' + $0), $0))</code>;
}
</pre>
<div class="noinclude">
<h3 name="Parameter">Parameter</h3>
<ol> <li>DOM-Element</li> <li>Linkbeschriftung (optional)</li>
</ol>
<h3 name="Beispiel">Beispiel</h3>
<table class="standard-table"> <tbody> <tr> <td class="header">Eingabe</td> <td class="header">Ausgabe</td> </tr> <tr> <td><span class="nowiki">{{domxref|window.dump|dump()}}</span></td> <td><span class="script">template.Domxref("window.dump", "dump()")</span></td> </tr> <tr> <td><span class="nowiki">{{domxref|window.dump}}</span></td> <td><span class="script">template.Domxref("window.dump", "")</span></td> </tr> </tbody>
</table>
</div>
<p><span lang="fr" class="lang lang-fr"><code><span class="script">mediawiki.internal('DOM:' + $0 + '|' + $0, "fr")</span></code> </span><span lang="ja" class="lang lang-ja"><code><span class="script">mediawiki.internal('DOM:' + $0 + '|' + $0, "ja")</span></code> </span><span lang="ko" class="lang lang-ko"><code><span class="script">mediawiki.internal('DOM:' + $0 + '|' + $0, "ko")</span></code> </span><span lang="pl" class="lang lang-pl"><code><span class="script">mediawiki.internal('DOM:' + $0 + '|' + $0, "pl")</span></code> </span><span lang="zh-cn" class="lang lang-zh-cn"><code><span class="script">mediawiki.internal('DOM:' + $0 + '|' + $0, "zh-cn")</span></code> </span></p>