// Tiny library for progress bars. Example usage:
/*
<div id="progressbar">
  <div></div>
</div>

<script>
  var p_elem = document.getElementById("#progressbar")
  var p = new Progress(p_elem)
  p.progress(0.5)
</script>
*/

function Progress(title, mainclass, barclass) {
  title = title || "";
  mainclass = mainclass || "";
  barclass = barclass || "";

  this.container = document.createElement("div");
  // Create the progress bar
  this.elem = document.createElement("div");
  this.elem.className = mainclass + " progressbar";
  this.bar = document.createElement("div");
  this.bar.className = barclass + " progressbar-indicator";
  // Create the title
  this.title = document.createElement("h1");
  // this.title.className = "progressbar-title";
  this.title.textContent = title;

  // Create the label
  this.label = document.createElement("div");
  this.label.className = "progressbar-label";
  this.label.textContent = "0";

  this.elem.appendChild(this.bar);
  this.container.appendChild(this.title);
  this.container.appendChild(this.elem);
  this.container.appendChild(this.label);

  // Start at 0%
  this.bar.style.width = "0px";
  // Function to set progress
  this.progress = function(amount) {
    if (amount !== undefined) {
      this.bar.style.width = amount * 100 + "%";
      this.label.textContent = Math.floor(amount * 100);
    } else {
      return this.bar.offsetWidth / this.elem.offsetWidth;
    }
  };
}

@@ -245,116 +245,47 @@
 itle
-, mainclass, barclass) %7B%0A  title = title %7C%7C %22%22;%0A  mainclass = mainclass %7C%7C %22%22;%0A  barclass = barclass %7C%7C %22%22;%0A
+ = '', mainclass = '', barclass = '') %7B
 %0A  t
@@ -319,29 +319,29 @@
 eateElement(
-%22div%22
+'div'
 );%0A  // Crea
@@ -389,37 +389,37 @@
 t.createElement(
-%22div%22
+'div'
 );%0A  this.elem.c
@@ -429,16 +429,19 @@
 sName = 
+%60$%7B
 mainclas
@@ -437,28 +437,25 @@
 %60$%7Bmainclass
- + %22
+%7D
  progressbar
@@ -454,17 +454,17 @@
 gressbar
-%22
+%60
 ;%0A  this
@@ -485,37 +485,37 @@
 t.createElement(
-%22div%22
+'div'
 );%0A  this.bar.cl
@@ -524,24 +524,27 @@
 sName = 
+%60$%7B
 barclass
  + %22 pro
@@ -535,20 +535,17 @@
 barclass
- + %22
+%7D
  progres
@@ -558,17 +558,17 @@
 ndicator
-%22
+%60
 ;%0A  // C
@@ -625,12 +625,12 @@
 ent(
-%22h1%22
+'h1'
 );%0A 
@@ -776,13 +776,13 @@
 ent(
-%22div%22
+'div'
 );%0A 
@@ -797,33 +797,33 @@
 bel.className = 
-%22
+'
 progressbar-labe
@@ -823,17 +823,17 @@
 ar-label
-%22
+'
 ;%0A  this
@@ -857,11 +857,11 @@
 t = 
-%220%22
+'0'
 ;%0A%0A 
@@ -1066,13 +1066,13 @@
 h = 
-%220px%22
+'0px'
 ;%0A  
@@ -1121,24 +1121,16 @@
 s = 
-function
 (amount)
  %7B%0A 
@@ -1125,16 +1125,19 @@
 (amount)
+ =%3E
  %7B%0A    i
@@ -1192,16 +1192,19 @@
 width = 
+%60$%7B
 amount *
@@ -1211,14 +1211,11 @@
  100
- + %22%25%22
+%7D%25%60
 ;%0A  
@@ -1277,19 +1277,31 @@
     
-%7D else %7B%0A  
+  return amount;%0A    %7D%0A
     
@@ -1353,21 +1353,15 @@
 tWidth;%0A
-    %7D%0A
   %7D;%0A%7D%0A

Update progress.js style