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