Template:LXRSearch

  • Revision slug: Template:LXRSearch
  • Revision title: Template:LXRSearch
  • Revision id: 64874
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment 1 words added, 3 words removed

Revision Content

/* get the page language */
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 searchfor = ' Search for ' + $2 + '';

switch(lang) {
  case 'de':
    searchfor = ' Suche nach ' + $2 + '';
    break;
  case 'ja':
    searchfor = ' で ' + $2 + ' を';
    break;
}
web.link('http://mxr.mozilla.org/mozilla-central/' + $0 + '?' + $1 + '=' + $2, (string.trim(($3 || '')) !== '' ? web.html($3) : web.html('LXR ' + ($0 == 'ident' ? 'ID' : '') + searchfor)));
%>

Revision Source

<pre class="script">
/* get the page language */
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 searchfor = ' Search for <code>' + $2 + '</code>';

switch(lang) {
  case 'de':
    searchfor = ' Suche nach <code>' + $2 + '</code>';
    break;
  case 'ja':
    searchfor = ' で <code>' + $2 + '</code> を';
    break;
}
web.link('http://mxr.mozilla.org/mozilla-central/' + $0 + '?' + $1 + '=' + $2, (string.trim(($3 || '')) !== '' ? web.html($3) : web.html('LXR ' + ($0 == 'ident' ? 'ID' : '') + searchfor)));
%>
Revert to this revision