Add middle-click functionality to left click

This commit is contained in:
synth-ruiner 2015-03-06 09:40:32 +00:00
parent 5f459e8396
commit cebae17341
1 changed files with 11 additions and 7 deletions

View File

@ -468,7 +468,9 @@
$('#setup').hide();
});
$.fn.leftClick = function() {
$.fn.leftClick = function(automated) {
if (!automated) automated = false;
//don't want first click to be a mine
if (firstClick) {
var x = $(this).getX();
@ -500,9 +502,11 @@
//$(this).middleClick();
//number of flags matches number of adjacent mines
if (!automated && parseInt($(this).text()) === $(this).getAdjacentTiles().filter('.flagged, .revealed.mine').length) {
$(this).getAdjacentTiles().filter(':not(.flagged)').each(function() {
//$(this).mousedown();
$(this).mousedown();
});
}
} else {
$(this).addClass("revealed");
@ -522,8 +526,6 @@
}
$.fn.middleClick = function() {
//move this functionality to left click
//number of flags matches number of adjacent mines
if (parseInt($(this).text()) === $(this).getAdjacentTiles().filter('.flagged, .revealed.mine').length) {
$(this).getAdjacentTiles().filter(':not(.flagged)').each(function() {
@ -558,9 +560,11 @@
$(this).middleClick();
break;
case 1:
default:
$(this).leftClick();
break;
default:
$(this).leftClick(true); //automated
break;
}
removeClearedRows();