mozilla

Revision 114471 of Template:AMInterface

  • Revision slug: Template:AMInterface
  • Revision title: Template:AMInterface
  • Revision id: 114471
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 5 words added, 11 words removed

Revision Content

/* accepts as input one required parameter: Addon Manager interface to create a xref to */
/* optional second parameter: method to link to in that interface */
/* get a page's language (Don't use page.language!) */
var u = Uri.Parts(Page.uri);
var lang = string.toLower(u.path[0]);
if(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 + '/Addons/Add-on_Manager/' + $0;
var title = $0;
var target = dest;

if ($1) {
  target = target + '#' + $1 + '()';
  title = $0 + '.' + $1 + '()';
}

if (wiki.pageExists(dest)) { /* the page exists from the mediawiki age */
    (web.link(wiki.uri(target),title));
} else { /* the page doesn't exist */
    <a rel=('internal') href=(wiki.uri(dest)) class=('new')>titlea>;
}

Revision Source

<pre class="script">
/* accepts as input one required parameter: Addon Manager interface to create a xref to */
/* optional second parameter: method to link to in that interface */
/* get a page's language (Don't use page.language!) */
var u = Uri.Parts(Page.uri);
var lang = string.toLower(u.path[0]);
if(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 + '/Addons/Add-on_Manager/' + $0;
var title = $0;
var target = dest;

if ($1) {
  target = target + '#' + $1 + '()';
  title = $0 + '.' + $1 + '()';
}

if (wiki.pageExists(dest)) { /* the page exists from the mediawiki age */
    <code>(web.link(wiki.uri(target),title))</code>;
} else { /* the page doesn't exist */
    <code><<span class="start-tag">a</span><span class="attribute-name"> rel</span>=(<span class="attribute-value">'internal') </span><span class="attribute-name">href</span><span>=</span>(<span>wiki.uri(</span>dest<span>)) </span><span class="attribute-name">class</span>=<span class="attribute-value">('new')></span>title</<span class="end-tag">a></span></code>;
}
</pre>
Revert to this revision