/**
Version 0.1 Javascript loaderbar.
Email me if you have any comments on this script or want to donate something to me:
me@johnbakker.name
READ THE README FILE BEFORE USING!
Copyright 2008 John Bakker me@johnbakker.name
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
function loaderbar(config)
{
this.defaultconfig = [];
this.defaultconfig.debug=false;
this.isdone =false;
this.config = config;
if(typeof this.config =='object')
{
//its an object at least...
}
else
{
//whoops well make it then
this.config = [];
}
//check each setting or set it to defaults
for (var i in this.defaultconfig)
{
if(typeof this.config[i]=='undefined')
{
this.config[i] = this.defaultconfig[i];
}
}
this.preonloadloads = [];
this.onloadloads = [];
this.files= [];
if(this.config.mode=='silent')
{
//now don't do any drawing!;
}
else
{
bdy = document.getElementsByTagName('body').item(0);
loaderbarcontainerdiv = document.createElement('div');
loaderbarcontainerdiv.setAttribute('id','tloaderbarcontainer');
//loaderbarcontainerdiv.setAttribute('style','font-family:Trebuchet MS;font-size:12px;z-index:255')//'width:100%;height:100%;font-family:Trebuchet MS;font-size:12px;background-color:#eeeeee;z-index:255');
loaderbarcontainerdiv.style.fontFamily='Trebuchet MS';
loaderbarcontainerdiv.style.fontSize='12px';
loaderbarcontainerdiv.style.zIndex='255';
loaderbarcontainerdiv.setAttribute('class','tloaderbarcontainer');
bdy.appendChild(loaderbarcontainerdiv);
this.loaderbarcontainerdiv = document.getElementById('tloaderbarcontainer');
this.loaderbarcontainerdiv.innerHTML ='
Laden...';
loaderbarprogressfilesdiv = document.createElement('div');
loaderbarprogressfilesdiv.setAttribute('id','tloaderbarprogressfiles');
loaderbarprogressfilesdiv.style.display='none';
loaderbarprogresscontainer = document.createElement('div');
loaderbarprogresscontainer.setAttribute('id','tloaderbarprogresscontainer');
loaderbarprogresscontainer.style.textAlign='left';
loaderbarprogressdiv = document.createElement('div');
loaderbarprogressdiv.setAttribute('id','tloaderbarprogress');
loaderbarprogressdiv.style.width='0%';
loaderbarprogressdiv.style.height='20px';
loaderbarprogressdiv.style.fontSize='20px';
loaderbarprogressdiv.style.backgroundColor= '#333333';
loaderbarprogressdiv.innerHTML =' ';
this.loaderbarcontainerdiv.appendChild(loaderbarprogresscontainer);
this.loaderbarprogresscontainer = document.getElementById('tloaderbarprogresscontainer');
this.loaderbarcontainerdiv.appendChild(loaderbarprogressfilesdiv);
this.loaderbarprogresscontainer.appendChild(loaderbarprogressdiv);
this.loaderbarprogressdiv = document.getElementById('tloaderbarprogress');
this.loaderbarprogressfilesdiv = document.getElementById('tloaderbarprogressfiles');
}
}
loaderbar.prototype.loadedfile = function(filename)
{
for(oo=0;oo';
}
}
if(this.config.mode=='silent')
{
}
else
{
if((totalsize==0)||((totaldone==0)))
{
}
else
{
this.loaderbarprogressdiv.style.width=Math.ceil((totaldone/totalsize)*100)+'%';
}
this.loaderbarprogressfilesdiv.innerHTML=fileslist;
}
if(totalsize==totaldone)
{
this.isdone=true;
// alert('test'+this.preonloadloads.length);
for(wiz=0;wiz