-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.bundle.js
2 lines (2 loc) · 2.86 KB
/
app.bundle.js
1
2
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n(1),window.addEventListener("load",function(){var e=document.querySelector(".page"),t=!1,n=!1,r=document.querySelector(".game__menu"),a=document.querySelector(".game__container"),o=!1,d=!1,c=void 0,i=void 0;function l(){t&&(document.querySelector(".modal").remove(),t=!1,e.classList.remove("freeze")),n&&(a.style.display="none",document.querySelector(".header__h1").classList.remove("in-game")),r.style.display="block"}function u(){this!==c&&(d||(o?(i=this,c.dataset.id===i.dataset.id?([c,i].forEach(function(e){e.removeEventListener("click",u),e.dataset.unraveled=!0}),s(),0===document.querySelectorAll('.game__card[data-unraveled="false"]').length&&function(){var n=document.createElement("div"),r=document.createElement("div");r.classList.add("modal__content"),n.classList.add("modal"),r.textContent="Congratulation!!!",r.addEventListener("click",l),n.appendChild(r),document.body.appendChild(n),e.classList.add("freeze"),t=!0}()):(d=!0,setTimeout(function(){[c,i].forEach(function(e){e.classList.remove("flip")}),s()},500))):(c=this,o=!0),this.classList.toggle("flip")))}function s(){o=!1,d=!1,c=null,i=null}r.addEventListener("click",function(e){var t=e.target.dataset.type;"3x4"!==t&&"4x5"!==t||function(e){(function(){for(r.style.display="none";a.firstChild;)a.removeChild(a.firstChild)})(),a.style.display="flex",document.querySelector(".header__h1").classList.add("in-game"),n=!0;for(var t=[],o=0;e--;){var d=document.createElement("div");t.push(d),d.classList.add("game__card"),d.classList.add("game__card--"+e),d.dataset.unraveled=!1,d.addEventListener("click",u),e%2&&o++,d.dataset.id=""+o;var c=document.createElement("div"),i=document.createElement("div");c.classList.add("front-face"),i.classList.add("back-face"),d.append(c,i),a.appendChild(d)}t.forEach(function(e){var t=Math.floor(12*Math.random());e.style.order=t})}(+t[0]*+t[2])}),document.querySelector(".header__h1").addEventListener("click",l),l()})},function(e,t,n){}]);
//# sourceMappingURL=app.bundle.js.map