Add middle-click functionality to left click
This commit is contained in:
parent
5f459e8396
commit
cebae17341
18
index.html
18
index.html
|
@ -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
|
||||
$(this).getAdjacentTiles().filter(':not(.flagged)').each(function() {
|
||||
//$(this).mousedown();
|
||||
});
|
||||
if (!automated && parseInt($(this).text()) === $(this).getAdjacentTiles().filter('.flagged, .revealed.mine').length) {
|
||||
$(this).getAdjacentTiles().filter(':not(.flagged)').each(function() {
|
||||
$(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();
|
||||
|
|
Loading…
Reference in New Issue