forked from a01sa01to/NervousBreakdown
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bundle.js
1 lines (1 loc) · 3.83 KB
/
bundle.js
1
!function(e){var a={};function n(i){if(a[i])return a[i].exports;var t=a[i]={i:i,l:!1,exports:{}};return e[i].call(t.exports,t,t.exports,n),t.l=!0,t.exports}n.m=e,n.c=a,n.d=function(e,a,i){n.o(e,a)||Object.defineProperty(e,a,{enumerable:!0,get:i})},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,a){if(1&a&&(e=n(e)),8&a)return e;if(4&a&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&a&&"string"!=typeof e)for(var t in e)n.d(i,t,function(a){return e[a]}.bind(null,t));return i},n.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(a,"a",a),a},n.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},n.p="",n(n.s=0)}([function(e,a,n){"use strict";n.r(a);const i=e=>new Promise(a=>setTimeout(a,e)),t=e=>document.querySelector(e),s=async(e,a)=>{e.classList.add("fadeout"),await i(690),e.classList.remove("fadeout","showing"),await i(200),a.classList.add("fadein","showing"),await i(690),a.classList.remove("fadein")},r=(e,a=2)=>{const n=String(e);if(n.length>=a)return n;const i="0".repeat(a-n.length);return e<0?"-"+i+n.replace("-",""):i+n},c=(e,a=0)=>Math.floor(Math.random()*(e-a))+a;let l,o=!1,f=!1;const d="a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J".split(" "),u='<i class="far fa-heart"></i>\n<i class="far fa-gem"></i>\n<i class="fas fa-apple-alt"></i>\n<i class="far fa-bell"></i>\n<i class="fas fa-cat"></i>\n<i class="fas fa-dog"></i>\n<i class="fab fa-ello"></i>\n<i class="fab fa-envira"></i>\n<i class="far fa-eye"></i>\n<i class="fas fa-fish"></i>\n<i class="fas fa-frog"></i>\n<i class="far fa-hand-paper"></i>\n<i class="fas fa-ice-cream"></i>\n<i class="fas fa-horse"></i>\n<i class="fas fa-mobile-alt"></i>\n<i class="fas fa-pizza-slice"></i>\n<i class="fas fa-square-root-alt"></i>\n<i class="far fa-star"></i>'.split("\n"),p=u.concat(u);let m=u.length;const g=async function(){if(!f){if(this.classList.contains("clicked"))return!1;f=!0,this.classList.add("clicked"),o?(o=!1,await i(1e3),l===this.innerHTML&&(document.querySelectorAll(".card.clicked").forEach(e=>{e.classList.add("aligned"),e.removeEventListener("click",g)}),m--,t("span#remaining").innerText=m),document.querySelectorAll(".card.clicked").forEach(e=>e.classList.remove("clicked"))):(o=!0,l=this.innerHTML),f=!1}};window.addEventListener("load",()=>{t("#start").addEventListener("click",async()=>{s(t(".start"),t(".plan-phase")),await(async()=>{let e=0;for(;e<120;)await i(1e3),e++,t("span#plan-time").innerText=`残り${r(120-e)}秒`})(),s(t(".plan-phase"),t(".game-phase")),await(async()=>{t("span#remaining").innerText=m;for(let e=1;e<37;e++){const a=c(p.length),n=document.createElement("div");n.innerHTML=p[a],n.classList.add("card","clicked"),n.style.gridArea=d[e-1],t(".boardContainer").appendChild(n),p.splice(a,1)}await i(1600),t("span#game-time").innerText="10秒間で配置を覚えてください(ドライバーは目を閉じてください)。",await i(7e3),t("span#game-time").innerText="3",await i(1e3),t("span#game-time").innerText="2",await i(1e3),t("span#game-time").innerText="1",await i(1e3),t("span#game-time").innerText="スタート!",document.querySelectorAll(".card").forEach(e=>{e.classList.remove("clicked"),e.addEventListener("click",g)});let e=0;for(;e<120&&m>0;)await i(1e3),e++,t("span#game-time").innerText=`残り${r(120-e)}秒`;t("span#finTime").innerText=`${r(e)}秒`,t("span#finPair").innerText=`${18-m}ペア`})(),s(t(".game-phase"),t(".review-phase")),await(async()=>{let e=0;for(;e<60;)await i(1e3),e++,t("span#review-time").innerText=`残り${r(60-e)}秒`})(),s(t(".review-phase"),t(".end"))}),t("#again").addEventListener("click",()=>{location.reload()})})}]);