Merge remote-tracking branch 'origin/master' into gh-pages

This commit is contained in:
synth-ruiner 2015-03-09 23:45:53 +00:00
commit 83d9023ad9
1 changed files with 24 additions and 32 deletions

View File

@ -272,6 +272,18 @@
} }
} }
function newRow() {
var row = '<ul>';
for (var i = 0; i < gameBoardWidth; i++) {
row += newTile();
};
row += '</ul>';
return row;
}
$.fn.checkRow = function() { $.fn.checkRow = function() {
//unclicked tiles //unclicked tiles
@ -316,31 +328,23 @@
return $(this).checkRow(); return $(this).checkRow();
}); });
var numRowsToRemove = rowsToRemove.length;
if (numRowsToRemove == 0) return;
rowsToRemove.addClass("removing");
rowsToRemove.each(function() { rowsToRemove.each(function() {
score += $(this).children('.mine').length; score += $(this).children('.mine').length;
});
rowsToRemove.slideUp("slow", function() { $(this).addClass("removing");
$(this).slideUp("slow", function() {
$(this).remove(); $(this).remove();
//add new row on bottom //add new row on bottom
$('#game').append(newRow());
$('#game').append('<ul></ul>');
for (var i = 0; i < gameBoardWidth; i++) {
$('#game ul').last().append(newTile());
}
refreshMineCounts(); refreshMineCounts();
//click blank tiles //click blank tiles
$('li.revealed:not(.mine):empty').mouseup(); $('li.revealed:not(.mine):empty').mouseup();
}); });
});
} }
window.removeClearedColumns = function() { window.removeClearedColumns = function() {
@ -348,15 +352,11 @@
return $(this).checkColumn(); return $(this).checkColumn();
}); });
if (columnsToRemove.length == 0) return;
columnsToRemove.addClass("removing");
columnsToRemove.each(function() { columnsToRemove.each(function() {
score += $(this).column().filter('.mine').length; score += $(this).column().filter('.mine').length;
});
columnsToRemove.each(function() { $(this).addClass("removing");
$(this).column().animate({width: 0, borderRadius: 0, padding: 0}, "slow", function() { $(this).column().animate({width: 0, borderRadius: 0, padding: 0}, "slow", function() {
$(this).parent().append(newTile()); $(this).parent().append(newTile());
$(this).remove(); $(this).remove();
@ -446,15 +446,7 @@
} }
$.fn.countMinesAdjacent = function() { $.fn.countMinesAdjacent = function() {
var count = 0; return $(this).getAdjacentTiles().filter('.mine').length;
$.each($(this).getAdjacentTiles(), function() {
if ($(this).isMine()) {
count++;
}
});
return count;
} }
$.fn.getAdjacentTiles = function() { $.fn.getAdjacentTiles = function() {