mozilla

Revision 26090 of Template:compatibilityTableAggregatorNoCache

  • Revision slug: Template:compatibilityTableAggregatorNoCache
  • Revision title: Template:compatibilityTableAggregatorNoCache
  • Revision id: 26090
  • Created:
  • Creator: FreakCERS
  • Is current revision? No
  • Comment 1 words added, 23 words removed

Revision Content

<% var aidx = -1; var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var cidx = 0; var colors = ["#ffffff","#f2f6fb"]; var type = "Element"; if ($1) { type = $1; } var prefix = ""; var postfix = ""; switch (type) { case "Element": prefix = "<"; postfix = ">"; break; } var p = page; if ($0) { p = wiki.GetPage($0); }   var pageList = list.orderBy(map.keyValues(p.subpages), "key");  foreach (var i in pageList) { // At least JS-docs tend to use other heading - should we just get entire page instead of section? // try to get it from cache, else cache it for 24 hours     var cacheKey = page.language + '-compatibilityTable-' + i.value.path;     var compat = webcache.fetch(cacheKey); if (typeof compat == typeof nil) {   //var compat = xml.text(wiki.page(i.value.path), "//div[@id='compat-desktop']", _, true);   if (typeof compat == typeof nil) {     // The leading empty tr is stripped in later steps, leave it in or it will cause failure compat = ""   } } var compat = webcache.store(cacheKey, compat, 60*60*24); var cnt = #string.IndexesOf(compat, "")-1; if (cnt < 1) cnt = 1; var naidx = string.IndexOf(alphabet, string.ToUpperFirst(string.substr(i.value.title,0,1))); if (naidx > aidx) { Template.compatTableHeader(type); foreach (var l in num.Series(aidx+1, naidx)) { Template.TableRowLetter(alphabet[l]); } aidx = naidx; } var sum = '';//xml.text(wiki.page(i.value.path, "Summary"), "//p", _, false); if (#sum < 1) sum = "No summary found"; ; compat = string.substr(compat, string.IndexesOf(compat, "")[1]+4, string.LastIndexOf(compat, "")); compat = string.replace(compat, "", "; cidx = cidx + 1; }
Basic support" + CompatUnknown() + "" + CompatUnknown() + "" + CompatUnknown() + "" + CompatUnknown() + "" + CompatUnknown() + "
prefix + i.value.title + postfix;
;   

Revision Source

<%

var aidx = -1;
var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var cidx = 0;
var colors = ["#ffffff","#f2f6fb"];
var type = "Element";
if ($1) {
  type = $1;
}
var prefix = "";
var postfix = "";
switch (type) {
  case "Element":
    prefix = "<";
    postfix = ">";
    break;
}
<table class="standard-table">
  var p = page;
  if ($0) {
    p = wiki.GetPage($0);
  }
  
  var pageList = list.orderBy(map.keyValues(p.subpages), "key");
  foreach (var i in pageList) {
//  At least JS-docs tend to use other heading - should we just get entire page instead of section?
// try to get it from cache, else cache it for 24 hours
    var cacheKey = page.language + '-compatibilityTable-' + i.value.path;
    var compat = webcache.fetch(cacheKey);
    if (typeof compat == typeof nil) {
      //var compat = xml.text(wiki.page(i.value.path), "//div[@id='compat-desktop']", _, true);
      if (typeof compat == typeof nil) {
        // The leading empty tr is stripped in later steps, leave it in or it will cause failure
        compat = "<tr></tr><tr><td>Basic support</td><td>" + CompatUnknown() + "</td><td>" + CompatUnknown() + "</td><td>" + CompatUnknown() + "</td><td>" + CompatUnknown() + "</td><td>" + CompatUnknown() + "</td></tr>"
      }
    }
    var compat = webcache.store(cacheKey, compat, 60*60*24);
    var cnt = #string.IndexesOf(compat, "<tr>")-1;
    if (cnt < 1)
      cnt = 1;
    var naidx = string.IndexOf(alphabet, string.ToUpperFirst(string.substr(i.value.title,0,1)));
    if (naidx > aidx) {
      Template.compatTableHeader(type);
      foreach (var l in num.Series(aidx+1, naidx)) {
        Template.TableRowLetter(alphabet[l]);
      }
      aidx = naidx;
    }
    <tr style=("background-color:" + colors[cidx % 2])>
      var sum = '';//xml.text(wiki.page(i.value.path, "Summary"), "//p", _, false);
      if (#sum < 1)
        sum = "No summary found";
      <td rowspan=(cnt)><a id=("HTML_" + i.value.title) href=(i.value.uri) title=(sum) rel="internal" style="white-space: nowrap;">
        <code>prefix + i.value.title + postfix</code>;
      </a></td>;
      compat = string.substr(compat, string.IndexesOf(compat, "<tr>")[1]+4, string.LastIndexOf(compat, "</tr>"));
      compat = string.replace(compat, "<tr>", "<tr style='background-color:" + colors[cidx % 2] + "'");
      web.html(compat);
    </tr>;
    cidx = cidx + 1;
  }
</table>;
  
</pre>
Revert to this revision