Template:VersionTimeline

  • Revision slug: Template:VersionTimeline
  • Revision title: Template:VersionTimeline
  • Revision id: 29046
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 4 words added

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 = ""; // 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:20px; top:2px; background:#dd0000; position:absolute; width:" + end + "%";   
} 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:20px; top:2px; left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";  
  start = end;   // now do the deprecated part   v = template.xverblob($2) - template.xverblob(1);   end = 100*(v/currentBlob);   st = "height:20px; top:2px; left:" + start + "%; background:#ddaa00; position:absolute; width:" + end-start + "%";  
  start = end; } // obsolete section   if ($2) {   st = "height:20px; top:2px; left:" + start + "%; background:#dd0000; position:absolute; width:" + 100-start + "%";  
}

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="top: 1em; height:24px; background:#222222; position:absolute; padding:2px; width:70%;">

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

// 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:20px; top:2px; background:#dd0000; position:absolute; width:" + end + "%";
  <div style=(st)></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:20px; top:2px; left:" + start + "%; background:#00dd00; position:absolute; width:" + end-start + "%";
  <div style=(st)></div>
  start = end;

  // now do the deprecated part
  v = template.xverblob($2) - template.xverblob(1);
  end = 100*(v/currentBlob);
  st = "height:20px; top:2px; left:" + start + "%; background:#ddaa00; position:absolute; width:" + end-start + "%";
  <div style=(st)></div>
  start = end;
}

// obsolete section
 
if ($2) {
  st = "height:20px; top:2px; left:" + start + "%; background:#dd0000; position:absolute; width:" + 100-start + "%";
  <div style=(st)></div>
}
</div> 
</pre>
Revert to this revision