Skip to content

Commit

Permalink
Update entangled cables routine #2
Browse files Browse the repository at this point in the history
  • Loading branch information
daformat committed Sep 23, 2013
1 parent 2c62f71 commit a09b57e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions web/js/entangled-cables.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,13 @@ $(function(){

applyCableBehavior($(this), $cableJack, n, i);


});

}

//
// Apply cable behavior
var applyCableBehavior = function ($cableNumber, $cableJack, n, i){
$cableJack.addClass("n"+$cableNumber.text()+"-");

if( $cableNumber.text() == n ) {
// Answer is correct
$cableJack.click(function() {
Expand All @@ -95,10 +94,11 @@ $(function(){
} else {
//Answer is wrong
electrifyCable($cableJack);
}
}

}

// Picking the wrong cable plays an animation to simulate electric shock
// Picking the wrong cable plays an animation to simulate an electric shock
var electrifyCable = function ($cable) {
var $d = $('.dialog');

Expand Down Expand Up @@ -178,6 +178,7 @@ $(function(){
return size;
};

// Need to be refactored ?
pickRandomCableSet();
randomizeCables();
setCorrectCable(42);
Expand Down

0 comments on commit a09b57e

Please sign in to comment.