Template:VersionTimeline

  • Revision slug: Template:VersionTimeline
  • Revision title: Template:VersionTimeline
  • Revision id: 236515
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment

Revision Content

<% /* parameters: version created, version last changed, version obsoleted (optional), version deprecated (optional) */ /* specify 0 for obsoleted if it's deprecated but not yet obsolete */ var currentGecko = "15.0"; // Update this to current Gecko version var unitBlob = template("xverblob", ["1"]); var currentBlob = template("xverblob", [currentGecko]) - unitBlob; var u = uri.parts(env.url); var lang = u.path[0].toLowerCase(); var start = 0; var end = 0; var v = 0; var st = ""; // Variables defining positioning of items in the diagram var barTopHeight = "height:8px; top:16px;"; var underTextTop = "top:22px;"; 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 availLength = currentBlob - template("xverblob", [$0]); %>
1.0
<% // Only draw the "current version" legend if nothing collides with it if (($2 != currentGecko) && ($0 != currentGecko) && ($3 != currentGecko)) { %>   
<%- currentGecko %>
<% } // Compute length of initial red block, if any. This will run from version 1.0 to $0 var startVer = $0; if (startVer < 1) {   startVer = 1;    // deal with cases where the start version predates 1.0 } v = template("xverblob", [startVer]) - unitBlob; if (v) { end = 100*(v/currentBlob); st = barTopHeight + "background:#dd0000; position:absolute; width:" + end + "%"; %>
<%   if (startVer == currentGecko) {   st = "top:0px; font-size:11px; position:absolute; text-align:right; width:" + end + "%;";   } else {   st = "top:0px; font-size:11px; position:absolute; left:" + end + "%;";      }   %>
Introduced
<%   if (startVer == currentGecko) {     st = underTextTop + "font-size:11px; position:absolute; text-align:right; width:" + end + "%;";   } else {     st = underTextTop + "font-size:11px; position:absolute; left:" + end + "%;";   }   %>
Gecko <%=$0%>
<% } start = end; // Now do the green block representing "implemented"; this will go up to $3 if it exists, or $2 if that exists, // or to the end if neither does introTitle = "Introduced in Gecko " + $0 + " " + template("geckoRelease", [$0]); if ($3.length) { v = template("xverblob", [$3]) - unitBlob; end = 100*(v/currentBlob);  st = barTopHeight + "left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";  %>
<% start = end; // now do the deprecated part if ($2.length) { v = template("xverblob", [$2]); end = 100*(v/currentBlob); } else { end = 100; st = "top:0px; font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;"; %>
Deprecated
<% st = underTextTop +"font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;"; %>
Gecko <%-$3%>
<% } st = barTopHeight + "left:" + start + "%; background:#ff8000; position:absolute; width:" + end-start + "%";   title = "Deprecated in Gecko " + $3 + " " + template("geckoRelease", [$3]);   %>
<% start = end; } else if ($2.length) { v = template("xverblob", [$2]) - unitBlob; end = 100*(v/currentBlob); st = barTopHeight + "left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%"; %>
<% start = end; } else { end = 100; st = barTopHeight + "left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";%>
<% start = end; } // obsolete section if ($2.length) {   title = "Obsolete in Gecko " + $2 + " " + template("geckoRelease", [$2]);  st = barTopHeight + "left:" + start + "%; background:#000000; position:absolute; width:" + 100-start + "%";  %>
title=<%-title%>>
<% st = "top:0px; font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;"; %>
Obsolete
<% st = underTextTop + "font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;"; %>
Gecko <%-$2%>
<% } // draw an indicator for the last-changed version if ($1.length) {   start = (100 * ((template("xverblob", [$1]) - unitBlob) / currentBlob)) - 0.5;   title = "Last changed in Gecko " + $1 + " " + template("geckoRelease", [$0]);   st = barTopHeight + "left:" + start + "%; background:#eeee00; position:absolute; width:1%; border-radius:4px; -webkit-border-radius:4px; -moz-border-radius:4px; -o-border-radius:4px;";   %>  
  <% } %>

Revision Source

<%

/* parameters: version created, version last changed, version obsoleted (optional), version deprecated (optional) */
/* specify 0 for obsoleted if it's deprecated but not yet obsolete */

var currentGecko = "15.0";  // Update this to current Gecko version
var unitBlob = template("xverblob", ["1"]);
var currentBlob = template("xverblob", [currentGecko]) - unitBlob;
var u = uri.parts(env.url);
var lang = u.path[0].toLowerCase();

var start = 0;
var end = 0;
var v = 0;
var st = "";

// Variables defining positioning of items in the diagram

var barTopHeight = "height:8px; top:16px;";
var underTextTop = "top:22px;";

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 availLength = currentBlob - template("xverblob", [$0]);
%>
<div style="height:42px; position:relative; padding:2px; width:auto;">
<div style="top:22px; font-size:11px; position:absolute;">1.0</div>

<%
// Only draw the "current version" legend if nothing collides with it
if (($2 != currentGecko) && ($0 != currentGecko) && ($3 != currentGecko)) { %>
  <div style="top:22px; font-size:11px; position:absolute; text-align:right; width:100%;"><%- currentGecko %></div><%
}

// Compute length of initial red block, if any. This will run from version 1.0 to $0

var startVer = $0;
if (startVer < 1) {
  startVer = 1;    // deal with cases where the start version predates 1.0
}
v = template("xverblob", [startVer]) - unitBlob;

if (v) {
  end = 100*(v/currentBlob);
  st = barTopHeight + "background:#dd0000; position:absolute; width:" + end + "%";
  %>
  <div style="<%=st%>"></div>
  <%
  if (startVer == currentGecko) {
    st = "top:0px; font-size:11px; position:absolute; text-align:right; width:" + end + "%;";
  } else {
    st = "top:0px; font-size:11px; position:absolute; left:" + end + "%;";    
  }
  %>
  <div style="<%=st%>">Introduced</div>
  <%
  if (startVer == currentGecko) {
    st = underTextTop + "font-size:11px; position:absolute; text-align:right; width:" + end + "%;";
  } else {
    st = underTextTop + "font-size:11px; position:absolute; left:" + end + "%;";
  }
  %>
  <div style="<%=st%>">Gecko <%=$0%></div>
<%
}
start = end;

// Now do the green block representing "implemented"; this will go up to $3 if it exists, or $2 if that exists,
// or to the end if neither does

introTitle = "Introduced in Gecko " + $0 + " " + template("geckoRelease", [$0]);
if ($3.length) {
  v = template("xverblob", [$3]) - unitBlob;
  end = 100*(v/currentBlob);
  st = barTopHeight + "left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";
  %>
  <div style="<%=st%>" title="<%=introTitle%>"></div>
  <%
  start = end;

  // now do the deprecated part
  if ($2.length) {
    v = template("xverblob", [$2]);
    end = 100*(v/currentBlob);
  } else {
    end = 100;
    st = "top:0px; font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;";
    %>
    <div style="<%=st%>">Deprecated</div>
    <%
    st = underTextTop +"font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;";
    %>
    <div style="<%=st%>">Gecko <%-$3%></div>
  <%
  }
  st = barTopHeight + "left:" + start + "%; background:#ff8000; position:absolute; width:" + end-start + "%";
  title = "Deprecated in Gecko " + $3 + " " + template("geckoRelease", [$3]);
  %>
  <div style="<%=st%>" title="<%=title%>"></div>
  <%
  start = end;
} else if ($2.length) {
  v = template("xverblob", [$2]) - unitBlob;
  end = 100*(v/currentBlob);
  st = barTopHeight + "left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";
  %>
  <div style="<%=st%>" title="<%=introTitle%>"></div>
  <%
  start = end;
} else {
  end = 100;
  st = barTopHeight + "left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";%>
  <div style="<%=st%>" title="<%=introTitle%>"></div>
  <%
  start = end;
}

// obsolete section
 
if ($2.length) {
  title = "Obsolete in Gecko " + $2 + " " + template("geckoRelease", [$2]);
  st = barTopHeight + "left:" + start + "%; background:#000000; position:absolute; width:" + 100-start + "%";
  %>
  <div style=<%=st%> title=<%-title%>></div>
  <%
  st = "top:0px; font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;";
  %>
  <div style="<%=st%>">Obsolete</div>
  <%
  st = underTextTop + "font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;";
  %>
  <div style="<%=st%>">Gecko <%-$2%></div>
  <%
}

// draw an indicator for the last-changed version

if ($1.length) {
  start = (100 * ((template("xverblob", [$1]) - unitBlob) / currentBlob)) - 0.5;
  title = "Last changed in Gecko " + $1 + " " + template("geckoRelease", [$0]);
  st = barTopHeight + "left:" + start + "%; background:#eeee00; position:absolute; width:1%; border-radius:4px; -webkit-border-radius:4px; -moz-border-radius:4px; -o-border-radius:4px;";
  %>
  <div style="<%=st%>" title="<%-title%>"></div>
  <%
}
%>
</div>
Revert to this revision