"MDL-14706, move javascript code to javascript-static.js"

This commit is contained in:
dongsheng
2009-09-18 03:50:46 +00:00
parent 144f22baa9
commit fd4faf98fe
2 changed files with 47 additions and 77 deletions
+28
View File
@@ -1313,3 +1313,31 @@ function dialog_callback() {
console.debug(this);
console.debug(this.args);
}
Number.prototype.fixed=function(n){
with(Math)
return round(Number(this)*pow(10,n))/pow(10,n);
}
function update_progress_bar (id, width, pt, msg, es){
var percent = pt*100;
var status = document.getElementById("status_"+id);
var percent_indicator = document.getElementById("pt_"+id);
var progress_bar = document.getElementById("progress_"+id);
var time_es = document.getElementById("time_"+id);
status.innerHTML = msg;
percent_indicator.innerHTML = percent.fixed(2) + '%';
if(percent == 100) {
progress_bar.style.background = "green";
time_es.style.display = "none";
} else {
progress_bar.style.background = "#FFCC66";
if (es == Infinity){
time_es.innerHTML = "Initializing...";
}else {
time_es.innerHTML = es.fixed(2)+" sec";
time_es.style.display
= "block";
}
}
progress_bar.style.width = width + "px";
}