Template:jsapixref

  • Revision slug: Template:jsapixref
  • Revision title: Template:jsapixref
  • Revision id: 64516
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment remove mediawiki vileness; page content-type changed to 'application/x.deki0805+xml'

Revision Content

/* accepts as input one required parameter: JSAPI page to create a xref to */ 
var u = uri.parts(Page.uri);
var lang = string.tolower(u.path[0]);
if (string.contains(lang, "project") || string.contains(lang, "Project")) {
  lang = string.substr(lang, 8);
}
/* fall back to page.language on a user page */
else if (string.StartsWith(lang, "user:")) {
  lang = page.language;
}
var dest = lang + '/' + 'SpiderMonkey/JSAPI_Reference/' + $0;

if (wiki.pageExists(dest)) { /* the page exists */
    (web.link(wiki.uri(dest), '<' + $0 + '>'));
} else { /* the page doesn't exist */
    <$0>
}
%>

Revision Source

<pre class="script">
/* accepts as input one required parameter: JSAPI page to create a xref to */ 
var u = uri.parts(Page.uri);
var lang = string.tolower(u.path[0]);
if (string.contains(lang, "project") || string.contains(lang, "Project")) {
  lang = string.substr(lang, 8);
}
/* fall back to page.language on a user page */
else if (string.StartsWith(lang, "user:")) {
  lang = page.language;
}
var dest = lang + '/' + 'SpiderMonkey/JSAPI_Reference/' + $0;

if (wiki.pageExists(dest)) { /* the page exists */
    <code>(web.link(wiki.uri(dest), '<' + $0 + '>'))</code>;
} else { /* the page doesn't exist */
    <code><a rel=('internal') href=(wiki.uri(dest)) class=('new')><$0></a></code>
}
%>
Revert to this revision