Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <bryan@olenepal.org>2009-09-10 03:17:26 (GMT)
committer root <bryan@olenepal.org>2009-09-10 03:17:26 (GMT)
commit248a50026a1df7cd1f8ce2617ef3d666773bd00c (patch)
treecf268435eb51e338b17fb0a76ed665bfbc4d65d1
parent7aeb4e80af07bd301f0cd6250e01e86a8b783e93 (diff)
parent0f300b3d8e86bf49075a4eca86dbfbd5b74fd8c7 (diff)
Merge branch 'master' of gitorious@git.sugarlabs.org:karma/mainline
-rw-r--r--examples/adding_up_to_10/exercise.html1
-rwxr-xr-xexamples/adding_up_to_10/index.html1
-rwxr-xr-xexamples/adding_up_to_10/js/lesson_multiple.js8
-rwxr-xr-xjs/jquery.karma.js27
4 files changed, 24 insertions, 13 deletions
diff --git a/examples/adding_up_to_10/exercise.html b/examples/adding_up_to_10/exercise.html
index 1318d0c..eaf3d63 100644
--- a/examples/adding_up_to_10/exercise.html
+++ b/examples/adding_up_to_10/exercise.html
@@ -6,6 +6,7 @@
<link type="text/css" rel="stylesheet" href="css/lesson.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="image/ico" rel="icon" href="../../assets/default/images/favicon.ico" />
+ <link type="text/css" rel="stylesheet" href="../../css/karma.css" />
<script type="text/javascript" src="../../js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../../js/karma.Gettext.js"></script>
<script type="text/javascript" src="../../js/jquery.karma.js"></script>
diff --git a/examples/adding_up_to_10/index.html b/examples/adding_up_to_10/index.html
index 738828e..ac27b7d 100755
--- a/examples/adding_up_to_10/index.html
+++ b/examples/adding_up_to_10/index.html
@@ -6,6 +6,7 @@
<link type="text/css" rel="stylesheet" href="css/lesson.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="image/ico" rel="icon" href="../../assets/default/images/favicon.ico" />
+ <link type="text/css" rel="stylesheet" href="../../css/karma.css" />
<script type="text/javascript" src="../../js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../../js/karma.Gettext.js"></script>
<script type="text/javascript" src="../../js/jquery.karma.js"></script>
diff --git a/examples/adding_up_to_10/js/lesson_multiple.js b/examples/adding_up_to_10/js/lesson_multiple.js
index a58169e..b128938 100755
--- a/examples/adding_up_to_10/js/lesson_multiple.js
+++ b/examples/adding_up_to_10/js/lesson_multiple.js
@@ -2,8 +2,8 @@ $(document).ready(function(){
var k = $.karma ({container: "#karma-main"});
k.init({
images: [
- {id: "ball", file: "ball.png", localized : false },
- {id: "balloon", file: "balloon.png", localized : false },
+ {id: "ball", file: "ball37.png", localized : false },
+ {id: "balloon", file: "balloo.png", localized : false },
{id: "banana", file: "banana.png", localized : false },
{id: "chilli", file: "chilli.png", localized : false },
{id: "fish" , file: "fish.png", localized : false },
@@ -39,10 +39,10 @@ k.main(function() {
"click",
function(){surfaces["inline2"].clear();}
);
-
+ /*
surfaces["inline1"].ctx.fillStyle = "#00f";
surfaces["inline1"].ctx.fillRect(0, 0, 150, 150);
surfaces["card1"].ctx.fillStyle = "#000";
- surfaces["card1"].ctx.fillRect(0, 0, 150, 150);
+ surfaces["card1"].ctx.fillRect(0, 0, 150, 150);*/
});
}); \ No newline at end of file
diff --git a/js/jquery.karma.js b/js/jquery.karma.js
index bd2aead..d7407ef 100755
--- a/js/jquery.karma.js
+++ b/js/jquery.karma.js
@@ -421,6 +421,10 @@ Karma.prototype.main = function ( cb ) {
loading ...<div id=\"karma-loader\" class=\"status\"></div></div>');
var statusDiv = $("#karma-loader .status");
+ var statusUpdate = function ( current, error, total) {
+ statusDiv.html(current + "/" + total + (error > 0 ? " [ "+error+" ]":''));
+ }
+
var that = this;
var categories = ["images", "sounds", "videos" ];
var counters = { "loaded":0, "error": 0 };
@@ -431,24 +435,32 @@ Karma.prototype.main = function ( cb ) {
Karma.prototype.surface.call( that, config );
});
}
+ statusUpdate( 0, 0, totalItems);
//get the total items
for ( var i=0; i < categories.length; i++ ) {
if ( valid ( this.pendingToLoad[ categories[ i ] ] ) ) {
totalItems += this.pendingToLoad[ categories[ i ] ].length;
}
}
- statusDiv.html("0/"+totalItems);
+
/**
callback to check if all the items were loaded or got an error when
loading
**/
+ var errors=[];
var checkAllLoaded = function ( ev ) {
if ( ev.type === "load") counters.loaded += 1;
- else counters.error += 1;
- statusDiv.html( counters.loaded + counters.error + "/" + totalItems);
+ else {
+ errors.push( ev.target.src );
+ counters.error += 1;
+ }
+ statusUpdate( counters.loaded, counters.error, totalItems);
if ( counters.loaded + counters.error === totalItems ) {
- $("#karma-loader:hiden:first").fadeOut(
- "slow",function(){ $(this).remove();});
+ if ( counters.error > 0 ){
+ throw ( "Images not found: " + errors );
+ }
+ $("#karma-loader:hiden:first").fadeOut("slow",function(){
+ $(this).remove();});
if ( cb ) cb();
}
}
@@ -642,14 +654,11 @@ var KSurface = Class(
}else {
this.canvas = document.getElementById( options.canvas );
if ( !this.canvas ){
- throw new Error ("The canvas id doesn't exist");
+ throw new Error ("The canvas id doesn't exist");
}
this.width = this.canvas.width;
this.height = this.canvas.height;
-
- if (!this.id){
this.id = this.canvas.id;
- }
}
if ( this.canvas.getContext ) {
this.ctx = this.canvas.getContext("2d");