SHARE
TWEET

Untitled

a guest Oct 20th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tileClick : function(e) {
  2.         if (this.canGet) {
  3.             //jeżeli jeszcze nie pobraliśmy 1 elementu
  4.             //lub jeżeli index tego elementu nie istnieje w pobranych...
  5.             if (!this.tilesChecked[0] || (this.tilesChecked[0].dataset.index !== e.target.dataset.index)) {
  6.                 this.tilesChecked.push(e.target);
  7.                 e.target.style.backgroundImage = 'url(' + this.tilesImg[e.target.dataset.cardType] + ')';
  8.             }
  9.  
  10.             if (this.tilesChecked.length === 2) {
  11.                 this.canGet = false;
  12.  
  13.                 if (this.tilesChecked[0].dataset.cardType === this.tilesChecked[1].dataset.cardType) {
  14.                     setTimeout(this.deleteTiles.bind(this), 500);
  15.                 } else {
  16.                     setTimeout(this.resetTiles.bind(this), 500);
  17.                 }
  18.  
  19.                 this.moveCount++;
  20.                 this.divScore.innerText = this.moveCount;
  21.             }
  22.         }
  23.     },
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top