for (let y=0; y<this.size.y; y++) {
if (this.enlightened[x][y] && !newEnlightened[x][y]) {
let elt = document.getElementById(this.coordsToId([x, y]));
- elt.style.fillOpacity = "0.5";
+ elt.classList.add("in-shadow");
if (this.g_pieces[x][y]) {
this.g_pieces[x][y].remove();
this.g_pieces[x][y] = null;
}
else if (!this.enlightened[x][y] && newEnlightened[x][y]) {
let elt = document.getElementById(this.coordsToId([x, y]));
- elt.style.fillOpacity = "1";
+ elt.classList.remove("in-shadow");
if (this.board[x][y] != "") {
const piece = this.getPiece(x, y);
const color = this.getColor(x, y);
for (let j=0; j < sizeY; j++) {
const ii = (flipped ? this.size.x - 1 - i : i);
const jj = (flipped ? this.size.y - 1 - j : j);
- let fillOpacity = '1';
let classes = this.getSquareColorClass(ii, jj);
if (this.enlightened && !this.enlightened[ii][jj])
classes += " in-shadow";
else launchAnimation(); //focused user!
};
let boardContainer = document.getElementById("boardContainer");
- if (!document.hasFocus()) {
- window.onfocus = () => {
- window.onfocus = undefined;
+ if (document.hidden) {
+ document.onvisibilitychange = () => {
+ document.onvisibilitychange = undefined;
checkDisplayThenAnimate();
};
}