From cf0342e2484f6b545ac31d296bf00ed4b5e4fa90 Mon Sep 17 00:00:00 2001 From: synth-ruiner Date: Sun, 1 Mar 2015 13:04:59 +0000 Subject: [PATCH] Fixed behaviour of row clearing --- index.html | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 66c8dc2..85de4c8 100644 --- a/index.html +++ b/index.html @@ -164,21 +164,22 @@ if (rowsToRemove.length == 0) return; rowsToRemove.each(function() { + score += $(this).children('.mine').length; + //add new row on bottom - $('#game').append(''); + + $('#game').append(''); for (var i = 0; i < gameBoardWidth; i++) { if (Math.random() < mineChance) { - $('#game ul:last-child').append('
  • '); + $('#game ul').last().append('
  • '); } else { - $('#game ul:last-child').append('
  • '); + $('#game ul').last().append('
  • '); } } }); - inputEnabled = false; - - //rowsToRemove.remove(); + inputEnabled = false; rowsToRemove.slideUp("slow", function() { $(this).remove(); @@ -205,8 +206,6 @@ $(this).addClass("revealed"); }); - inputEnabled = true; - //refresh last row to reflect new rows beneath $('li.revealed').last().parent().children('li.revealed').mousedown(); @@ -214,8 +213,10 @@ $('li.revealed:not(.mine):empty').mousedown(); }); - $('ul:hidden').show(); + //this is a bit of a hack :( oh well + $('ul:gt(' + gameBoardHeight + ')').remove(); + inputEnabled = true; } $.fn.rowScore = function() {