diff options
author | Bryan Berry <bryan@olenepal.org> | 2010-03-13 09:09:03 (GMT) |
---|---|---|
committer | Bryan Berry <bryan@olenepal.org> | 2010-03-13 09:09:03 (GMT) |
commit | 83c1eef1730c36e434085534a8422fecef6b047f (patch) | |
tree | fd1307dcd0e610031fca9b2b8046670cf8b5c759 | |
parent | a5906e438f9468b0eb3458cf1a7251c29f9a2714 (diff) |
realign files in 6_English_animalIdentification
40 files changed, 479 insertions, 311 deletions
diff --git a/lessons/2_English_animalIdentification/English_Animal_Identification/index.html b/lessons/2_English_animalIdentification/English_Animal_Identification/index.html deleted file mode 100755 index e08f815..0000000 --- a/lessons/2_English_animalIdentification/English_Animal_Identification/index.html +++ /dev/null @@ -1,66 +0,0 @@ -<!DOCTYPE html>
-<html lang="en">
-<head>
- <title>English_Animal Identification</title>
-
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-
- <link type="image/ico" rel="icon" href="../../assets/image/favicon.ico" />
- <link type="text/css" rel="stylesheet" href="../../css/karma.css" />
- <link type="text/css" rel="stylesheet" href="../../css/ui.kHeader.css" />
- <link type="text/css" rel="stylesheet" href="../../css/ui.kFooter.css" />
- <link type="text/css" rel="stylesheet" href="css/lesson.css" />
-
- <script type="text/javascript" src="../../js/jquery-1.3.2.min.js"></script>
- <script type="text/javascript" src="../../js/jquery.i18n.js"></script>
- <script type="text/javascript"
- src="../../js/ui.core-draggable-resizable-dialog.js"></script>
- <script type="text/javascript" src="../../js/ui.kHeader.js"></script>
- <script type="text/javascript" src="../../js/ui.kFooter.js"></script>
- <script type="text/javascript" src="./js/messages.es.json"></script>
- <script type="text/javascript" src="../../js/ui.feedback.js"></script>
- <script type="text/javascript" src="../../js/karma.js"></script>
- <script type="text/javascript" src="js/lesson.js"></script>
-
-</head>
-<body>
- <div id="kHeader">
- </div>
-
- <!-- Put the help text here -->
- <div id="kHelp" title="Help Title"> Help text here</div>
-
- <div id="feedback"></div>
- <div id="kMain">
- <div id="questionBox">What is this?</div>
-
- <div id="imageBox">
- <img class="imageBox" id="imgObject" src="" alt=""/>
- </div>
-
- <div id="options">
- <span class="option" id="option0"></span>
- <span class="option" id="option1"></span>
- <span class="option" id="option2"></span>
- <span class="option" id="option3"></span>
- </div>
-
- <!--<img class = "imageBox" id="imgObject" src="" alt=""/>
-
- <div id="options">
- <a href="#" id="anchorOpt0">
- <img class="optImg" id="option0" src="" alt=""/>
- </a>
- <a href="#" id="anchorOpt1"><img class="optImg" id="option1" src="" alt=""/></a>
- <a href="#" id="anchorOpt2"><img class="optImg" id="option2" src="" alt=""/></a>
- <a href="#" id="anchorOpt3"><img class="optImg" id="option3" src="" alt=""/></a>
- </div>
-
- <div id="gameOver">
- Game Over
- </div>-->
- </div>
- <div id="kFooter">
- </div>
-</body>
-</html>
\ No newline at end of file diff --git a/lessons/2_English_animalIdentification/assets/audio/correct.ogg b/lessons/2_English_animalIdentification/assets/audio/correct.ogg Binary files differnew file mode 100755 index 0000000..a0d9e3a --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/audio/correct.ogg diff --git a/lessons/2_English_animalIdentification/assets/audio/incorrect.ogg b/lessons/2_English_animalIdentification/assets/audio/incorrect.ogg Binary files differnew file mode 100755 index 0000000..4805e55 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/audio/incorrect.ogg diff --git a/lessons/2_English_animalIdentification/assets/image/1.png b/lessons/2_English_animalIdentification/assets/image/1.png Binary files differnew file mode 100755 index 0000000..fe825da --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/1.png diff --git a/lessons/2_English_animalIdentification/assets/image/2.png b/lessons/2_English_animalIdentification/assets/image/2.png Binary files differnew file mode 100755 index 0000000..758d6f5 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/2.png diff --git a/lessons/2_English_animalIdentification/assets/image/3.png b/lessons/2_English_animalIdentification/assets/image/3.png Binary files differnew file mode 100755 index 0000000..2c86afb --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/3.png diff --git a/lessons/2_English_animalIdentification/assets/image/4.png b/lessons/2_English_animalIdentification/assets/image/4.png Binary files differnew file mode 100755 index 0000000..8253cc5 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/4.png diff --git a/lessons/2_English_animalIdentification/assets/image/5.png b/lessons/2_English_animalIdentification/assets/image/5.png Binary files differnew file mode 100755 index 0000000..609ab6e --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/5.png diff --git a/lessons/2_English_animalIdentification/assets/image/6.png b/lessons/2_English_animalIdentification/assets/image/6.png Binary files differnew file mode 100755 index 0000000..ccc9cf1 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/6.png diff --git a/lessons/2_English_animalIdentification/assets/image/background.png b/lessons/2_English_animalIdentification/assets/image/background.png Binary files differnew file mode 100755 index 0000000..146c777 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/background.png diff --git a/lessons/2_English_animalIdentification/assets/image/bear.png b/lessons/2_English_animalIdentification/assets/image/bear.png Binary files differnew file mode 100755 index 0000000..fe825da --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/bear.png diff --git a/lessons/2_English_animalIdentification/assets/image/correct.png b/lessons/2_English_animalIdentification/assets/image/correct.png Binary files differnew file mode 100755 index 0000000..d6e54a8 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/correct.png diff --git a/lessons/2_English_animalIdentification/assets/image/cow.png b/lessons/2_English_animalIdentification/assets/image/cow.png Binary files differnew file mode 100755 index 0000000..758d6f5 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/cow.png diff --git a/lessons/2_English_animalIdentification/assets/image/elephant.png b/lessons/2_English_animalIdentification/assets/image/elephant.png Binary files differnew file mode 100755 index 0000000..2c86afb --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/elephant.png diff --git a/lessons/2_English_animalIdentification/assets/image/goat.png b/lessons/2_English_animalIdentification/assets/image/goat.png Binary files differnew file mode 100755 index 0000000..ccc9cf1 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/goat.png diff --git a/lessons/2_English_animalIdentification/assets/image/horse.png b/lessons/2_English_animalIdentification/assets/image/horse.png Binary files differnew file mode 100755 index 0000000..8253cc5 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/horse.png diff --git a/lessons/2_English_animalIdentification/assets/image/image_name/1.png b/lessons/2_English_animalIdentification/assets/image/image_name/1.png Binary files differnew file mode 100755 index 0000000..6f01040 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/image_name/1.png diff --git a/lessons/2_English_animalIdentification/assets/image/image_name/10.png b/lessons/2_English_animalIdentification/assets/image/image_name/10.png Binary files differnew file mode 100755 index 0000000..788fda4 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/image_name/10.png diff --git a/lessons/2_English_animalIdentification/assets/image/image_name/2.png b/lessons/2_English_animalIdentification/assets/image/image_name/2.png Binary files differnew file mode 100755 index 0000000..143ae9d --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/image_name/2.png diff --git a/lessons/2_English_animalIdentification/assets/image/image_name/3.png b/lessons/2_English_animalIdentification/assets/image/image_name/3.png Binary files differnew file mode 100755 index 0000000..eb0bfdf --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/image_name/3.png diff --git a/lessons/2_English_animalIdentification/assets/image/image_name/4.png b/lessons/2_English_animalIdentification/assets/image/image_name/4.png Binary files differnew file mode 100755 index 0000000..c602d76 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/image_name/4.png diff --git a/lessons/2_English_animalIdentification/assets/image/image_name/5.png b/lessons/2_English_animalIdentification/assets/image/image_name/5.png Binary files differnew file mode 100755 index 0000000..6211dd2 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/image_name/5.png diff --git a/lessons/2_English_animalIdentification/assets/image/image_name/6.png b/lessons/2_English_animalIdentification/assets/image/image_name/6.png Binary files differnew file mode 100755 index 0000000..8e63238 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/image_name/6.png diff --git a/lessons/2_English_animalIdentification/assets/image/image_name/7.png b/lessons/2_English_animalIdentification/assets/image/image_name/7.png Binary files differnew file mode 100755 index 0000000..9be09b3 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/image_name/7.png diff --git a/lessons/2_English_animalIdentification/assets/image/image_name/8.png b/lessons/2_English_animalIdentification/assets/image/image_name/8.png Binary files differnew file mode 100755 index 0000000..efc190e --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/image_name/8.png diff --git a/lessons/2_English_animalIdentification/assets/image/image_name/9.png b/lessons/2_English_animalIdentification/assets/image/image_name/9.png Binary files differnew file mode 100755 index 0000000..3e22423 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/image_name/9.png diff --git a/lessons/2_English_animalIdentification/assets/image/incorrect.png b/lessons/2_English_animalIdentification/assets/image/incorrect.png Binary files differnew file mode 100755 index 0000000..789db87 --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/incorrect.png diff --git a/lessons/2_English_animalIdentification/assets/image/tiger.png b/lessons/2_English_animalIdentification/assets/image/tiger.png Binary files differnew file mode 100755 index 0000000..609ab6e --- /dev/null +++ b/lessons/2_English_animalIdentification/assets/image/tiger.png diff --git a/lessons/2_English_animalIdentification/css/lesson.css b/lessons/2_English_animalIdentification/css/lesson.css index ddc08b8..d3f1795 100755 --- a/lessons/2_English_animalIdentification/css/lesson.css +++ b/lessons/2_English_animalIdentification/css/lesson.css @@ -1,69 +1,58 @@ @CHARSET "UTF-8"; -body { - background: url(../assets/images/background.jpg) no-repeat; +#kMain { + background: url(../assets/image/background.png) no-repeat; + -moz-background-size: 100% 100%; + -webkit-background-size: 100% 100%; } - -#gameArea{ - margin-top:5%; - margin-left: 10%; - float: left; - width: 50% - padding:10px; -} - - #questionBox{ - color: red; - border: 3px outset #0AF9dd; - width: 150px; - padding: 5px; - background: #2EFEF7; - font: 20px "Helvetica", Verdana, Geneva, Arial, sans-serif; + color: blue; + width: 40%; font-weight: bold; - + font-size: 3em; + margin-top: 10%; + margin-left: 15%; } -.imageBox{ - margin-top: 25px; - margin-left: 30px; - width: 220px; - height: 220px; - padding: 10px; + +#imageBox{ + width: 220px; + height: 220px; } -.checkedOption{ - margin-top: 100px; - width:120px; - height:120px; - padding: 5px; +.imageBox{ + margin-top: 2%; + margin-left: 20%; + width: 220px; + height: 220px; + visibility: hidden; } #options{ - margin-left:25px; - margin-top:50px; - width:600px; - height:80px; - padding: 10px; + margin-left:5%; + margin-top:2%; + width: 70%; + height: 2em; } -.optImg{ - width:120px; +.option{ + width: 22%; height: 40px; + display:inline-block; background-color: yellow; padding:5px; border: 2px solid green; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + cursor: pointer; + font-size: 3em; + text-align: center; } -#scoreArea{ - color: red; - width: 40%; - padding: 5px;; - background: #FFFFFF; - border: 2px solid red; - background: black; - padding: 10px; +.option:hover{ + background-color: rgba(0, 255, 255, 1); } -.playAgain{ + +/*.playAgain{ position:absolute; top: 10px; margin-left:220px; @@ -74,13 +63,17 @@ body { input{ color:green; -} +} + #gameOver{ margin-left:300px; width: 180px; height: 20px; + display: none; font: 25px "Rockwell Extra Bold", Geneva, Arial, Helvetica, sans-serif,Times New Roman; font-weight: bold; background-color: #ccc; padding: 10px; } + +*/
\ No newline at end of file diff --git a/lessons/2_English_animalIdentification/index.html b/lessons/2_English_animalIdentification/index.html index b186829..632d247 100755 --- a/lessons/2_English_animalIdentification/index.html +++ b/lessons/2_English_animalIdentification/index.html @@ -2,37 +2,51 @@ <html lang="en">
<head>
<title>English_Animal Identification</title>
- <meta name="keywords" content="karma,javascript,html5,sugar,sugarlabs,gsoc,ole,nepal,animals identification" />
+
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+
+ <link type="image/ico" rel="icon" href="../../assets/image/favicon.ico" />
+ <link type="text/css" rel="stylesheet" href="../../css/karma.css" />
+ <link type="text/css" rel="stylesheet" href="../../css/ui.kHeader.css" />
+ <link type="text/css" rel="stylesheet" href="../../css/ui.kFooter.css" />
<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/lesson.css" />
- <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
+
+ <script type="text/javascript" src="../../js/jquery-1.3.2.min.js"></script>
+ <script type="text/javascript" src="../../js/jquery.i18n.js"></script>
+ <script type="text/javascript"
+ src="../../js/ui.core-draggable-resizable-dialog.js"></script>
+ <script type="text/javascript" src="../../js/ui.kHeader.js"></script>
+ <script type="text/javascript" src="../../js/ui.kFooter.js"></script>
+ <script type="text/javascript" src="./js/messages.es.json"></script>
+ <script type="text/javascript" src="../../js/ui.feedback.js"></script>
+ <script type="text/javascript" src="../../js/karma.js"></script>
<script type="text/javascript" src="js/lesson.js"></script>
+
</head>
<body>
- <div id ="scoreArea">
- <form name="scoreDisplay">
- <b>Score:</b> <input type="text" size="1" name="score">
- <b>Total:</b> <input type="text" size="1" name="total">
- </form>
- <a href="#" id="anchorPlayAgain"><img class="playAgain" src="assets/images/play_again.jpg" alt=""></a>
+ <div id="kHeader">
</div>
- <div id="gameArea">
+
+ <!-- Put the help text here -->
+ <div id="kHelp" title="Help Title"> Help text here</div>
+
+ <div id="feedback"></div>
+ <div id="kMain">
<div id="questionBox">What is this?</div>
- <img class = "imageBox" id="imgObject" src="" alt="">
- <img class="checkedOption" id="check" src="" alt="">
-
- <div id="options">
- <a href="#" id="anchorOpt0"><img class="optImg" id="option0" src="" alt=""></a>
- <a href="#" id="anchorOpt1"><img class="optImg" id="option1" src="" alt=""></a>
- <a href="#" id="anchorOpt2"><img class="optImg" id="option2" src="" alt=""></a>
- <a href="#" id="anchorOpt3"><img class="optImg" id="option3" src="" alt=""></a>
+
+ <div id="imageBox">
+ <img class="imageBox" id="imgObject" src="" alt=""/>
</div>
-
- <div id="gameOver" style= "display:none">
- Game Over
+
+ <div id="options">
+ <span class="option" id="option0"></span>
+ <span class="option" id="option1"></span>
+ <span class="option" id="option2"></span>
+ <span class="option" id="option3"></span>
</div>
+
+ </div>
+ <div id="kFooter">
</div>
</body>
</html>
\ No newline at end of file diff --git a/lessons/2_English_animalIdentification/English_Animal_Identification/index.html~ b/lessons/2_English_animalIdentification/index.html~ index c32dfc3..c32dfc3 100755 --- a/lessons/2_English_animalIdentification/English_Animal_Identification/index.html~ +++ b/lessons/2_English_animalIdentification/index.html~ diff --git a/lessons/2_English_animalIdentification/js/lesson.js b/lessons/2_English_animalIdentification/js/lesson.js index 63f4d42..f932b4c 100755 --- a/lessons/2_English_animalIdentification/js/lesson.js +++ b/lessons/2_English_animalIdentification/js/lesson.js @@ -1,186 +1,159 @@ -$(document).ready(function(){ - var flag, i ,j; - var object_counter = 1; - var imgNameRand = []; - var optPosition = []; - var optOtherPos = []; - var imageObject = []; - var correctPosition; - var selectedOption; - var score = 0; - var wrong_selected = 0; //wrong option selected so don't score up - var pos; - var t; - var current_image; - - - load_images(); //load the image numbers for random display - display_score(); - game(); //let the game begin - - - function display_score(){ - document.scoreDisplay.score.value = score; - if(object_counter > 6) - document.scoreDisplay.total.value = 6; - else - document.scoreDisplay.total.value = object_counter; - } - - function checkDisplay(){ //Displays the correct and incorrect info - if(wrong_selected == 1){ - $('.checkedOption').show(); - document.getElementById("check").src = "assets/images/incorrect.png"; - $('.checkedOption').fadeOut(1000); - } - else{ - $('.checkedOption').hide(); - document.getElementById("check").src = "assets/images/correct.png"; - $('.checkedOption').fadeOut(2000); - //needs timer for holding on for abt a sec - } - } - - $("#anchorPlayAgain").click(function(){ - $('#gameOver').hide(); - $('.optImg').show(); - $('.imageBox').show(); - load_images(); - score = 0; - object_counter = 1; - wrong_selected = 0; - display_score(); - - game(); - - }); - $("#anchorOpt0").click(function(){ - selected_Option_Process('0'); - }); - $("#anchorOpt1").click(function(){ - selected_Option_Process('1'); - }); - $("#anchorOpt2").click(function(){ - selected_Option_Process('2'); - }); - $("#anchorOpt3").click(function(){ - selected_Option_Process('3'); - }); - - function generate_random_no(no_limit) { //generate random number - var rand_no = Math.ceil(no_limit*Math.random()); - return rand_no; - } - - function get_random_position(){ //generate random number between 0-3 - var rand_pos = Math.floor(Math.random()*4); - return rand_pos; - } +$(document).ready( + function(){ + - function load_images(){ - - imageObject[0] = generate_random_no("6"); - for(i=1; i<6; i++){ - do{ - flag = 0; - imageObject[i] = generate_random_no("6"); - for(j=0; j<i; j++){ - if(imageObject[i]===imageObject[j]){ - flag++; - } - } - }while(flag != 0 ); //end of do while loop - } - - - } - function selected_Option_Process(selectedOption){ - - if(selectedOption == correctPosition){ - object_counter++; - if(wrong_selected == 0){ - score++; - } - wrong_selected = 0; - display_score(); - checkDisplay(); - //t=setTimeout('game()',1000); - game(); - } - else { - wrong_selected = 1; - checkDisplay(); - } - - } - function game(){ - - - //clearTimeout(t); - wrong_selected = 0; - current_image = object_counter-1; - document.getElementById("imgObject").src = "assets/images/"+imageObject[current_image]+".png"; - - //find correct answer and apply it to the position - currentImage = imageObject[current_image]; - imgNameRand[0] = currentImage; - //generate choices + //preloads assets into karma 'collections' + var k = Karma({ + audio: [{'name':'correct','file':'correct.ogg'}, + {'name':'incorrect','file':'incorrect.ogg'} + ], + image: [{'name': 'bear', 'file': 'bear.png'}, + {name : 'goat', file: 'goat.png'}, + {name: 'tiger', file: 'tiger.png'}, + {name: 'elephant', file: 'elephant.png'}, + {name: 'horse', file: 'horse.png'}, + {name: 'cow', file: 'cow.png'} + ] + }); + + //this command will scale down the lesson if the user's browser window + //is smaller than 950px X 600px + k.scaleWindow(); + + //sets locale, otherwise defaults to English + //$.i18n.setLocale('en'); + + //put your main lesson code here + k.ready( + function(){ + + + $('#kHeader').kHeader({'title': 'English Animal Identification', + lessonPlan: true, teachersNote: true}); + + //Set up feedback widget, this shows the user a correct or incorrect + //icon and sound when triggered programmatically + var $feedback = $('#feedback').feedback(); + + var kFooter = $('#kFooter').kFooter({'winningScore': 6}); + + var score = 0; + var names = []; + var namesUsed = []; + var correctIndex = 0; + var $img = $('#imgObject'); + var $options = $('.option'); + + + var populateListNames = function() { + var i = 0; + $.each(k.image, function (img){ + names[i] = img; + i++; + }); + }; + - for(i=1; i<4; i++){ - do{ - flag = 0; - imgNameRand[i] = generate_random_no("6"); - for(j=0; j<i; j++){ - if(imgNameRand[i]===imgNameRand[j]){ - flag++; - } - } - }while(flag != 0 ); //end of do while loop + var checkSelection = function(selectedOption){ + if(selectedOption === correctIndex){ + + score++; + kFooter.kFooter('inc'); + kFooter.kFooter('incTotal'); + + if (score === 6){ + $feedback.feedback('win'); + } else{ + $feedback.feedback('correct'); + game(); + } } - - - correctPosition = get_random_position(); - - optOtherPos[0] = correctPosition; - - for(i=1; i<4; i++){ - do{ - flag = 0; - optOtherPos[i] = get_random_position(); - for(j=0; j<i; j++){ //chek repeat within optOtherPos array - if(optOtherPos[i] === optOtherPos[j]){ - flag++; - } - } - - }while(flag != 0); - + else { + $feedback.feedback('incorrect'); + kFooter.kFooter('incTotal'); } - - for(i=0; i<4; i++){ - pos = optOtherPos[i]; - optPosition[pos] = imgNameRand[i]; + }; + + var shuffleGlobal = function (list) { + var i = 0, j = 0, t = 0; + for (i = list.length - 1; i > 0; i -= 1) { + j = Karma.rand(0, i); + t = list[i]; + list[i] = list[j]; + list[j] = t; } + }; + + var game = function(){ + correctIndex = 0; + var pickCorrect = function(){ + var correct = 0; - //random positions are stored in optOtherPos array. Great - - - for(i=0; i<4; i++){ - document.getElementById("option"+i+"").src = "assets/images/image_name/"+optPosition[i]+".png"; + var used = function(index){ + var name = names[index]; + for (var i = 0; i < namesUsed.length; i++){ + if (namesUsed[i] === name){ + return true; + } } - - //check for the correctness - if(object_counter > 6){ - - $('.optImg').hide(); - $('.imageBox').hide(); - $('#gameOver').show(); - + return false; + }; + + var getUnusedName = function(){ + correct = k.rand(0,3); + while(used(correct)){ + shuffleGlobal(names); + correct = k.rand(0,3); + } + return correct; + }; + + shuffleGlobal(names); + correct = getUnusedName(); + namesUsed.push(names[correct]); + return correct; + }; + + correctIndex = pickCorrect(); + + for (var i = 0; i < 4; i++){ + $($options[i]).text(k.image[names[i]].name); } - //else - //no change - } //end of game -}); //end of DOM
\ No newline at end of file + $img.attr('src', k.image[names[correctIndex]].src) + .css('visibility', 'visible'); + + }; + + + kFooter.bind('kFooterWinGame', + function(){ + $('.optImg').hide(); + $('.imageBox').hide(); + $('#gameOver').show(); + }); + kFooter.bind('kFooterRestart', + function() { + namesUsed = []; + correctIndex = 0; + score = 0; + game(); + } + ); + + $options.click( + function(e){ + checkSelection(parseInt(e.target.id.slice(-1))); + } + ); + + + populateListNames(); + game(); //let the game begin + + + }); //end of games + +});
\ No newline at end of file diff --git a/lessons/2_English_animalIdentification/js/lesson.js~ b/lessons/2_English_animalIdentification/js/lesson.js~ new file mode 100755 index 0000000..4d60c7d --- /dev/null +++ b/lessons/2_English_animalIdentification/js/lesson.js~ @@ -0,0 +1,191 @@ +$(document).ready( + function(){ + + var k = Karma({ + audio: [{'name':'correct','file':'correct.ogg'}, + {'name':'incorrect','file':'incorrect.ogg'} + ]}); + + k.scaleWindow(); + $.i18n.setLocale('ne'); + + k.ready( + function(){ + + var flag, i ,j; + var object_counter = 1; + var imgNameRand = []; + var optPosition = []; + var optOtherPos = []; + var imageObject = []; + var imgNames = ["Bear", "Cow", "Elephant", "Horse", "Tiger", "Goat"]; + var correctPosition; + var selectedOption; + var score = 0; + var wrong_selected = 0; //wrong option selected so don't score up + var pos; + var t; + var current_image; + + var $help = $('#kHelpText').dialog({ + position:[ "right", "top"], modal:'true',autoOpen:false + }); + + var $feedback = $('#feedback').feedback(); + + $('#kHeaderHelpBtn').click(function(){ $help.dialog('open');}); + + + $('#kHeader').kHeader({'title': 'English Animal Identification', + lessonPlan: true, teachersNote: true}); + + var kFooter = $('#kFooter').kFooter({'winningScore': 6}); + kFooter.bind('kFooterWinGame', + function(){ + $('.optImg').hide(); + $('.imageBox').hide(); + $('#gameOver').show(); + }); + kFooter.bind('kFooterRestart', + function() { + object_counter = 1; + imgNameRand = []; + optPosition = []; + optOtherPos = []; + imageObject = []; + score = 0; + wrong_selected = 0; //wrong option selected so don't score up + + load_images(); + game(); + + } + ); + + load_images(); //load the image numbers for random display + game(); //let the game begin + + + function checkDisplay(){ //Displays the correct and incorrect info + if(wrong_selected == 1){ + $feedback.feedback('incorrect'); + } + else if (object_counter === 7 ){ + $feedback.feedback('win'); + } else{ + $feedback.feedback('correct'); + } + } + + $("#anchorPlayAgain").click(function(){ + $('#gameOver').hide(); + $('.optImg').show(); + $('.imageBox').show(); + load_images(); + score = 0; + object_counter = 1; + wrong_selected = 0; + //display_score(); + kFooter.kFooter('reset'); + game(); + + }); + $("#anchorOpt0").click(function(){ + selected_Option_Process('0'); + }); + $("#anchorOpt1").click(function(){ + selected_Option_Process('1'); + }); + $("#anchorOpt2").click(function(){ + selected_Option_Process('2'); + }); + $("#anchorOpt3").click(function(){ + selected_Option_Process('3'); + }); + + + function load_images(){ + imageObject = k.shuffle([1, 2, 3, 4, 5, 6]); + } + + function selected_Option_Process(selectedOption){ + + if(selectedOption == correctPosition){ + object_counter++; + wrong_selected = 0; + score++; + kFooter.kFooter('inc'); + kFooter.kFooter('incTotal'); + checkDisplay(); + game(); + } + else { + wrong_selected = 1; + kFooter.kFooter('incTotal'); + checkDisplay(); + } + + } + + function game(){ + + wrong_selected = 0; + current_image = object_counter%6; + document.getElementById("imgObject").src = "assets/image/" + + imageObject[current_image] + ".png"; + + //find correct answer and apply it to the position + var currentImage = imageObject[current_image]; + imgNameRand[0] = currentImage; + //generate choices + + for(i=1; i<4; i++){ + do{ + flag = 0; + imgNameRand[i] = k.rand(1, 6); + for(j=0; j<i; j++){ + if(imgNameRand[i]===imgNameRand[j]){ + flag++; + } + } + }while(flag != 0 ); //end of do while loop + } + + + correctPosition = k.rand(0, 3); + + optOtherPos[0] = correctPosition; + + for(i=1; i<4; i++){ + do{ + flag = 0; + optOtherPos[i] = k.rand(0, 3); + for(j=0; j<i; j++){ //chek repeat within optOtherPos array + if(optOtherPos[i] === optOtherPos[j]){ + flag++; + } + } + + }while(flag != 0); + + } + + for(i=0; i<4; i++){ + pos = optOtherPos[i]; + optPosition[pos] = imgNameRand[i]; + //optPosition[pos] = imgNames[i]; + } + + + + //random positions are stored in optOtherPos array. Great + + + for(i=0; i<4; i++){ + document.getElementById("option"+i+"").src = "assets/image/image_name/"+optPosition[i]+".png"; + } + + + } //no change + }); //end of games +}); //end of DOM
\ No newline at end of file diff --git a/lessons/2_English_animalIdentification/js/messages.es.json b/lessons/2_English_animalIdentification/js/messages.es.json new file mode 100644 index 0000000..c9be5bd --- /dev/null +++ b/lessons/2_English_animalIdentification/js/messages.es.json @@ -0,0 +1,21 @@ +/* -*- coding: utf-8 -*- */ +$.i18n.es = {}; +$.i18n.es.strings = { + "default":{ + + }, + "$.ui.kFooter":{ + "Play Again": "Repite", + "Pause" : "Pausa", + "Start" : "Comienza", + "Timer" : "Reloj", + "Total" : "Total", + "Score" : "Puntos" + }, + "$.ui.kHeader":{ + "Lesson Plan": "Plan de Lección", + "Teacher's Note": "Nota de Profesora" + } +}; + +$(function() { $.i18n.setLocale('es'); });
\ No newline at end of file diff --git a/lessons/2_English_animalIdentification/js/messages.ne.json b/lessons/2_English_animalIdentification/js/messages.ne.json new file mode 100644 index 0000000..f0145a7 --- /dev/null +++ b/lessons/2_English_animalIdentification/js/messages.ne.json @@ -0,0 +1,21 @@ +/* -*- coding: utf-8 -*- */ +$.i18n.ne = {}; +$.i18n.ne.strings = { + "default":{ + + }, + "$.ui.kFooter":{ + "Play Again": "फेरी खेलौ", + "Pause" : "खेल रोकौ", + "Start" : "सुरु गरौ", + "Timer" : "", + "Total" : "जम्मा", + "Score" : "अङ्क" + }, + "$.ui.kHeader":{ + "Lesson Plan": "पाठविवरण", + "Teacher's Note": "पाठयोजना" + } +}; + +$(function() { $.i18n.setLocale('ne'); });
\ No newline at end of file diff --git a/lessons/2_English_animalIdentification/js/messages.ne.json~ b/lessons/2_English_animalIdentification/js/messages.ne.json~ new file mode 100644 index 0000000..c9be5bd --- /dev/null +++ b/lessons/2_English_animalIdentification/js/messages.ne.json~ @@ -0,0 +1,21 @@ +/* -*- coding: utf-8 -*- */ +$.i18n.es = {}; +$.i18n.es.strings = { + "default":{ + + }, + "$.ui.kFooter":{ + "Play Again": "Repite", + "Pause" : "Pausa", + "Start" : "Comienza", + "Timer" : "Reloj", + "Total" : "Total", + "Score" : "Puntos" + }, + "$.ui.kHeader":{ + "Lesson Plan": "Plan de Lección", + "Teacher's Note": "Nota de Profesora" + } +}; + +$(function() { $.i18n.setLocale('es'); });
\ No newline at end of file diff --git a/lessons/2_English_animalIdentification/English_Animal_Identification/kDoc.html b/lessons/2_English_animalIdentification/kDoc.html index de52962..de52962 100755 --- a/lessons/2_English_animalIdentification/English_Animal_Identification/kDoc.html +++ b/lessons/2_English_animalIdentification/kDoc.html diff --git a/lessons/2_English_animalIdentification/English_Animal_Identification/lessonPlan.html b/lessons/2_English_animalIdentification/lessonPlan.html index cec9613..cec9613 100644 --- a/lessons/2_English_animalIdentification/English_Animal_Identification/lessonPlan.html +++ b/lessons/2_English_animalIdentification/lessonPlan.html diff --git a/lessons/2_English_animalIdentification/English_Animal_Identification/start.html b/lessons/2_English_animalIdentification/start.html index 3ee8538..3ee8538 100755 --- a/lessons/2_English_animalIdentification/English_Animal_Identification/start.html +++ b/lessons/2_English_animalIdentification/start.html diff --git a/lessons/2_English_animalIdentification/English_Animal_Identification/teachersNote.html b/lessons/2_English_animalIdentification/teachersNote.html index 440129f..440129f 100755 --- a/lessons/2_English_animalIdentification/English_Animal_Identification/teachersNote.html +++ b/lessons/2_English_animalIdentification/teachersNote.html |