Commits

Anonymous committed 46dc3a5

Show packs

Comments (0)

Files changed (1)

     }
 }
 
-function make_handler(row, col) {
+function make_click_handler(row, col) {
     return function() {
         on_click(row, col);
     }
 }
 
+function on_hover(row, col) {
+    var pack = same_color_pack(row, col);
+    if (pack.length < 2) {
+        return;
+    }
+
+    $.each(pack, function() {
+        BOARD[this[0]][this[1]].fadeOut('fast').fadeIn('fast');
+    });
+}
+
+function make_hover_handler(row, col) {
+    return function() {
+        on_hover(row, col);
+    }
+}
+
 function set_score(score) {
     $('#score').html(score);
 }
         for (var col = 0; col < NUM_COLS; ++col) {
             var td = $('<td></td>');
             var img = $('<img />').attr('src', BLANK);
-            img.click(make_handler(row, col));
+            img.click(make_click_handler(row, col));
+            img.mouseenter(make_hover_handler(row, col));
             td.append(img);
             tr.append(td);
             images.push(img);