diff options
Diffstat (limited to 'examples/adding_up_to_10_svg')
36 files changed, 1041 insertions, 0 deletions
diff --git a/examples/adding_up_to_10_svg/assets/en/sounds/en_correct.ogg b/examples/adding_up_to_10_svg/assets/en/sounds/en_correct.ogg Binary files differnew file mode 100755 index 0000000..a0d9e3a --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/en/sounds/en_correct.ogg diff --git a/examples/adding_up_to_10_svg/assets/en/sounds/en_incorrect.ogg b/examples/adding_up_to_10_svg/assets/en/sounds/en_incorrect.ogg Binary files differnew file mode 100755 index 0000000..4805e55 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/en/sounds/en_incorrect.ogg diff --git a/examples/adding_up_to_10_svg/assets/es-MX/sounds/es-MX_correct.ogg b/examples/adding_up_to_10_svg/assets/es-MX/sounds/es-MX_correct.ogg Binary files differnew file mode 100755 index 0000000..a54f738 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/es-MX/sounds/es-MX_correct.ogg diff --git a/examples/adding_up_to_10_svg/assets/es-MX/sounds/es-MX_incorrect.ogg b/examples/adding_up_to_10_svg/assets/es-MX/sounds/es-MX_incorrect.ogg Binary files differnew file mode 100755 index 0000000..0474b93 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/es-MX/sounds/es-MX_incorrect.ogg diff --git a/examples/adding_up_to_10_svg/assets/he/sounds/he_correct.ogg b/examples/adding_up_to_10_svg/assets/he/sounds/he_correct.ogg Binary files differnew file mode 100755 index 0000000..4e12c65 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/he/sounds/he_correct.ogg diff --git a/examples/adding_up_to_10_svg/assets/he/sounds/he_incorrect.ogg b/examples/adding_up_to_10_svg/assets/he/sounds/he_incorrect.ogg Binary files differnew file mode 100755 index 0000000..9e314bb --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/he/sounds/he_incorrect.ogg diff --git a/examples/adding_up_to_10_svg/assets/images/ball37px.png b/examples/adding_up_to_10_svg/assets/images/ball37px.png Binary files differnew file mode 100755 index 0000000..4388283 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/ball37px.png diff --git a/examples/adding_up_to_10_svg/assets/images/balloon37px.png b/examples/adding_up_to_10_svg/assets/images/balloon37px.png Binary files differnew file mode 100755 index 0000000..8f47d6a --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/balloon37px.png diff --git a/examples/adding_up_to_10_svg/assets/images/banana37px.png b/examples/adding_up_to_10_svg/assets/images/banana37px.png Binary files differnew file mode 100755 index 0000000..90728e6 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/banana37px.png diff --git a/examples/adding_up_to_10_svg/assets/images/chilli.png b/examples/adding_up_to_10_svg/assets/images/chilli.png Binary files differnew file mode 100755 index 0000000..5f8b64d --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/chilli.png diff --git a/examples/adding_up_to_10_svg/assets/images/fish64px.png b/examples/adding_up_to_10_svg/assets/images/fish64px.png Binary files differnew file mode 100755 index 0000000..a29f12c --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/fish64px.png diff --git a/examples/adding_up_to_10_svg/assets/images/flower37px.png b/examples/adding_up_to_10_svg/assets/images/flower37px.png Binary files differnew file mode 100755 index 0000000..224e707 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/flower37px.png diff --git a/examples/adding_up_to_10_svg/assets/images/happyChimp_120x125.png b/examples/adding_up_to_10_svg/assets/images/happyChimp_120x125.png Binary files differnew file mode 100755 index 0000000..5e721c9 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/happyChimp_120x125.png diff --git a/examples/adding_up_to_10_svg/assets/images/happyMonkey.jpg b/examples/adding_up_to_10_svg/assets/images/happyMonkey.jpg Binary files differnew file mode 100755 index 0000000..bfe0d38 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/happyMonkey.jpg diff --git a/examples/adding_up_to_10_svg/assets/images/normalChimp_120x125.png b/examples/adding_up_to_10_svg/assets/images/normalChimp_120x125.png Binary files differnew file mode 100755 index 0000000..a731df4 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/normalChimp_120x125.png diff --git a/examples/adding_up_to_10_svg/assets/images/plussign.png b/examples/adding_up_to_10_svg/assets/images/plussign.png Binary files differnew file mode 100755 index 0000000..915c5aa --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/plussign.png diff --git a/examples/adding_up_to_10_svg/assets/images/sadChimp_120x125.png b/examples/adding_up_to_10_svg/assets/images/sadChimp_120x125.png Binary files differnew file mode 100755 index 0000000..1dec5f0 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/sadChimp_120x125.png diff --git a/examples/adding_up_to_10_svg/assets/images/scorebox.png b/examples/adding_up_to_10_svg/assets/images/scorebox.png Binary files differnew file mode 100755 index 0000000..424b60b --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/scorebox.png diff --git a/examples/adding_up_to_10_svg/assets/images/sidebar.png b/examples/adding_up_to_10_svg/assets/images/sidebar.png Binary files differnew file mode 100755 index 0000000..9632788 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/sidebar.png diff --git a/examples/adding_up_to_10_svg/assets/images/yellowBox.png b/examples/adding_up_to_10_svg/assets/images/yellowBox.png Binary files differnew file mode 100755 index 0000000..f7a72ca --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/images/yellowBox.png diff --git a/examples/adding_up_to_10_svg/assets/ne/sounds/ne_correct.ogg b/examples/adding_up_to_10_svg/assets/ne/sounds/ne_correct.ogg Binary files differnew file mode 100755 index 0000000..8ced3cd --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/ne/sounds/ne_correct.ogg diff --git a/examples/adding_up_to_10_svg/assets/ne/sounds/ne_incorrect.ogg b/examples/adding_up_to_10_svg/assets/ne/sounds/ne_incorrect.ogg Binary files differnew file mode 100755 index 0000000..106fe0f --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/ne/sounds/ne_incorrect.ogg diff --git a/examples/adding_up_to_10_svg/assets/sounds/correct.ogg b/examples/adding_up_to_10_svg/assets/sounds/correct.ogg Binary files differnew file mode 100755 index 0000000..a0d9e3a --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/sounds/correct.ogg diff --git a/examples/adding_up_to_10_svg/assets/sounds/incorrect.ogg b/examples/adding_up_to_10_svg/assets/sounds/incorrect.ogg Binary files differnew file mode 100755 index 0000000..4805e55 --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/sounds/incorrect.ogg diff --git a/examples/adding_up_to_10_svg/assets/sounds/trigger.ogg b/examples/adding_up_to_10_svg/assets/sounds/trigger.ogg Binary files differnew file mode 100755 index 0000000..f22512a --- /dev/null +++ b/examples/adding_up_to_10_svg/assets/sounds/trigger.ogg diff --git a/examples/adding_up_to_10_svg/css/knavbar.css b/examples/adding_up_to_10_svg/css/knavbar.css new file mode 100755 index 0000000..b39f205 --- /dev/null +++ b/examples/adding_up_to_10_svg/css/knavbar.css @@ -0,0 +1,139 @@ +body +{ +background: #D8D8D8; +margin:0; +padding:0; +} + +#knavbar { +display: table; +width: 800px; +margin: 0 auto; +} + +nav +{ +list-style: none; +padding: 0; +margin: 0; +float:left; +width:100%; +background: #FFFFFF; +} + +nav img +{ +border: none; +width: 58px; +} + +#welcome +{ +padding-left: 1em; +padding-right: 1em; +line-height: 3em; +} + +#subject +{ +text-align: center; +font-weight: bold; +font-size: 130%; +} + +#lesson_name +{ +text-align: center; +font-weight: bold; +font-size: 150%; +padding: 0.8em; +} + +#welcome_refs +{ +text-align: center; +font-weight: bold; +font-size: 150%; +width: 50%; +float: left; +} + +#tutorial_link +{ +width: 50%; +float: left; +} + +#tutorial_link img +{ +padding: 2em; + +} + +#exercise_link +{ +width: 50%; +float: left; +} + +#exercise_link img +{ +padding: 2em; +} + +#lesson +{ +width:800px; +background: #BDBDBD; +} + +#welcome_logo img +{ +padding: 2em; +} + +img +{ +border: none; +} + +#lessonTitle +{ +display: block; +} + +nav a:hover { +text-decoration: underline; +outline-width:1px; +outline-style:solid; +} + +nav a.selected { +text-decoration: underline; +background: #BDBDBD; +} + +.centeredImage +{ +text-align:center; +margin-top:0px; +margin-bottom:0px; +padding:0px; +} + +.icon_right +{ +float: right; +} + +.floatLeft { + float: left; + margin-left: 5px; + margin-bottom: 5px; +} + +.floatRight { + float: right; + margin-right: 5px; + margin-bottom: 5px; +}
\ No newline at end of file diff --git a/examples/adding_up_to_10_svg/css/lesson.css b/examples/adding_up_to_10_svg/css/lesson.css new file mode 100755 index 0000000..e368b14 --- /dev/null +++ b/examples/adding_up_to_10_svg/css/lesson.css @@ -0,0 +1,171 @@ +@charset "UTF-8"; + +#karma-main { +width:800px; +height:600px; +position:absolute; +} + +#main { +float:left; +position:relative; +width: 650px; +height: 600px; + +} +#side { +background-image: url(../assets/generic/images/sidebar.png); +background:none none repeat scroll 0 0; +float:left; +height:600px; +position:relative; +width:150px; +} + +#top { +width: 650px; +height: 300px; +position:relative; +} + +#bottom { +clear:both; +float:left; +width: 650px; +height: 300px; +position:relative; +} +#topLeftArea { +float:left; +width: 300px; +height: 300px; +position:relative; +} +#topMiddleArea { +background:none none repeat scroll 0 0; +float:left; +width: 50px; +height: 300px; +position:relative; +} +#topRightArea { +float:left; +width: 300px; +height:300px; +position:relative; +} +#topLeftCard { +background:none none repeat scroll 0 0; +width: 200px; +height: 200px; +left: 75px; +position:absolute; +top:50px; +} + +#topLeftPaper { +background:none none repeat scroll 0 0; +position:absolute; +top: 50px; +left: 75px; +width:200px; +height:200px; +} + +#plusSign { +display: block; +margin-left: auto; +margin-right: auto; +margin-top: 150px; +} +#topRightCard { +background: none none repeat scroll 0 0; +width: 200px; +height: 200px; +position:absolute; +right: 50px; +top: 50px; +} +#topRightPaper { +background:none none repeat scroll 0 0; +position:absolute; +left: 50px; +right:50px; +top:50px; +width:200px; +height:200px; +} + +.bottom { +background:none none repeat scroll 0 0; +float:left; +width: 216.5px; +height: 300px; +position:relative; +} + +.bottomCard { + left:25px; + position:absolute; + width: 200px; + height: 200px; + top: 20px; +} + + +.sideItem { + clear:both; + float:left; + width:150px; + height: 200px; + position: relative; +} + +#timer { +position:absolute; +width:100px; +height:150px; +top:10px; +left:25px; +} + +#timerPaper { +position:absolute; +width:100px; +height:150px; +top:10px; +left:25px; +} + +#scoreBox { +position:absolute; +width:100px; +height:150px; +top:10px; +left:25px; +z-index: 10; +} + +#scoreBoxText { +position:relative; +top:60px; +font: 70px Arial; +color: #fff; +text-align: center; +z-index: 100; +} + + +#chimpPaper { +position:absolute; +top:10px; +left:25px; +width:120px; +height:125px; +} + +#buttons { +position:absolute; +top:80%; +} + diff --git a/examples/adding_up_to_10_svg/exercise.html b/examples/adding_up_to_10_svg/exercise.html new file mode 100755 index 0000000..97d0855 --- /dev/null +++ b/examples/adding_up_to_10_svg/exercise.html @@ -0,0 +1,95 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <title>Adding up to 10 - Exercise (Alpha)</title> + <meta name="keywords" content="karma,javascript,html5,sugar,sugarlabs,gsoc,ole,nepal" /> + <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/raphael-min.js"></script> + <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> + <script type="text/javascript" src="js/lesson.js"></script> + <link rel="stylesheet" href="css/knavbar.css" type="text/css"/> + +</head> + +<body> + +<section id="navigation"> + <nav id="knavbar"> + <a href="../../chakra/grade1mathematics.html"><img src="../../assets/default/images/back.png" alt="Back" title="Back" class="floatLeft"></a> + <div id="lessonTitle" class="floatLeft"><a id="welcome" href="index_knavbar.html">Adding up to 10</a></div> + <a href="http://olenepal.org/" target="_blank"><img src="../../assets/default/images/olenepal_logo.gif" alt="OLE Nepal logo" title="OLE Nepal Web site" class="floatRight"></a> + <a href="#tab_help"><img src="../../assets/default/images/help.png" alt="Help" title="Help" class="floatRight"></a> + <img src="../../assets/default/images/tutorial_bw.png" alt="Tutorial" title="Tutorial" class="floatRight"> + <a href="exercise.html" class="selected"><img src="../../assets/default/images/exercise.png" alt="Exercise" title="Exercise" class="floatRight"></a> + </nav> +</section> + + <div id="karma-main"> + <div id="main"> + <div id="top"> + + <div id="topLeftArea"> + <img id="topLeftCard" src="assets/generic/images/yellowBox.png" alt="" /> + <div id="topLeftPaper" ></div> + + </div> + <div id="topMiddleArea"> + <img id="plusSign" src="assets/generic/images/plussign.png" alt=""/> + </div> + <div id="topRightArea"> + <img id="topRightCard" src="assets/generic/images/yellowBox.png" alt=""/> + <div id="topRightPaper"></div> + </div> + + </div> + + <div id="bottom"> + <div id="bottomLeft" class="bottom"> + <img class="bottomCard" src="assets/generic/images/yellowBox.png" alt=""/> + <div id="bottomLeftPaper" class="bottomCard"> </div> + </div> + <div id="bottomMiddle" class="bottom"> + <img class="bottomCard" src="assets/generic/images/yellowBox.png" alt=""/> + <div id="bottomMiddlePaper" class="bottomCard"> </div> + </div> + <div id="bottomRight" class="bottom"> + <img class="bottomCard" src="assets/generic/images/yellowBox.png" alt=""/> + <div id="bottomRightPaper" class="bottomCard"> </div> + </div> + + </div> + + </div> + <div id="side"> + <div class="sideItem"> + <img id="timer" src="assets/generic/images/scorebox.png" alt=""/> + <div id="timerPaper"> </div> + </div> + <div class="sideItem"> + <img id="scoreBox" src="assets/generic/images/scorebox.png" alt=""/> + <div id="scoreBoxText"></div> + </div> + <div class="sideItem"> + <div id="chimpPaper"> </div> + <div id="buttons"> + <button id="start">Start</button> + <button id="stop">Stop</button> + <button id="reset">Restart</button> + </div> + </div> + + + </div> + <div id="overlay"></div> + <div id="overlayPaper"></div> + </div> +</div> + +</body> + +</html> diff --git a/examples/adding_up_to_10_svg/index.html b/examples/adding_up_to_10_svg/index.html new file mode 100755 index 0000000..b7ce250 --- /dev/null +++ b/examples/adding_up_to_10_svg/index.html @@ -0,0 +1,83 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <title>Karma - Adding Up to 10</title> + <meta name="keywords" content="karma,javascript,html5,sugar,sugarlabs,gsoc,ole,nepal" /> + <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/raphael-min.js"></script> + <script type="text/javascript" src="../../js/jquery-1.3.2.min.js"></script> + <script type="text/javascript" src="../../js/karma.js"></script> + <script type="text/javascript" src="js/lesson.js"></script> + + + +</head> + +<body> + <div> + <div id="main"> + <div id="top"> + + <div id="topLeftArea"> + <img id="topLeftCard" src="assets/images/yellowBox.png" alt="" /> + <div id="topLeftPaper" ></div> + + </div> + <div id="topMiddleArea"> + <img id="plusSign" src="assets/images/plussign.png" alt=""/> + </div> + <div id="topRightArea"> + <img id="topRightCard" src="assets/images/yellowBox.png" alt=""/> + <div id="topRightPaper"></div> + </div> + + </div> + + <div id="bottom"> + <div id="bottomLeft" class="bottom"> + <img class="bottomCard" src="assets/images/yellowBox.png" alt=""/> + <div id="bottomLeftPaper" class="bottomCard"> </div> + </div> + <div id="bottomMiddle" class="bottom"> + <img class="bottomCard" src="assets/images/yellowBox.png" alt=""/> + <div id="bottomMiddlePaper" class="bottomCard"> </div> + </div> + <div id="bottomRight" class="bottom"> + <img class="bottomCard" src="assets/images/yellowBox.png" alt=""/> + <div id="bottomRightPaper" class="bottomCard"> </div> + </div> + + </div> + + </div> + <div id="side"> + <div class="sideItem"> + <img id="timer" src="assets/images/scorebox.png" alt=""/> + <div id="timerPaper"> </div> + </div> + <div class="sideItem"> + <img id="scoreBox" src="assets/images/scorebox.png" alt=""/> + <div id="scoreBoxText"></div> + </div> + <div class="sideItem"> + <div id="chimpPaper"> </div> + <div id="buttons"> + <button id="start">Start</button> + <button id="stop">Stop</button> + <button id="reset">Restart</button> + </div> + </div> + + + </div> + <div id="overlay"></div> + <div id="overlayPaper"></div> + </div> + + +</body> + +</html> diff --git a/examples/adding_up_to_10_svg/index_knavbar.html b/examples/adding_up_to_10_svg/index_knavbar.html new file mode 100755 index 0000000..6bd5e7a --- /dev/null +++ b/examples/adding_up_to_10_svg/index_knavbar.html @@ -0,0 +1,39 @@ +<!DOCTYPE HTML> +<html lang="en"> + +<head> +<title>Adding up to 10 - Index (Alpha)</title> +<meta name="keywords" content="karma,javascript,html5,sugar,sugarlabs,gsoc,ole,nepal"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<meta charset="utf-8"> + +<link rel="stylesheet" href="css/knavbar.css" type="text/css"/> + +<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> +<script type="text/javascript" src="js/jquery.ui.all.js"></script> + +</head> + +<body> + +<div id="lesson"> + +<nav> +<a href="../../chakra/grade1mathematics.html"><img src="../../assets/default/images/back.png" alt="Back" title="Back" class="floatLeft"></a> +<div id="lessonTitle" class="floatLeft"><a id="welcome" href="index_knavbar.html" class="selected">Adding up to 10</a></div> +</nav> + +<div id="subject">Mathematics</div> +<div id="lesson_name">Adding up to 10</div> + +<div id="tutorial_link" class="centeredImage"><img src="../../assets/default/images/tutorial_bw.png" alt="Tutorial" title="Tutorial"></div> +<div id="exercise_link" class="centeredImage"><a href="exercise.html"><img src="../../assets/default/images/exercise.png" alt="Exercise" title="Exercise"></a></div> + +<div id="welcome_refs"><a href="assets/en/docs/teachernotes.swf" target="_blank">Teacher's note</a></div> +<div id="welcome_refs"><a href="assets/en/docs/lessonplan.swf" target="_blank">Lesson plan</a></div> + +<div id="welcome_logo" class="centeredImage"><img src="../../assets/default/images/olenepal_logo.gif" alt="OLE Nepal logo" title="OLE Nepal"></div> +</div> + +</body> +</html>
\ No newline at end of file diff --git a/examples/adding_up_to_10_svg/js/lesson.js b/examples/adding_up_to_10_svg/js/lesson.js new file mode 100755 index 0000000..5c47972 --- /dev/null +++ b/examples/adding_up_to_10_svg/js/lesson.js @@ -0,0 +1,363 @@ +/* jslint browser: true +*/ +$(document).ready(function(){ + + + var k = Karma({ + images: [ + {name: "ball", file: "ball37px.png"}, + {name: "balloon", file: "balloon37px.png"}, + {name: "banana", file: "banana37px.png"}, + {name: "chilli", file: "chilli.png"}, + {name: "fish" , file: "fish64px.png"}, + {name: "flower", file: "flower37px.png"}, + {name: "normalChimp", file: "normalChimp_120x125.png"}, + {name: "happyChimp", file: "happyChimp_120x125.png"}, + {name: "sadChimp", file: "sadChimp_120x125.png"}], + sounds: [ + {name: "correct", file: "correct.ogg"}, + {name: "incorrect", file: "incorrect.ogg"}, + {name: "trigger", file: "trigger.ogg"} + ] + + }); + + +k.ready(function() { + + var imageNames = ["ball", "banana", "balloon","chilli", "fish", "flower"]; + //game logic + var cards; + var totalCorrect = 0, n0 = 0, n1 = 0, correctCard = 0, + level = 0, score = 0, numCorrectAnswers = 0; + var DRAW_MAX_X = 170, DRAW_MAX_Y = 170; + var choices=[0, 0, 0]; + var timerSpeed = 12000; + var START_TIMER_Y = 25, END_TIMER_Y = 125; + var timerPaper, chimpPaper; + var timerRect; + var normalChimpImage, sadChimpImage, happyChimpImage; + var overlayCard, topLeftCard, topRightCard, bottomLeftCard, + bottomMiddleCard, bottomRightCard; + + var buttons=[]; + var isTimerRunning = false; + var isGameRunning = false; + + + var createCard = function (paperName, width, height) { + var set; + var paper; + + if(!width || !height){ + paper = Raphael(paperName+"Paper", 200, 200); + } + else { + paper = Raphael(paperName+"Paper", width, height); + } + set = paper.set(); + return { "paper": paper, "prefix": paperName, "set": set}; + }; + + + overlayCard = createCard("overlay", 800, 600); + topLeftCard = createCard("topLeft"); + topRightCard = createCard("topRight"); + bottomLeftCard = createCard("bottomLeft"); + bottomMiddleCard = createCard("bottomMiddle"); + bottomRightCard = createCard("bottomRight"); + + + cards = [ topLeftCard, topRightCard, bottomLeftCard, + bottomMiddleCard, bottomRightCard]; + + sets = [topLeftCard.set, topRightCard.set, bottomLeftCard.set, + bottomMiddleCard.set, bottomRightCard.set]; + + + function drawCards () { + var imageId = imageNames[ level ]; + //reinitialize choices to zero + choices = [0, 0, 0]; + + cards.forEach(function (box) { + box.set.remove(); + }); + + totalCorrect = k.rand( 2, 5 + level ); //the totalCorrect + n0 = totalCorrect - k.rand(1, totalCorrect - 1 ); //first number + n1 = totalCorrect - n0; //second number + + //chose one option (the correct option) + //and then put the correct value into it + correctCard = k.rand( 0, 2 ); + choices[ correctCard ] = totalCorrect; + + var computeUniqueChoice = function(choice){ + var newChoice = 0; + if (choice === totalCorrect) { + return choice; + } else { + newChoice = k.rand( 1, 10 ); + if (newChoice === totalCorrect){ + return computeUniqueChoice(choice); + } else { + return newChoice; + } + } + }; + + choices = choices.map(computeUniqueChoice); + + var drawCard = function (card, n) { + var positions = []; + var x = 0, y = 0; + var isOverlapping = false; + var imageVarNames = {}; + var varPrefix = card.prefix; + imageVarNames[varPrefix] = []; + card.set = card.paper.set(); + + for (var i=0; i<n; i++) { + do { + isOverlapping = false; + x = k.rand( 0, DRAW_MAX_X); + y = k.rand( 0, DRAW_MAX_Y ); + for ( var j=0; j<positions.length; j++) { + if ( k.distance2( positions[j], + {"x": x, "y": y} ) < 137 ) { + isOverlapping = true; + break; + } + } + + }while ( isOverlapping === true ); + positions.push( { "x":x, "y": y } ); + imageVarNames[varPrefix][i] = card.paper. + image(k.images[imageId].src, x , y, 35, 35); + card.set.push(imageVarNames[varPrefix][i]); + } + + }; + + //put the cards + drawCard(topLeftCard, n0); + drawCard(topRightCard, n1); + drawCard(bottomLeftCard, choices[ 0 ]); + drawCard(bottomMiddleCard, choices[ 1 ]); + drawCard(bottomRightCard, choices[ 2 ]); + + } + + //put the buttons on the cards + buttons[ 0 ] = { node: $('#bottomLeftPaper')[0], num: 0}; + buttons[ 1 ] = { node: $('#bottomMiddlePaper')[0], num: 1}; + buttons[ 2 ] = { node: $('#bottomRightPaper')[0], num: 2}; + + buttons.forEach( + function(button) { + var numButton = button.num; + button.node + .addEventListener('click', function (){ + if(isGameRunning === true){ + var myButton = numButton; + chooseCard(myButton); + } + }, false); + }); + + + + + + var chooseCard = function(numButton) { + if ( choices[numButton] === totalCorrect){ + //If the player has completed all the levels + if (numCorrectAnswers === 4 && level === 5) { + congrats(); + } else { + computeScore(true, false); + resetTimer(); + animateTimer(); + drawCards(); + } + }else { + computeScore(false, false); + resetTimer(); + animateTimer(); + drawCards(); + } + }; + + + + var writeScore = function (newScore){ + $('#scoreBoxText')[0].innerHTML = newScore; + }; + + + var computeScore = function (correct, tooSlow) { + + if ( correct === false) { + //answer was incorrect or took too long + score = score - 1; + numCorrectAnswers = numCorrectAnswers - 1; + writeScore(score); + if (tooSlow === true) { + k.sounds.trigger.play(); + } else { + k.sounds.incorrect.play(); + } + //animate sad monkey + animateChimp(false); + + } else { + score = score + 1; + numCorrectAnswers = numCorrectAnswers + 1; + writeScore(score); + k.sounds.correct.play(); + animateChimp(true); + if (numCorrectAnswers == 5){ + level = level + 1; + timerSpeed = timerSpeed - 1000; + numCorrectAnswers = 0; + } + + } + + + }; + + + var startGame = function () { + score = 0; + writeScore(score); + isTimerRunning = true; + isGameRunning = true; + + //move timer back to start in case it is + //already running + resetTimer(); + + //start timer + animateTimer(); + + drawCards(); + }; + + var stopGame = function () { + writeScore(' '); + isGameRunning = false; + //stop timer + isTimerRunning = false; + resetTimer(); + + //clear the cards + cards.forEach(function (card) { + card.set.remove(); + card.set = card.paper.set(); + }); + + }; + + var resetGame = function () { + score = 0; + writeScore(score); + isTimerRunning = true; + resetTimer(); + animateTimer(); + drawCards(); + + }; + + var resetTimer = function () { + timerRect.animate({y: START_TIMER_Y}, 0); + }; + + var animateTimer = function () { + timerRect.animate({y : END_TIMER_Y}, timerSpeed, function(){ + timerRect.attr("y", START_TIMER_Y); + if (isTimerRunning === true){ + computeScore(false, true); + animateTimer(); + drawCards(); + } + }); + }; + + + var animateChimp = function (answer) { + var timerChimp; + normalChimpImage.hide(); + if( answer === true){ + happyChimpImage.show(); + } else { + sadChimpImage.show(); + } + + + timerChip = setTimeout(function() { + happyChimpImage.hide(); + sadChimpImage.hide(); + normalChimpImage.show();}, 800); + + }; + + var congrats = function () { + var congratsText; + stopGame(); + + $('#overlay').css({"position": "absolute", "background": "white", "opacity": "0.7", + "width": 800, "height": 600, "z-index": 10}); + $('#overlayPaper').css({"position": "absolute", "z-index": "100", "opacity": 1}); + congratsChimp = overlayCard.paper.image( + k.images.happyChimp.src, 200, 100, 300, 400); + congratsChimp.attr({"fill-opacity": "1", "opacity": "1"}); + congratsText = overlayCard.paper.text(400, 550, "Great Job!"); + congratsText.attr({"font-size": 80}); + overlayCard.set.push(congratsChimp, congratsText); + + congratsChimp.node.addEventListener('click', function(){ + $('#overlay').css({"opacity": 0}); + overlayCard.set.remove(); + }, false); + + }; + + document.getElementById('start'). + addEventListener('click', startGame, false); + + + document.getElementById('stop'). + addEventListener('click', stopGame, true); + + document.getElementById('reset'). + addEventListener('click', resetGame, false); + + + //set up the timer + timerPaper = Raphael('timerPaper', 100, 150); + timerRect = timerPaper.rect(7, START_TIMER_Y, 85, 20, 3); + timerRect.attr('fill', "#fff"); + + //Set up the monkeys + chimpPaper = Raphael('chimpPaper', 120, 125); + normalChimpImage = chimpPaper.image(k.images.normalChimp.src, + 0, 20, 100, 100); + sadChimpImage = chimpPaper.image(k.images.sadChimp.src, + 0, 20, 100, 100); + happyChimpImage = chimpPaper.image(k.images.happyChimp.src, + 0, 20, 100, 100); + happyChimpImage.hide(); + sadChimpImage.hide(); + + + + +}); + + + + +//end of ready +});
\ No newline at end of file diff --git a/examples/adding_up_to_10_svg/po/en.po b/examples/adding_up_to_10_svg/po/en.po new file mode 100755 index 0000000..4d1444f --- /dev/null +++ b/examples/adding_up_to_10_svg/po/en.po @@ -0,0 +1,28 @@ +# English translations for PACKAGE package. +msgid "" +msgstr "" +"Project-Id-Version: adding up to 10 v1\n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2009-07-07 04:46-0600\n" +"Last-Translator: Felipe López Toledo <zer.subzero@gmail.com>\n" +"Language-Team: karma <zer.subzero@gmail.com>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: English\n" +"X-Poedit-Country: United States\n" +"X-Poedit-SourceCharset: utf-8\n" + + +msgid "choose an option" +msgstr "choose an optionxxxxxxx" + +msgid "Time" +msgstr "Time1" + +msgid "Level" +msgstr "Level1" + +msgid "Restart" +msgstr "Restart1" + diff --git a/examples/adding_up_to_10_svg/po/es-MX.po b/examples/adding_up_to_10_svg/po/es-MX.po new file mode 100755 index 0000000..ca1e61c --- /dev/null +++ b/examples/adding_up_to_10_svg/po/es-MX.po @@ -0,0 +1,29 @@ +# Spanish translations for PACKAGE package. +msgid "" +msgstr "" +"Project-Id-Version: adding up to 10 v1\n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2009-07-07 04:46-0600\n" +"Last-Translator: Felipe López Toledo <zer.subzero@gmail.com>\n" +"Language-Team: karma <zer.subzero@gmail.com>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Spanish\n" +"X-Poedit-Country: MEXICO\n" +"X-Poedit-SourceCharset: utf-8\n" + + +msgid "choose an option" +msgstr "escoge una opción" + +msgid "Time" +msgstr "Tiempo" + +msgid "Level" +msgstr "Nivel" + +msgid "Restart" +msgstr "Reinicia" + + diff --git a/examples/adding_up_to_10_svg/po/es.po b/examples/adding_up_to_10_svg/po/es.po new file mode 100755 index 0000000..b665366 --- /dev/null +++ b/examples/adding_up_to_10_svg/po/es.po @@ -0,0 +1,29 @@ +# Spanish translations for PACKAGE package. +msgid "" +msgstr "" +"Project-Id-Version: adding up to 10 v1\n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2009-07-07 04:46-0600\n" +"Last-Translator: Felipe López Toledo <zer.subzero@gmail.com>\n" +"Language-Team: karma <zer.subzero@gmail.com>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Spanish\n" +"X-Poedit-Country: MEXICO\n" +"X-Poedit-SourceCharset: utf-8\n" + + +msgid "choose an option" +msgstr "escoge una opciónXXX" + +msgid "Time" +msgstr "Tiempo" + +msgid "Level" +msgstr "Nivel" + +msgid "Restart" +msgstr "Reinicia" + + diff --git a/examples/adding_up_to_10_svg/po/he-IL.po b/examples/adding_up_to_10_svg/po/he-IL.po new file mode 100755 index 0000000..f681aca --- /dev/null +++ b/examples/adding_up_to_10_svg/po/he-IL.po @@ -0,0 +1,28 @@ +# Hebrew translations for PACKAGE package. +msgid "" +msgstr "" +"Project-Id-Version: adding up to 10 v1\n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2009-07-07 04:46-0600\n" +"Last-Translator: Felipe López Toledo <zer.subzero@gmail.com>\n" +"Language-Team: karma <zer.subzero@gmail.com>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Hebrew\n" +"X-Poedit-Country: Israel\n" +"X-Poedit-SourceCharset: utf-8\n" + + +msgid "choose an option" +msgstr "בחר באפשרות" + +msgid "Time" +msgstr "שעה" + +msgid "Level" +msgstr "רמת" + +msgid "Restart" +msgstr "הפעל מחדש" + diff --git a/examples/adding_up_to_10_svg/resources.html b/examples/adding_up_to_10_svg/resources.html new file mode 100755 index 0000000..0e93455 --- /dev/null +++ b/examples/adding_up_to_10_svg/resources.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> +<head> + <title>Karma - Adding Up to 10</title> + <meta name="keywords" content="karma,javascript,html5,sugar,sugarlabs,gsoc,ole,nepal" /> + <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" /> + <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> + <link rel="stylesheet" href="css/knavbar.css" type="text/css"/> + +</head> + +<body> + +<div id="lesson"> +<nav> +<li><a href="../../chakra/grade1mathematics.html"><img src="../../assets/default/images/back.png" alt="Back" title="Back"></a></li> +<li><a href="../../index.html"><img src="../../assets/default/images/chakra_logo.png" alt="Chakra" title="Chakra"></a></li> +<li><a id="welcome" href="index_knavbar.html">Adding up to 10</a></li> +<li><img src="../../assets/default/images/tutorial_bw.png" alt="Tutorial" title="Tutorial"></li> +<li><a href="exercise.html"><img src="../../assets/default/images/exercise.png" alt="Exercise" title="Exercise"></a></li> +<li><a href="resources.html" class="selected"><img src="../../assets/default/images/resources.png" alt="Resources" title="Resources"></a></li> +<li><a href="#tab_help"><img src="../../assets/default/images/help.png" alt="Help" title="Help"></a></li> +<li><a href="http://olenepal.org/" target="_blank"><img src="../../assets/default/images/olenepal_logo.gif" alt="OLE Nepal logo" title="OLE Nepal Web site"></a></li> +</nav> + +<li><a href="assets/en/docs/teachernotes.swf" target="_blank">Teacher's notes</a></li> +<li><a href="assets/en/docs/lessonplan.swf" target="_blank">Lesson plan</a></li> +<li><a href="quadrilaterals.zip">Download</a></li> +</div> + +</body> + +</html> |