Here is a new version that allow more flexibility to include your HTML  
stuff for a startup page.
The bar is now all in % rather than px, so the variable w doesn't look  
like usefull anymore.
It also print the loaded files / total number of file.

BTW, the bar never goes to 100% I don't know why.

Feel free to comment, hope this is helpfull :-)

-----

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd 
">
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
<head>
     <!-- ScriptLoader -->
     <script type="text/javascript" src="/qooxdoo-0.8.2/script/ 
ScriptLoader.js"></script>
</head>
<body scroll="no" style="background-color:#YOUR COLOR">
<div id="bar">
YOUR STUFF HERE
             <div id="pbarcontainer"/>
AND HERE
             <div id="ptext"/>
AND ALSO HERE IF YOU WANT
</div>

</body>
<script type="text/javascript">

     // [Qooxdoo Settings]
     qxsettings = {
         // Application
         "qx.application" : "YOUR APPPLICATION MAIN CLASS",

         // Mode ("build" or "debug")
         "qx.mode": "build",

         // Theme class to use
         "qx.theme" : "qx.theme.Modern",

         // Path to qooxdoo script files
         "qx.path": "/qooxdoo-0.8.2",

         // DEPRECATED
         // Resources and script uri. If you are planning to have  
qooxdoo in
         // special uri (browser path), you can specify it here. There  
is
         // no rebuild process needed while changing qxsettings here!

         "qx.resourcesUri": "./resource",
         // Script uri
         "qx.scriptUri": "./script"
     };

     // [Javascript Files]
     //
     // Here are javascripts files that will be loaded by  
ScriptLoader. First file
     // must be qooxdoo main module. All next files are your  
javascript files.
     qxscripts =
     [
         // Qooxdoo
         qxsettings["qx.path"] + "/script/qx-" + qxsettings["qx.mode"]  
+ ".js",
         // Add here your scripts to load, you can use qxsettings[]  
for base paths, etc...
ADD YOUR JS FILE HERE
     ];

     // [Script Loader]
     //
     // There is simple progress bar that can be customized. It's  
important to
     // remove it from DOM when loading is finished.
     (function() {
         //        var w = 00;
         var h = 14;
         var totalFile = qxscripts.length;
         var loadedFile = 0;

         var body = document.getElementsByTagName("body")[0];
         var bar = document.getElementById("bar");
         var pbarcontainer = document.getElementById("pbarcontainer");
         var ptext = document.getElementById("ptext");
         var pbor = document.createElement("div");
         var pbar = document.createElement("div");

         pbor.style.position = "relative";
         pbor.style.marginLeft = "15%";
         pbor.style.marginRight = "15%";
         pbor.style.border = "solid 1px #000000";
         pbor.style.background = "#FFFFFF";
         pbor.style.width = "70%";
         pbor.style.height = h + "px";

         pbar.style.position = "absolute";
         pbar.style.border = "0px";
         pbar.style.background = "#24ACF6";
         pbar.style.width = "0px";
         pbar.style.height = h + "px";

         ScriptLoader.load({
             scripts: qxscripts,

             start: function() {
                 pbarcontainer.appendChild(pbor);
                 pbor.appendChild(pbar);
             },

             finish: function() {
                 pbor.removeChild(pbar);
                 pbarcontainer.removeChild(pbor);
                 body.removeChild(bar);
             },

             progress: function(percent, file) {
                 loadedFile++;
                 pbar.style.width = "" + Math.floor(percent * 100) +  
"%";
                 ptext.innerHTML = "" + loadedFile + " / " + totalFile;
             }
         });
     }());
</script>
</html>


------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to