import Grid; import GUI; import at from Grid.Util; return { events: { onClick: onClick } }; function onClick(e, cell) { if(Grid.get().missing.isEmpty()) { rotateState(at(Grid.get().cells, cell)); } } function rotateState(cell) { if(cell.classList.contains('off')) { if(cell.textContent == '*') { cell.classList.remove('off'); cell.textContent = ''; } else { cell.textContent = '*'; } } else { cell.classList.add('off'); } }