Fossil

download.js
Login
/***** Edit the following with each new release *******/
var releases = [
  {"re":        /-yyyymmddHHMM\.(tar\.gz|zip)$/,
   "title":     "Snapshot as of 2023-mm-dd HH:MM",
   "titleurl":  "../doc/trunk/www/changes.wiki",
   "history":   "../timeline?p=39bcd310e889538d&bt=version-2.22",
   "future":    "../timeline?df=39bcd310e889538d",
   "tarball":   "xxxx/fossil-src-202310241204.tar.gz",
   "tarballsz": 6797692},
  {"re":        /-202403261536\.(tar\.gz|zip)$/,
   "title":     "Snapshot as of 2024-03-26 15:36Z",
   "titleurl":  "../doc/trunk/www/changes.wiki",
   "history":   "../timeline?p=452f8e1ffc99c607&bt=version-2.23",
   "future":    "../timeline?df=452f8e1ffc99c607",
   "tarball":   "452f8e1ffc99c607ef274684bee0592a224b16cbf21ce75b9a7f4ae068521aab.tar.gz",
   "tarballsz": 6894863},
  {"re":        /-2\.23\.(tar\.gz|zip)$/,
   "title":     "Version 2.23 (2023-11-01)",
   "titleurl":  "../doc/trunk/www/changes.wiki#v2_23",
   "history":   "../timeline?p=version-2.23&bt=version-2.22",
   "future":    "../timeline?df=version-2.23",
   "tarball":   "47362306a7dd7c6fc3cab77cebe5d25469b0a9448479d9718eb5c49c8337b29/fossil-src-2.23.tar.gz",
   "tarballsz": 6799177},
  {"re":        /-2\.22\.(tar\.gz|zip)$/,
   "title":     "Version 2.22 (2023-05-31)",
   "titleurl":  "../doc/trunk/www/changes.wiki#v2_22",
   "history":   "../timeline?p=version-2.22&bt=version-2.21",
   "future":    "../timeline?df=version-2.22",
   "tarball":   "66ee0beb9b47d827bde533fe6a1fb2ead4ceb1936468881b4fb621bd6bdfd862/fossil-src-2.22.tar.gz",
   "tarballsz": 6730858},
  {"re":        /-2\.21\.(tar\.gz|zip)$/,
   "title":     "Version 2.21 (2023-02-25)",
   "titleurl":  "../doc/trunk/www/changes.wiki#v2_21",
   "history":   "../timeline?p=version-2.21&bt=version-2.20",
   "future":    "../timeline?df=version-2.21",
   "tarball":   "f9aa474081f0618c76f4c2f4d6f0277a3fd480aa185d7da0b8b61b00fad1aa78/fossil-src-2.21.tar.gz",
   "tarballsz": 6703622}]
/******* Should not need to change anything else ******/
function escHTML(x){
  return x.replace(/&/g,"&amp").replace(/</g,"&lt").replace(/>/g,"&gt");
}
var r1 = new XMLHttpRequest();
r1.onreadystatechange = function(){
  if(r1.readyState!=4) return
  var jx = JSON.parse(r1.responseText);
  /* The jx returned will look like this:
  ** [{"name":NAME, "mtime":MTIME, "hash":HASH, "size":SIZE, "user":USER}]
  **
  ** The sequence[] array describes the columns in the download matrix
  */
  var sequence = [
    {"name":  "linux",
     "re":    /-linux-/,
     "icon":  "build-icons/linux.gif",
     "title": "Linux x64"  },
    {"name":  "macarm",
     "re":    /-mac-arm6?4?-/,
     "icon":  "build-icons/mac.gif",
     "title": "Mac ARM"  },
    {"name":  "macx64",
     "re":    /-mac(-x64|osx)-/,
     "icon":  "build-icons/mac.gif",
     "title": "Mac x64"  },
    {"name":  "pi",
     "re":    /-pi-/,
     "icon":  "build-icons/pi.gif",
     "title": "Rasp<wbr>berry<wbr>Pi" },
    {"name":  "src",
     "icon":  "build-icons/src.gif",
     "title": "Source Tar<wbr>ball"  },
    {"name":  "win32",
     "re":    /-w32-/,
     "icon":  "build-icons/win32.gif",
     "title": "Win<wbr>dows<wbr>32"  },
    {"name":  "win64",
     "re":    /-w64-/,
     "icon":  "build-icons/win32.gif",
     "title": "Win<wbr>dows<wbr>64"  }]

  /* Accumulate HTML for the download matrix in h */
  var h = "<table cellpadding='10'>\n"

  /* Find the hash of each icon, if possible */
  var hash = new Array;
  for(var i=0; i<sequence.length; i++){
    hash[sequence[i].icon] = "";
  }
  for(var i=0; i<jx.length; i++){
    if( hash[jx[i].name]=="" ){
      hash[jx[i].name] = jx[i].hash;
    }
  }

  var top = 1;
  for(var i=0; i<releases.length; i++){
    var cnt = 0;
    var products = {"dummy":0};
    for(var j=0; j<jx.length; j++){
      var nm = jx[j].name;
      if( !releases[i].re.test(nm) ) continue;
      for(k=0; k<sequence.length; k++){
        if( sequence[k].name!="src" && sequence[k].re.test(nm) ){
          products[sequence[k].name] = jx[j];
          cnt++
          break
        }
      }
    }
    if( cnt==0 ) continue
    h += "<tr></tr>"   /* To defeat even/odd row coloring */
    h += "<tr><td colspan=7 align='left'>\n"
    if( top ){
      top = 0;
    }else{
      h += "<hr>\n";
    }
    h += "<center><b>"
    if( releases[i].titleurl ){
      h += "<a href='" + releases[i].titleurl + "'>" + releases[i].title +
           "</a>\n"
    }else{
      h += releases[i].title
    }
    if( releases[i].history ){
      h += "(<a href='" + releases[i].history + "'>history graph</a>)\n"
    }
    if( releases[i].future ){
      h += "(<a href='" + releases[i].future + "'>subsequent changes</a>)\n"
    }
    h += "</b></center></td></tr>\n<tr></tr><tr>"
    for(k=0; k<sequence.length; k++){
      var nm = sequence[k].name
      h += "<td align='center' valign='bottom'>\n"
      var sz = 0;
      if( nm=="src" ){
        h += "<a href='../tarball/"+releases[i].tarball+"'>\n"
        sz = releases[i].tarballsz
      }else if( products[nm] ){
        h += "<a href='" + encodeURI(products[nm].name) + "'>\n"
        sz = products[nm].size
      }
      if( sz>0 ){
        var icon = sequence[k].icon
        if( hash[icon]!="" ){
          icon = "./"+hash[icon];
        }
        h += "<img src='" + icon + "'><br>\n"
        h += sequence[k].title + "</a><br>\n"
        sz /= 1000000.0;
        h += sz.toFixed(2) + " MB\n"
      }
      h += "</td>\n"
    }
    h += "</tr>\n"
  }
  h += "</table>"
  document.getElementById("download_filelist").innerHTML = h;
}
r1.open("GET","../juvlist",true);
r1.send()