Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Berry <bryan@olenepal.org>2010-02-01 04:42:51 (GMT)
committer Bryan Berry <bryan@olenepal.org>2010-02-01 04:42:51 (GMT)
commit2dcde719f3b7854110b15e2fc22ae3d5f6cb3fd7 (patch)
tree58e6716b62710118f07591fdf33f904cf07ba15c
parent12c868645fcf94a4a11544950582040e99df21b3 (diff)
change out custom shuffle functions for k.rand()
-rw-r--r--examples/English_Animal_Identification/assets/image/background.pngbin0 -> 736613 bytes
-rw-r--r--examples/English_Animal_Identification/assets/image/background1.pngbin0 -> 736592 bytes
-rwxr-xr-xexamples/English_Animal_Identification/css/lesson.css36
-rwxr-xr-xexamples/English_Animal_Identification/index.html1
-rwxr-xr-xexamples/English_Animal_Identification/js/lesson.js156
-rw-r--r--examples/English_Animal_Identification/start.html2
6 files changed, 77 insertions, 118 deletions
diff --git a/examples/English_Animal_Identification/assets/image/background.png b/examples/English_Animal_Identification/assets/image/background.png
new file mode 100644
index 0000000..25911d1
--- /dev/null
+++ b/examples/English_Animal_Identification/assets/image/background.png
Binary files differ
diff --git a/examples/English_Animal_Identification/assets/image/background1.png b/examples/English_Animal_Identification/assets/image/background1.png
new file mode 100644
index 0000000..c972f15
--- /dev/null
+++ b/examples/English_Animal_Identification/assets/image/background1.png
Binary files differ
diff --git a/examples/English_Animal_Identification/css/lesson.css b/examples/English_Animal_Identification/css/lesson.css
index 8b35799..7646c16 100755
--- a/examples/English_Animal_Identification/css/lesson.css
+++ b/examples/English_Animal_Identification/css/lesson.css
@@ -1,6 +1,10 @@
@CHARSET "UTF-8";
body {
background: url(../assets/image/background.jpg) no-repeat;
+ width: 1200px;
+ height: 884px;
+ -moz-background-size: 100% 100%;
+ -webkit-background-size: 100% 100%;
}
@@ -13,30 +17,21 @@ body {
}
#questionBox{
- color: red;
- border: 3px outset #0AF9dd;
- width: 150px;
- padding: 5px;
- background: #2EFEF7;
- font: 20px "Helvetica", Verdana, Geneva, Arial, sans-serif;
+ color: blue;
+ width: 300px;
+ font: "Helvetica", Verdana, Geneva, Arial, sans-serif;
font-weight: bold;
+ font-size: 2em;
}
.imageBox{
margin-top: 25px;
margin-left: 30px;
width: 220px;
- height: 220px;
+ height: 220px;
padding: 10px;
}
-.checkedOption{
- margin-top: 100px;
- width:120px;
- height:120px;
- padding: 5px;
-}
-
#options{
margin-left:25px;
margin-top:50px;
@@ -53,19 +48,6 @@ body {
border: 2px solid green;
}
-/*
-#scoreArea{
- color: red;
- width: 40%;
- padding: 5px;;
- background: #FFFFFF;
- border: 2px solid red;
- background: black;
- padding: 10px;
- width: 500px;
- height: 200px;
-}
-*/
.playAgain{
position:absolute;
top: 10px;
diff --git a/examples/English_Animal_Identification/index.html b/examples/English_Animal_Identification/index.html
index 5d8ffe2..27ce9c3 100755
--- a/examples/English_Animal_Identification/index.html
+++ b/examples/English_Animal_Identification/index.html
@@ -49,7 +49,6 @@
<div id="gameArea">
<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">
diff --git a/examples/English_Animal_Identification/js/lesson.js b/examples/English_Animal_Identification/js/lesson.js
index 45f76b3..0aa3307 100755
--- a/examples/English_Animal_Identification/js/lesson.js
+++ b/examples/English_Animal_Identification/js/lesson.js
@@ -1,5 +1,10 @@
$(document).ready(
function(){
+
+ if (window.innerWidth !== 1200){
+ $('body').css({width: window.innerWidth, height: window.innerHeight});
+ }
+
var k = Karma({
audio: [{'name':'correct','file':'correct.ogg'},
{'name':'incorrect','file':'incorrect.ogg'}
@@ -14,6 +19,7 @@ $(document).ready(
var optPosition = [];
var optOtherPos = [];
var imageObject = [];
+ var imgNames = ["Bear", "Cow", "Elephant", "Horse", "Tiger", "Goat"];
var correctPosition;
var selectedOption;
var score = 0;
@@ -22,7 +28,7 @@ $(document).ready(
var t;
var current_image;
- var $help = $('#kHeaderHelp').dialog({
+ var $help = $('#kHelpText').dialog({
position:[ "right", "top"], modal:'true',autoOpen:false
});
@@ -45,17 +51,10 @@ $(document).ready(
function checkDisplay(){ //Displays the correct and incorrect info
if(wrong_selected == 1){
- $('.checkedOption').show();
$feedback.feedback('incorrect');
- $('.checkedOption').fadeOut(1000);
}
else{
- $('.checkedOption').hide();
- //document.getElementById("check").src = "assets/image/correct.png";
- // k.audio.correct.play();
$feedback.feedback('correct');
- $('.checkedOption').fadeOut(2000);
- //needs timer for holding on for abt a sec
}
}
@@ -85,63 +84,40 @@ $(document).ready(
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;
+ function load_images(){
+ imageObject = k.shuffle([1, 2, 3, 4, 5, 6]);
}
- function load_images(){
+ function selected_Option_Process(selectedOption){
+
+ if(selectedOption == correctPosition){
+ object_counter++;
+ if(wrong_selected == 0){
+ score++;
+ kFooter.kFooter('inc');
+ kFooter.kFooter('incTotal');
+ }
+ wrong_selected = 0;
- 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
- }
-
-
+ checkDisplay();
+ //t=setTimeout('game()',1000);
+ game();
+ }
+ else {
+ wrong_selected = 1;
+ kFooter.kFooter('incTotal');
+ checkDisplay();
+ }
+
}
- function selected_Option_Process(selectedOption){
-
- if(selectedOption == correctPosition){
- object_counter++;
- if(wrong_selected == 0){
- score++;
- kFooter.kFooter('inc');
- kFooter.kFooter('incTotal');
- }
- wrong_selected = 0;
-
- checkDisplay();
- //t=setTimeout('game()',1000);
- game();
- }
- else {
- wrong_selected = 1;
- kFooter.kFooter('incTotal');
- checkDisplay();
- }
-
- }
+
function game(){
-
- //clearTimeout(t);
wrong_selected = 0;
- //current_image = object_counter-1;
current_image = object_counter%6;
- document.getElementById("imgObject").src = "assets/image/"+imageObject[current_image]+".png";
+ document.getElementById("imgObject").src = "assets/image/" +
+ imageObject[current_image] + ".png";
//find correct answer and apply it to the position
var currentImage = imageObject[current_image];
@@ -149,50 +125,52 @@ $(document).ready(
//generate choices
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
+ 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 = get_random_position();
-
+
+ correctPosition = k.rand(0, 3);
+
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);
-
+ 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];
+ 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
+
+
+ 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/examples/English_Animal_Identification/start.html b/examples/English_Animal_Identification/start.html
index 1ee9e0d..7c923ff 100644
--- a/examples/English_Animal_Identification/start.html
+++ b/examples/English_Animal_Identification/start.html
@@ -55,7 +55,7 @@
<script type="text/javascript">
if (window.innerWidth !== 1200){
//$('#kStart').css({width:'800px', height:'600px'});
- $('#kStart').css({width: window.innerWidth -13, height: window.innerHeight -13});
+ $('#kStart').css({width: window.innerWidth, height: window.innerHeight -13});
}
</script>
</body>