Template:jsapixref

  • Revision slug: Template:jsapixref
  • Revision title: Template:jsapixref
  • Revision id: 64519
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 33 words added, 6 words removed

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 api = $0; if (string.endswith($0, '()')) { api = string.remove(api, string.length(api) - 2); } var dest = lang + '/' + 'SpiderMonkey/JSAPI_Reference/' + api; if (wiki.pageExists(dest)) { /* the page exists */ (web.link(wiki.uri(dest), $0)); } else { /* the page doesn't exist */   var targeturi = "https://developer.mozilla.org/Article_not_found?uri=" + lang + str + $0 +         "&ident=" + $0; $0 }

Revision Source

<%

/* 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 api = $0;

if (string.endswith($0, '()')) {
    api = string.remove(api, string.length(api) - 2);
}

var dest = lang + '/' + 'SpiderMonkey/JSAPI_Reference/' + api;

if (wiki.pageExists(dest)) { /* the page exists */
    <code>(web.link(wiki.uri(dest), $0))</code>;
} else { /* the page doesn't exist */
  var targeturi = "https://developer.mozilla.org/Article_not_found?uri=" + lang + str + $0 +
        "&ident=" + $0;
    <code><a rel=('internal') href=(targeturi) class=('new')>$0</a></code>
}
</pre>
Revert to this revision