Middle click behaviour

Allow middle clicking for adjacent clicked mines as well as flagged
mines
This commit is contained in:
synth-ruiner 2015-03-01 14:55:37 +00:00
parent 1442b7d5ad
commit e4660cf7aa
1 changed files with 7 additions and 2 deletions

View File

@ -349,8 +349,10 @@
}
$.fn.middleClick = function() {
//move this functionality to left click
//number of flags matches number of adjacent mines
if ($(this).text() == $(this).getAdjacentTiles().filter('.flagged').length) {
if ($(this).text() == $(this).getAdjacentTiles().filter('.flagged, .revealed.mine').length) {
$(this).getAdjacentTiles().filter(':not(.flagged)').each(function() {
$(this).mousedown();
});
@ -358,7 +360,10 @@
}
$.fn.rightClick = function() {
if (!$(this).hasClass("revealed")) {
if ($(this).hasClass("revealed")) {
//deploy a bomb!
//...
} else {
$(this).toggleClass("flagged");
}
}