Template:bug

  • Revision slug: Template:bug
  • Revision title: Template:bug
  • Revision id: 59959
  • Created:
  • Creator: user01
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

/* get the page language */

var lang = string.tolower(uri.parts(page.uri).path[0]);
/* fall back to page.language on a user page */
if (string.StartsWith(lang, "user:"))
  lang = page.language;
else if (string.contains(lang, ":"))
  lang = string.substr(lang, string.indexOf(lang, ":") + 1);

var bug = "bug ";

switch(lang){
  case 'ca':
    bug = "errada ";
    break;
  case 'cs':
    bug = "chyba ";
    break;
  case 'pl':
    bug = "błąd ";
    break;
}

var bugPageURL = 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + $0;
var bugPageXML = web.xml(bugPageURL);

var s = "";
if (#bugPageXML == 0)
  s = "Unable to access bug's page. Try reloading this page to see bug's status and summary in this tooltip.";
else{
  s = xml.text(bugPageXML, '//span[@id="static_bug_status"]');
  if (s){
    /* Remove \n and redundant spaces */
    //s = string.replace(s, "\n", "");
    s = string.trimEnd(string.replace(s, "\n", ""));
    if (string.contains(s, " "))
      s = string.join(list.select(string.split(s, " "), "#$>0"), " ");
/*    var s2 = "";
    var s3 = "";
    foreach(var i in num.series(0, #s - 1)){
      if ((s[i] == " ") && (s3 == " ")){
        continue;
      }
      else{
        s2 += s[i];
        s3 = s[i];
      }
    }*/
    s += ' - ' + xml.text(bugPageXML, '//span[@id="short_desc_nonedit_display"]');
  }
  else if (string.contains(bugPageXML, "Access Denied"))
    s = "The access to the bug's page is restricted.";
  else
    s = "";
}

bug + $0;

%>

Revision Source

<pre class="script">
/* get the page language */

var lang = string.tolower(uri.parts(page.uri).path[0]);
/* fall back to page.language on a user page */
if (string.StartsWith(lang, "user:"))
  lang = page.language;
else if (string.contains(lang, ":"))
  lang = string.substr(lang, string.indexOf(lang, ":") + 1);

var bug = "bug ";

switch(lang){
  case 'ca':
    bug = "errada ";
    break;
  case 'cs':
    bug = "chyba ";
    break;
  case 'pl':
    bug = "błąd ";
    break;
}

var bugPageURL = 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + $0;
var bugPageXML = web.xml(bugPageURL);

var s = "";
if (#bugPageXML == 0)
  s = "Unable to access bug's page. Try reloading this page to see bug's status and summary in this tooltip.";
else{
  s = xml.text(bugPageXML, '//span[@id="static_bug_status"]');
  if (s){
    /* Remove \n and redundant spaces */
    //s = string.replace(s, "\n", "");
    s = string.trimEnd(string.replace(s, "\n", ""));
    if (string.contains(s, " "))
      s = string.join(list.select(string.split(s, " "), "#$>0"), " ");
/*    var s2 = "";
    var s3 = "";
    foreach(var i in num.series(0, #s - 1)){
      if ((s[i] == " ") && (s3 == " ")){
        continue;
      }
      else{
        s2 += s[i];
        s3 = s[i];
      }
    }*/
    s += ' - ' + xml.text(bugPageXML, '//span[@id="short_desc_nonedit_display"]');
  }
  else if (string.contains(bugPageXML, "Access Denied"))
    s = "The access to the bug's page is restricted.";
  else
    s = "";
}

<a rel="external" href=(bugPageURL) class="external" title=(s)>bug + $0</a>;

%>
Revert to this revision