Template:VersionTimeline

  • Revision slug: Template:VersionTimeline
  • Revision title: Template:VersionTimeline
  • Revision id: 29092
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

/* parameters: version created, version last changed, version obsoleted (optional), version deprecated (optional) */
/* get page language first */

var currentGecko = "2.0";  // Update this to current Gecko version
var currentBlob = template.xverblob(currentGecko) - template.xverblob(1);
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 availLength = currentBlob - template.xverblob($0);

var start = 0; var end = 0; var v = 0; var st = ""; // Draw version legend
(web.html("1.0"));
(currentGecko)
// Compute length of initial red block, if any. This will run from version 1.0 to $0 v = template.xverblob($0) - template.xverblob(1); if (v) {   end = 100*(v/currentBlob);   st = "height:14px; top:16px; background:#dd0000; position:absolute; width:" + end + "%";   
  st = "top:0px; font-size:11px; position:absolute; left:" + end + "%;";  
(web.html("Introduced"));
  st = "top:28px; font-size:11px; position:absolute; left:" + end + "%;";  
(web.html("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 if ($3) {   v = template.xverblob($3) - template.xverblob(1);   end = 100*(v/currentBlob);   st = "height:14px; top:16px; left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";  
  start = end;   // now do the deprecated part   if ($2) {     v = template.xverblob($2) - template.xverblob(1);     end = 100*(v/currentBlob);   } else {     end = 100;     st = "top:0px; font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;";     
(web.html("Deprecated"));
    st = "top:28px; font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;";     
(web.html("Gecko " + $3));
   }   st = "height:14px; top:16px; left:" + start + "%; background:#ff8000; position:absolute; width:" + end-start + "%";  
  start = end; } else if ($2) {   v = template.xverblob($2) - template.xverblob(1);   end = 100*(v/currentBlob);   st = "height:14px; top:16px; left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";  
  start = end; } else {   end = 100;   st = "height:14px; top:16px; left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";  
  start = end; } // obsolete section   if ($2) {   st = "height:14px; top:16px; left:" + start + "%; background:#dd0000; position:absolute; width:" + 100-start + "%";  
  st = "top:0px; font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;";  
(web.html("Obsolete"));
  st = "top:28px; font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;";  
(web.html("Gecko " + $2));
}


%>

Revision Source

<pre class="script">
/* parameters: version created, version last changed, version obsoleted (optional), version deprecated (optional) */
/* get page language first */

var currentGecko = "2.0";  // Update this to current Gecko version
var currentBlob = template.xverblob(currentGecko) - template.xverblob(1);
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 availLength = currentBlob - template.xverblob($0);

<div style="height:42px; position:absolute; padding:2px; width:70%;">

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

// Draw version legend

<div style="top:28px; font-size:11px; position:absolute;">(web.html("1.0"));</div>
<div style="top:28px; 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

v = template.xverblob($0) - template.xverblob(1);
if (v) {
  end = 100*(v/currentBlob);
  st = "height:14px; top:16px; background:#dd0000; position:absolute; width:" + end + "%";
  <div style=(st)></div>
  st = "top:0px; font-size:11px; position:absolute; left:" + end + "%;";
  <div style=(st)>(web.html("Introduced"));</div>
  st = "top:28px; font-size:11px; position:absolute; left:" + end + "%;";
  <div style=(st)>(web.html("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

if ($3) {
  v = template.xverblob($3) - template.xverblob(1);
  end = 100*(v/currentBlob);
  st = "height:14px; top:16px; left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";
  <div style=(st)></div>
  start = end;

  // now do the deprecated part
  if ($2) {
    v = template.xverblob($2) - template.xverblob(1);
    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)>(web.html("Deprecated"));</div>
    st = "top:28px; font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;";
    <div style=(st)>(web.html("Gecko " + $3));</div>
   }
  st = "height:14px; top:16px; left:" + start + "%; background:#ff8000; position:absolute; width:" + end-start + "%";
  <div style=(st)></div>
  start = end;
} else if ($2) {
  v = template.xverblob($2) - template.xverblob(1);
  end = 100*(v/currentBlob);
  st = "height:14px; top:16px; left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";
  <div style=(st)></div>
  start = end;
} else {
  end = 100;
  st = "height:14px; top:16px; left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";
  <div style=(st)></div>
  start = end;
}

// obsolete section
 
if ($2) {
  st = "height:14px; top:16px; left:" + start + "%; background:#dd0000; position:absolute; width:" + 100-start + "%";
  <div style=(st)></div>
  st = "top:0px; font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;";
  <div style=(st)>(web.html("Obsolete"));</div>
  st = "top:28px; font-size:11px; position:absolute; left:0px; text-align:right; float: right; width:" + start + "%;";
  <div style=(st)>(web.html("Gecko " + $2));</div>
}
</div>
<br />
<br />

%>
Revert to this revision