diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 69f50d5..0000000 --- a/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["env"] -} \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 5cc9afc..0000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -.cache -dist -package-lock.json \ No newline at end of file diff --git a/.postcssrc b/.postcssrc deleted file mode 100644 index e89d47b..0000000 --- a/.postcssrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "modules": false, - "plugins": { - "postcss-preset-env": true, - "postcss-nested": {}, - "postcss-import": true, - "postcss-import-url": true, - "autoprefixer": true - } -} \ No newline at end of file diff --git a/.stylelintrc b/.stylelintrc deleted file mode 100644 index a1617e3..0000000 --- a/.stylelintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "stylelint-config-recommended", - "rules": { - "selector-nested-pattern": "^&" - } -} \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index d94855b..0000000 --- a/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Regexp People - -A regular expression (for HTML5 `` pattern attribute) learning game for newbies - -## Preview - -![Regexp People Game](docs/regexp-game.gif) - -**» Game URL**: [https://manzdev.github.io/regex-people/](https://manzdev.github.io/regex-people/) - -## Used tools - -- NodeJS/NPM [https://nodejs.org/en/](https://nodejs.org/en/) -- ParcelJS [https://parceljs.org/](https://parceljs.org/) -- PostCSS [https://postcss.org/](https://postcss.org/) -- BabelJS [https://babeljs.io/](https://babeljs.io/) -- CSSNano [http://cssnano.co/](http://cssnano.co/) -- StyleLint [https://stylelint.io/](https://stylelint.io/) -- TypeScript [https://www.typescriptlang.org/](https://www.typescriptlang.org/) -- Lodash [https://lodash.com/](https://lodash.com/) -- Snarkdown [https://github.com/developit/snarkdown](https://github.com/developit/snarkdown) - -## Author - -Created by [@Manz](https://twitter.com/Manz) - [HTML5/CSS3/Javascript Cheatsheet author](https://lenguajehtml.com/) \ No newline at end of file diff --git a/build/index.html b/build/index.html deleted file mode 100644 index 0d4b438..0000000 --- a/build/index.html +++ /dev/null @@ -1 +0,0 @@ - RegEx People Game | By @Manz
RegexpPeople

<input pattern="">
\ No newline at end of file diff --git a/build/css.95e44364.css b/css.159ede80.css similarity index 60% rename from build/css.95e44364.css rename to css.159ede80.css index 5a61757..a4a095c 100644 --- a/build/css.95e44364.css +++ b/css.159ede80.css @@ -1 +1 @@ -.head{width:150px;height:150px;background:#e2cda8;border-radius:75px;box-shadow:5px 5px 0 #1e1503,inset -10px -10px 10px rgba(0,0,0,.4);position:relative;margin:0 14px;text-align:center}.head.black{background:#7f5832}.head.orc{background:#11511a}.head.ghost{background:#fff;border-bottom-left-radius:0;border-bottom-right-radius:0}.head.clown{background:linear-gradient(180deg,#e4200f 5%,#c52020 10%,transparent 20%),radial-gradient(#f30808 10%,#ad0a0a 12%,#000 14%,transparent 16%),radial-gradient(circle at bottom,#fff 50%,#dab794 60%)}.head.clown .smileteeth{border-color:darkred;border-width:6px}.head.oldorc{background:linear-gradient(180deg,#fff 2%,#04350b 15% 85%,#fff 90%)}.head.oldorc:after{content:" ";display:block;margin:auto;-webkit-transform:translateY(25px);transform:translateY(25px);width:0;height:0;border-left:15px solid transparent;border-right:15px solid transparent;border-top:15px solid #fff}.head.beard{background:linear-gradient(180deg,#e2cda8 57%,#9a8a71 59%)}.user,.user .target{display:inline-block}.user .target{background:#fff;color:#000;box-shadow:0 0 15px rgba(0,0,0,.5);padding:5px 30px;position:relative;font-weight:500;top:10px;margin:4px}.user.ok .head{box-shadow:0 0 15px 5px #067600}.user.ok .target{background:#37e143}.user.dance .head,span.dance{-webkit-animation:baileUser .5s linear alternate infinite;animation:baileUser .5s linear alternate infinite}.head .eye{display:inline-block;background:#fff;width:45px;height:45px;border-radius:25px;margin-top:1em;-webkit-animation:eyeBlink linear infinite;animation:eyeBlink linear infinite;-webkit-animation-duration:5s;animation-duration:5s}.head.oldorc .eye{background:linear-gradient(180deg,RGB(255,200,200) 20%,#fff 50%)}.head .pupil{background:#000;width:17px;height:17px;border-radius:10px;margin:auto;margin-top:6px}.head .pupil.left{-webkit-animation:pupilMoveLeft ease 1;animation:pupilMoveLeft ease 1}.head .pupil.right{-webkit-animation:pupilMoveRight ease 1;animation:pupilMoveRight ease 1}.head .pupil.down{-webkit-animation:pupilMoveDown ease 1;animation:pupilMoveDown ease 1}.head .mustache{background:#111;width:35px;height:15px;margin:auto;position:relative;top:8px}.head .mouth{background:#222;width:20px;height:20px;border-radius:25px;position:absolute;right:40px;bottom:30px}.head .happymouth{background:#222;height:40px;border-radius:0 0 75px 75px}.head .happymouth,.head .sadmouth{width:100px;position:relative;top:10px;margin:auto}.head .sadmouth{border:4px solid #222;border-bottom:0;height:20px;border-radius:75px 75px 0 0}.head .shortsmile{width:80px;height:20px}.head .shortsmile,.head .smile{border:4px solid #000;border-top:0;border-radius:0 0 50px 50px;position:relative;top:10px;margin:auto}.head .smile{width:100px;height:40px}.head .smileteeth{height:40px;border:4px solid #000;border-radius:0 0 50px 50px;background:#fff}.head .angrymouth,.head .smileteeth{width:100px;position:relative;top:10px;margin:auto}.head .angrymouth{background:#222;height:30px;border-radius:75px 75px 0 0}.head .fangs{width:20px;height:20px;background:#fff;display:inline-block;margin:0 10px;border-radius:50px 50px 0 0}.head .tongue{display:block;position:relative;margin:auto;width:50px;height:30px;border-radius:0 0 50% 50%;background:red}.head .brows{width:40px;height:10px;background:#222;margin:0 2px;position:relative;top:-30px}@-webkit-keyframes pupilMoveRight{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translate(5px);transform:translate(5px)}}@keyframes pupilMoveRight{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translate(5px);transform:translate(5px)}}@-webkit-keyframes pupilMoveLeft{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translate(-5px);transform:translate(-5px)}}@keyframes pupilMoveLeft{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translate(-5px);transform:translate(-5px)}}@-webkit-keyframes pupilMoveDown{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translateY(5px);transform:translateY(5px)}}@keyframes pupilMoveDown{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translateY(5px);transform:translateY(5px)}}@font-face{font-family:Exo\ 2;font-style:normal;font-weight:700;src:local("Exo 2 Bold"),local("Exo2-Bold"),url(https://fonts.gstatic.com/s/exo2/v4/7cHrv4okm5zmbt6TDvs7wHo.ttf) format("truetype")}@font-face{font-family:Inconsolata;font-style:normal;font-weight:400;src:local("Inconsolata Regular"),local("Inconsolata-Regular"),url(https://fonts.gstatic.com/s/inconsolata/v16/QldKNThLqRwH-OJ1UHjlKGlZ5q0.ttf) format("truetype")}@font-face{font-family:Indie Flower;font-style:normal;font-weight:400;src:local("Indie Flower"),local("IndieFlower"),url(https://fonts.gstatic.com/s/indieflower/v9/m8JVjfNVeKWVnh3QMuKkFcZVaUuC.ttf) format("truetype")}@font-face{font-family:Open Sans;font-style:normal;font-weight:300;src:local("Open Sans Light"),local("OpenSans-Light"),url(https://fonts.gstatic.com/s/opensans/v15/mem5YaGs126MiZpBA-UN_r8OUuhs.ttf) format("truetype")}@font-face{font-family:Open Sans;font-style:normal;font-weight:400;src:local("Open Sans Regular"),local("OpenSans-Regular"),url(https://fonts.gstatic.com/s/opensans/v15/mem8YaGs126MiZpBA-UFVZ0e.ttf) format("truetype")}html{background:#111}body{margin:0;font-family:Open Sans,sans-serif;font-weight:300;font-size:22px;letter-spacing:-1px;background:#333}#title{background:#000;font-family:Exo\ 2,sans-serif;font-size:42px;padding:4px 0;color:#fff;text-align:center;text-shadow:0 0 15px hsla(0,0%,100%,.5);box-shadow:0 3px 10px rgba(0,0,0,.5)}#title span{font-family:Indie Flower,sans-serif;font-size:28px;color:#e61e1e}#content{text-align:center;margin:2em 0}#question{max-width:800px;min-height:300px;margin:2em auto}#question #info{padding:10px 30px;background:linear-gradient(135deg,#000 25px,#aaa 0),#aaa;min-height:50px;margin-bottom:1em;border:4px solid #000;color:#222;font-family:Open Sans,sans-serif;font-weight:400;font-size:20px;position:relative}#question #info em{color:#00008b;padding:0 6px 0 2px}#question #userinput{width:400px;height:50px;display:inline-block;background:#111;color:#067600;border:0;outline:0}#question #userinput.not{color:red}#question .tags{width:700px;display:block;margin:auto;background:#222;color:#eee}#question #userinput,#question .tags{font-family:Inconsolata,monospace;font-weight:500;font-size:32px;text-align:center;letter-spacing:-1px}@media screen and (max-width:640px){#question span.tags{width:auto;padding:20px 0}#question span.tags #userinput{width:100%;margin:20px 0;display:flex}}strong.nivel{background:darkred;font-weight:lighter;padding:2px 10px;color:#fff;position:absolute;top:-15px;right:25px;-webkit-transform:rotate(3deg);transform:rotate(3deg)}#footer{display:flex;flex-direction:column;justify-content:center;background:#111;color:#fff;height:100px;padding:25px 20px}#footer p{font-family:Muli,sans-serif;letter-spacing:-1px;font-weight:300;font-size:18px;text-align:center;margin:6px}#footer p a{color:red;text-decoration:none;padding-bottom:1px;border-bottom:1px solid #222}#footer .blue a{color:#888}#footer a:hover{color:#287dcc;border-color:#085dac}button.brilliant{font-family:Montserrat,sans-serif;font-size:18px;color:#fff;padding:10px 6px;border:3px solid #fff;background:#333;margin:25px auto;display:block;width:150px;outline:0}button.brilliant.off{visibility:hidden}button.brilliant:hover{background:#111;cursor:pointer}button.brilliant i.fa{padding-right:5px;color:#fff}code{background:#888;padding:2px 6px;margin:0 2px}.off{display:none}#question #info.end{background:green;color:#fff;text-align:center;font-size:42px}table.score{border:3px solid #555;background:#fff;width:auto;margin:auto;border-spacing:5px;font-family:Montserrat,sans-serif;font-size:18px}table.score td{border-radius:5px;padding:5px 40px;color:#555}table.score td:first-child{background:#777;color:#fff}table.score td:nth-child(2){border:1px solid #ccc;font-family:monospace;font-weight:600;font-size:22px}table.score :nth-child(2n) td:nth-child(2){background:#ededed;color:#777}.trophy{display:inline-block}@-webkit-keyframes baileUser{0%{-webkit-transform:skew(-3deg) rotate(5deg) translateY(0);transform:skew(-3deg) rotate(5deg) translateY(0)}50%{-webkit-transform:skew(0) rotate(0) translateY(-10px);transform:skew(0) rotate(0) translateY(-10px)}to{-webkit-transform:skew(3deg) rotate(-5deg) translateY(0);transform:skew(3deg) rotate(-5deg) translateY(0)}}@keyframes baileUser{0%{-webkit-transform:skew(-3deg) rotate(5deg) translateY(0);transform:skew(-3deg) rotate(5deg) translateY(0)}50%{-webkit-transform:skew(0) rotate(0) translateY(-10px);transform:skew(0) rotate(0) translateY(-10px)}to{-webkit-transform:skew(3deg) rotate(-5deg) translateY(0);transform:skew(3deg) rotate(-5deg) translateY(0)}}@-webkit-keyframes eyeBlink{0%{opacity:1}94%{opacity:1}95%{opacity:.25}96%{opacity:0}97%{opacity:.25}98%{opacity:1}}@keyframes eyeBlink{0%{opacity:1}94%{opacity:1}95%{opacity:.25}96%{opacity:0}97%{opacity:.25}98%{opacity:1}} \ No newline at end of file +.head{width:150px;height:150px;background:#e2cda8;border-radius:75px;box-shadow:5px 5px 0 #1e1503,inset -10px -10px 10px rgba(0,0,0,.4);position:relative;margin:0 14px;text-align:center}.head.black{background:#7f5832}.head.orc{background:#11511a}.head.ghost{background:#fff;border-bottom-left-radius:0;border-bottom-right-radius:0}.head.clown{background:linear-gradient(180deg,#e4200f 5%,#c52020 10%,transparent 20%),radial-gradient(#f30808 10%,#ad0a0a 12%,#000 14%,transparent 16%),radial-gradient(circle at bottom,#fff 50%,#dab794 60%)}.head.clown .smileteeth{border-color:darkred;border-width:6px}.head.oldorc{background:linear-gradient(180deg,#fff 2%,#04350b 15% 85%,#fff 90%)}.head.oldorc:after{content:" ";display:block;margin:auto;-webkit-transform:translateY(25px);transform:translateY(25px);width:0;height:0;border-left:15px solid transparent;border-right:15px solid transparent;border-top:15px solid #fff}.head.beard{background:linear-gradient(180deg,#e2cda8 57%,#9a8a71 59%)}.user,.user .target{display:inline-block}.user .target{background:#fff;color:#000;box-shadow:0 0 15px rgba(0,0,0,.5);padding:5px 30px;position:relative;font-weight:500;top:10px;margin:4px}.user.ok .head{box-shadow:0 0 15px 5px #067600}.user.ok .target{background:#37e143}.user.dance .head,span.dance{-webkit-animation:baileUser .5s linear alternate infinite;animation:baileUser .5s linear alternate infinite}.head .eye{display:inline-block;background:#fff;width:45px;height:45px;border-radius:25px;margin-top:1em;-webkit-animation:eyeBlink linear infinite;animation:eyeBlink linear infinite;-webkit-animation-duration:5s;animation-duration:5s}.head.oldorc .eye{background:linear-gradient(180deg,RGB(255,200,200) 20%,#fff 50%)}.head .pupil{background:#000;width:17px;height:17px;border-radius:10px;margin:auto;margin-top:6px}.head .pupil.left{-webkit-animation:pupilMoveLeft ease 1;animation:pupilMoveLeft ease 1}.head .pupil.right{-webkit-animation:pupilMoveRight ease 1;animation:pupilMoveRight ease 1}.head .pupil.down{-webkit-animation:pupilMoveDown ease 1;animation:pupilMoveDown ease 1}.head .mustache{background:#111;width:35px;height:15px;margin:auto;position:relative;top:8px}.head .mouth{background:#222;width:20px;height:20px;border-radius:25px;position:absolute;right:40px;bottom:30px}.head .happymouth{background:#222;height:40px;border-radius:0 0 75px 75px}.head .happymouth,.head .sadmouth{width:100px;position:relative;top:10px;margin:auto}.head .sadmouth{border:4px solid #222;border-bottom:0;height:20px;border-radius:75px 75px 0 0}.head .shortsmile{width:80px;height:20px}.head .shortsmile,.head .smile{border:4px solid #000;border-top:0;border-radius:0 0 50px 50px;position:relative;top:10px;margin:auto}.head .smile{width:100px;height:40px}.head .smileteeth{height:40px;border:4px solid #000;border-radius:0 0 50px 50px;background:#fff}.head .angrymouth,.head .smileteeth{width:100px;position:relative;top:10px;margin:auto}.head .angrymouth{background:#222;height:30px;border-radius:75px 75px 0 0}.head .fangs{width:20px;height:20px;background:#fff;display:inline-block;margin:0 10px;border-radius:50px 50px 0 0}.head .tongue{display:block;position:relative;margin:auto;width:50px;height:30px;border-radius:0 0 50% 50%;background:red}.head .brows{width:40px;height:10px;background:#222;margin:0 2px;position:relative;top:-30px}@-webkit-keyframes pupilMoveRight{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translate(5px);transform:translate(5px)}}@keyframes pupilMoveRight{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translate(5px);transform:translate(5px)}}@-webkit-keyframes pupilMoveLeft{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translate(-5px);transform:translate(-5px)}}@keyframes pupilMoveLeft{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translate(-5px);transform:translate(-5px)}}@-webkit-keyframes pupilMoveDown{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translateY(5px);transform:translateY(5px)}}@keyframes pupilMoveDown{0%,90%{-webkit-transform:translate(0);transform:translate(0)}25%{-webkit-transform:translateY(5px);transform:translateY(5px)}}@font-face{font-family:Exo\ 2;font-style:normal;font-weight:700;src:local("Exo 2 Bold"),local("Exo2-Bold"),url(https://fonts.gstatic.com/s/exo2/v4/7cHrv4okm5zmbt6TDvs7wHo.ttf) format("truetype")}@font-face{font-family:Inconsolata;font-style:normal;font-weight:400;src:local("Inconsolata Regular"),local("Inconsolata-Regular"),url(https://fonts.gstatic.com/s/inconsolata/v16/QldKNThLqRwH-OJ1UHjlKGlZ5q0.ttf) format("truetype")}@font-face{font-family:Indie Flower;font-style:normal;font-weight:400;src:local("Indie Flower"),local("IndieFlower"),url(https://fonts.gstatic.com/s/indieflower/v9/m8JVjfNVeKWVnh3QMuKkFcZVaUuC.ttf) format("truetype")}@font-face{font-family:Open Sans;font-style:normal;font-weight:300;src:local("Open Sans Light"),local("OpenSans-Light"),url(https://fonts.gstatic.com/s/opensans/v15/mem5YaGs126MiZpBA-UN_r8OUuhs.ttf) format("truetype")}@font-face{font-family:Open Sans;font-style:normal;font-weight:400;src:local("Open Sans Regular"),local("OpenSans-Regular"),url(https://fonts.gstatic.com/s/opensans/v15/mem8YaGs126MiZpBA-UFVZ0e.ttf) format("truetype")}html{background:#111}body{margin:0;font-family:Open Sans,sans-serif;font-weight:300;font-size:22px;letter-spacing:-1px;background:#333}#title{background:#000;font-family:Exo\ 2,sans-serif;font-size:42px;padding:4px 0;color:#fff;text-align:center;text-shadow:0 0 15px hsla(0,0%,100%,.5);box-shadow:0 3px 10px rgba(0,0,0,.5)}#title a{text-decoration:none;color:#fff}#title span{font-family:Indie Flower,sans-serif;font-size:28px;color:#e61e1e}#content{text-align:center;margin:2em 0}#question{max-width:800px;min-height:300px;margin:2em auto}#question #info{padding:10px 30px;background:linear-gradient(135deg,#000 25px,#aaa 0),#aaa;min-height:50px;margin-bottom:1em;border:4px solid #000;color:#222;font-family:Open Sans,sans-serif;font-weight:400;font-size:20px;position:relative}#question #info em{color:#00008b;padding:0 6px 0 2px}#question #userinput{width:400px;height:50px;display:inline-block;background:#111;color:#067600;border:0;outline:0}#question #userinput.not{color:red}#question .tags{width:700px;display:block;margin:auto;background:#222;color:#eee}#question #userinput,#question .tags{font-family:Inconsolata,monospace;font-weight:500;font-size:32px;text-align:center;letter-spacing:-1px}@media screen and (max-width:640px){#question span.tags{width:auto;padding:20px 0}#question span.tags #userinput{width:100%;margin:20px 0;display:flex}}strong.nivel{background:darkred;font-weight:lighter;padding:2px 10px;color:#fff;position:absolute;top:-15px;right:25px;-webkit-transform:rotate(3deg);transform:rotate(3deg)}#footer{display:flex;flex-direction:column;justify-content:center;background:#111;color:#fff;height:100px;padding:25px 20px}#footer p{font-family:Muli,sans-serif;letter-spacing:-1px;font-weight:300;font-size:18px;text-align:center;margin:6px}#footer p a{color:#287dcc;text-decoration:none;padding-bottom:1px;border-bottom:1px solid #222}#footer .tw i{color:#0084b4}#footer .gh i{color:grey}#footer .social a{border-bottom:0;padding:0 4px;font-size:28px}#footer .social a:hover i{color:#444}#footer .blue a{color:#888}#footer a:hover{color:red;border-color:red}button.brilliant{font-family:Montserrat,sans-serif;font-size:18px;color:#fff;padding:10px 6px;border:3px solid #fff;background:#333;margin:25px auto;display:block;width:150px;outline:0}button.brilliant.off{visibility:hidden}button.brilliant:hover{background:#111;cursor:pointer}button.brilliant i.fa{padding-right:5px;color:#fff}code{background:#888;padding:2px 6px;margin:0 2px}.off{display:none}#question #info.end{background:green;color:#fff;text-align:center;font-size:42px}table.score{border:3px solid #555;background:#fff;width:auto;margin:auto;border-spacing:5px;font-family:Montserrat,sans-serif;font-size:18px}table.score td{border-radius:5px;padding:5px 40px;color:#555}table.score td:first-child{background:#777;color:#fff}table.score td:nth-child(2){border:1px solid #ccc;font-family:monospace;font-weight:600;font-size:22px}table.score :nth-child(2n) td:nth-child(2){background:#ededed;color:#777}.trophy{display:inline-block}@-webkit-keyframes baileUser{0%{-webkit-transform:skew(-3deg) rotate(5deg) translateY(0);transform:skew(-3deg) rotate(5deg) translateY(0)}50%{-webkit-transform:skew(0) rotate(0) translateY(-10px);transform:skew(0) rotate(0) translateY(-10px)}to{-webkit-transform:skew(3deg) rotate(-5deg) translateY(0);transform:skew(3deg) rotate(-5deg) translateY(0)}}@keyframes baileUser{0%{-webkit-transform:skew(-3deg) rotate(5deg) translateY(0);transform:skew(-3deg) rotate(5deg) translateY(0)}50%{-webkit-transform:skew(0) rotate(0) translateY(-10px);transform:skew(0) rotate(0) translateY(-10px)}to{-webkit-transform:skew(3deg) rotate(-5deg) translateY(0);transform:skew(3deg) rotate(-5deg) translateY(0)}}@-webkit-keyframes eyeBlink{0%{opacity:1}94%{opacity:1}95%{opacity:.25}96%{opacity:0}97%{opacity:.25}98%{opacity:1}}@keyframes eyeBlink{0%{opacity:1}94%{opacity:1}95%{opacity:.25}96%{opacity:0}97%{opacity:.25}98%{opacity:1}} \ No newline at end of file diff --git a/docs/regexp-game.gif b/docs/regexp-game.gif deleted file mode 100644 index 5cecf4f..0000000 Binary files a/docs/regexp-game.gif and /dev/null differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..58e20f3 --- /dev/null +++ b/index.html @@ -0,0 +1 @@ + RegEx People Game | By @Manz
RegexpPeople

<input pattern="">
\ No newline at end of file diff --git a/build/js.13fb95b3.js b/js.13fb95b3.js similarity index 99% rename from build/js.13fb95b3.js rename to js.13fb95b3.js index f7ab61d..e936895 100644 --- a/build/js.13fb95b3.js +++ b/js.13fb95b3.js @@ -1,14 +1,14 @@ parcelRequire=function(e,r,n,t){function i(n,t){function o(e){return i(o.resolve(e))}function c(r){return e[n][1][r]||r}if(!r[n]){if(!e[n]){var l="function"==typeof parcelRequire&&parcelRequire;if(!t&&l)return l(n,!0);if(u)return u(n,!0);if(f&&"string"==typeof n)return f(n);var p=new Error("Cannot find module '"+n+"'");throw p.code="MODULE_NOT_FOUND",p}o.resolve=c;var a=r[n]=new i.Module(n);e[n][0].call(a.exports,o,a,a.exports,this)}return r[n].exports}function o(e){this.id=e,this.bundle=i,this.exports={}}var u="function"==typeof parcelRequire&&parcelRequire,f="function"==typeof require&&require;i.isParcelRequire=!0,i.Module=o,i.modules=e,i.cache=r,i.parent=u;for(var c=0;c0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function u(r){var t=h(r),e=t[0],n=t[1];return 3*(e+n)/4-n}function c(r,t,e){return 3*(t+e)/4-e}function i(r){for(var n,o=h(r),a=o[0],u=o[1],i=new e(c(r,a,u)),f=0,A=u>0?a-4:a,d=0;d>16&255,i[f++]=n>>8&255,i[f++]=255&n;return 2===u&&(n=t[r.charCodeAt(d)]<<2|t[r.charCodeAt(d+1)]>>4,i[f++]=255&n),1===u&&(n=t[r.charCodeAt(d)]<<10|t[r.charCodeAt(d+1)]<<4|t[r.charCodeAt(d+2)]>>2,i[f++]=n>>8&255,i[f++]=255&n),i}function f(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function A(r,t,e){for(var n,o=[],a=t;au?u:h+16383));return 1===o?(e=t[n-1],a.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],a.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),a.join("")}t["-".charCodeAt(0)]=62,t["_".charCodeAt(0)]=63; -},{}],16:[function(require,module,exports) { -exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),(o+=p+N>=1?n/f:n*Math.pow(2,1-N))*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l}; },{}],15:[function(require,module,exports) { +exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),(o+=p+N>=1?n/f:n*Math.pow(2,1-N))*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l}; +},{}],16:[function(require,module,exports) { var r={}.toString;module.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}; },{}],13:[function(require,module,exports) { var global = arguments[3]; var t=arguments[3],r=require("base64-js"),e=require("ieee754"),n=require("isarray");function i(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function o(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,r){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function d(t){return+t!=t&&(t=0),f.alloc(+t)}function v(t,r){if(f.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return K(t).length;default:if(n)return $(t).length;r=(""+r).toLowerCase(),n=!0}}function E(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,r,e);case"utf8":case"utf-8":return Y(this,r,e);case"ascii":return L(this,r,e);case"latin1":case"binary":return D(this,r,e);case"base64":return S(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function R(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=f.from(r,n)),f.isBuffer(r))return 0===r.length?-1:_(t,r,e,n,i);if("number"==typeof r)return r&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):_(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,r,e,n,i){var o,u=1,f=t.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;u=2,f/=2,s/=2,e/=2}function h(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(i){var a=-1;for(o=e;of&&(e=f-s),o=e;o>=0;o--){for(var c=!0,l=0;li&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u239?4:h>223?3:h>191?2:1;if(i+c<=e)switch(c){case 1:h<128&&(a=h);break;case 2:128==(192&(o=t[i+1]))&&(s=(31&h)<<6|63&o)>127&&(a=s);break;case 3:o=t[i+1],u=t[i+2],128==(192&o)&&128==(192&u)&&(s=(15&h)<<12|(63&o)<<6|63&u)>2047&&(s<55296||s>57343)&&(a=s);break;case 4:o=t[i+1],u=t[i+2],f=t[i+3],128==(192&o)&&128==(192&u)&&128==(192&f)&&(s=(15&h)<<18|(63&o)<<12|(63&u)<<6|63&f)>65535&&s<1114112&&(a=s)}null===a?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=c}return O(n)}exports.Buffer=f,exports.SlowBuffer=d,exports.INSPECT_MAX_BYTES=50,f.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:i(),exports.kMaxLength=o(),f.poolSize=8192,f._augment=function(t){return t.__proto__=f.prototype,t},f.from=function(t,r,e){return s(null,t,r,e)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(t,r,e){return a(null,t,r,e)},f.allocUnsafe=function(t){return c(null,t)},f.allocUnsafeSlow=function(t){return c(null,t)},f.isBuffer=function(t){return!(null==t||!t._isBuffer)},f.compare=function(t,r){if(!f.isBuffer(t)||!f.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},f.prototype.compare=function(t,r,e,n,i){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(r>>>=0,e>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,u=e-r,s=Math.min(o,u),h=this.slice(n,i),a=t.slice(r,e),c=0;ci)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,r,e);case"utf8":case"utf-8":return m(this,t,r,e);case"ascii":return P(this,t,r,e);case"latin1":case"binary":return T(this,t,r,e);case"base64":return B(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function O(t){var r=t.length;if(r<=I)return String.fromCharCode.apply(String,t);for(var e="",n=0;nn)&&(e=n);for(var i="",o=r;oe)throw new RangeError("Trying to access beyond buffer length")}function k(t,r,e,n,i,o){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||rt.length)throw new RangeError("Index out of range")}function N(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i>>8*(n?i:1-i)}function z(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i>>8*(n?i:3-i)&255}function F(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function j(t,r,n,i,o){return o||F(t,r,n,4,3.4028234663852886e38,-3.4028234663852886e38),e.write(t,r,n,i,23,4),n+4}function q(t,r,n,i,o){return o||F(t,r,n,8,1.7976931348623157e308,-1.7976931348623157e308),e.write(t,r,n,i,52,8),n+8}f.prototype.slice=function(t,r){var e,n=this.length;if(t=~~t,r=void 0===r?n:~~r,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),r<0?(r+=n)<0&&(r=0):r>n&&(r=n),r0&&(i*=256);)n+=this[t+--r]*i;return n},f.prototype.readUInt8=function(t,r){return r||M(t,1,this.length),this[t]},f.prototype.readUInt16LE=function(t,r){return r||M(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUInt16BE=function(t,r){return r||M(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUInt32LE=function(t,r){return r||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUInt32BE=function(t,r){return r||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*r)),n},f.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},f.prototype.readInt8=function(t,r){return r||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,r){r||M(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},f.prototype.readInt16BE=function(t,r){r||M(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},f.prototype.readInt32LE=function(t,r){return r||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,r){return r||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readFloatLE=function(t,r){return r||M(t,4,this.length),e.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,r){return r||M(t,4,this.length),e.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,r){return r||M(t,8,this.length),e.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,r){return r||M(t,8,this.length),e.read(this,t,!1,52,8)},f.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o=0&&(o*=256);)this[r+i]=t/o&255;return r+e},f.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,1,255,0),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},f.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):N(this,t,r,!0),r+2},f.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):N(this,t,r,!1),r+2},f.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):z(this,t,r,!0),r+4},f.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},f.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=0,u=1,f=0;for(this[r]=255&t;++o>0)-f&255;return r+e},f.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=e-1,u=1,f=0;for(this[r+o]=255&t;--o>=0&&(u*=256);)t<0&&0===f&&0!==this[r+o+1]&&(f=1),this[r+o]=(t/u>>0)-f&255;return r+e},f.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,1,127,-128),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},f.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):N(this,t,r,!0),r+2},f.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):N(this,t,r,!1),r+2},f.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):z(this,t,r,!0),r+4},f.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},f.prototype.writeFloatLE=function(t,r,e){return j(this,t,r,!0,e)},f.prototype.writeFloatBE=function(t,r,e){return j(this,t,r,!1,e)},f.prototype.writeDoubleLE=function(t,r,e){return q(this,t,r,!0,e)},f.prototype.writeDoubleBE=function(t,r,e){return q(this,t,r,!1,e)},f.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r=0;--i)t[i+r]=this[i+e];else if(o<1e3||!f.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function G(t){for(var r=[],e=0;e>8,i=e%256,o.push(i),o.push(n);return o}function K(t){return r.toByteArray(X(t))}function Q(t,r,e,n){for(var i=0;i=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function W(t){return t!=t} -},{"base64-js":14,"ieee754":16,"isarray":15,"buffer":13}],11:[function(require,module,exports) { +},{"base64-js":14,"ieee754":15,"isarray":16,"buffer":13}],11:[function(require,module,exports) { var global = arguments[3]; var Buffer = require("buffer").Buffer; var define; @@ -19,9 +19,9 @@ var n,t=arguments[3],r=require("buffer").Buffer;(function(){var r,e=200,u="Unsup "use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var n=require("lodash"),t=e(require("snarkdown")),i=function(){function e(e,n,i,r,s,o){void 0===o&&(o=[]);var u=this;this.content=document.querySelector("#content"),this.message=document.querySelector("#info p"),this.forbidden=[],this.clear();var d=t.default(n);this.message.innerHTML=d+' Nivel '+e+" / "+(s-1)+"",i.forEach(function(e){return u.content.appendChild(e.toNode())}),this.solution=r,this.forbidden=o}return e.prototype.clear=function(){this.content.innerHTML=""},e.prototype.isCorrect=function(e){var t=[],i=this.content.querySelectorAll(".user");if(this.forbidden.includes("nodot")&&e.includes("."))return!1;if(this.forbidden.includes("nodots")&&e.includes(".."))return!1;if(this.forbidden.includes("noor")&&e.includes("|"))return!1;if(this.forbidden.includes("hat")&&!e.includes("^"))return!1;if(this.forbidden.includes("question")&&!e.includes("?"))return!1;if(this.forbidden.includes("<4")&&e.length>3)return!1;if(this.forbidden.includes("<6")&&e.length>5)return!1;if(this.forbidden.includes("curly")&&!e.includes("{"))return!1;if(this.forbidden.includes("pipe")&&!e.includes("|"))return!1;for(var r=0;r
'+e+"
",this.genHead(),this.genEyes(),this.genNose(),this.genMouth(),this.genSpecials()}return e.prototype.genHead=function(){var e=this,s=this.user.querySelector(".head");["black","orc","oldorc","clown","beard","ghost"].forEach(function(t){e.options.includes(t)&&s.classList.add(t)})},e.prototype.genEyes=function(){var e=2,s=2+~~(5*Math.random());this.options.includes("oneeye")&&(e=1);for(var t=0;t
';if(this.options.includes("brows")){var i=this.user.querySelectorAll(".eye");for(t=0;t'}},e.prototype.genNose=function(){this.options.includes("mustache")&&(this.user.querySelector(".head").innerHTML+='
')},e.prototype.genMouth=function(){var e=this;["happymouth","angrymouth","smile","smileteeth","sadmouth","mouth"].forEach(function(s){e.options.includes(s)&&(e.user.querySelector(".head").innerHTML+='
')}),this.options.includes("fangs")&&(this.user.querySelector(".angrymouth").innerHTML+='
')},e.prototype.genSpecials=function(){this.options.includes("dance")&&this.user.classList.add("dance")},e.prototype.toNode=function(){return this.user},e}();exports.default=e; -},{}],6:[function(require,module,exports) { +},{}],8:[function(require,module,exports) { "use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("./Level")),n=e(require("./User")),r=function(){function e(){var e=this;this.content=document.querySelector("#content"),this.userinput=document.querySelector("#userinput"),this.nextButton=document.querySelector("#next"),this.levels=[],this.maxLevel=1,this.currentLevel=1,this.nextButton.addEventListener("click",function(){return e.nextLevel()}),this.userinput.addEventListener("input",function(t){return e.onInput(t)})}return e.prototype.addLevel=function(e,t,n,r){void 0===r&&(r=[]),this.levels[this.maxLevel]={number:this.maxLevel,text:e,users:t,solutions:n,forbidden:r},this.maxLevel++},e.prototype.setLevel=function(e){console.log("Starting "+e+" level / "+this.maxLevel);var r=this.levels[e],o=r.users.map(function(e){return new(n.default.bind.apply(n.default,[void 0].concat(e)))});this.level=new t.default(r.number,r.text,o,r.solutions,this.maxLevel,r.forbidden),this.currentLevel=e,localStorage.currentLevel=e,this.nextButton.classList.add("off"),this.userinput.value="",this.userinput.focus()},e.prototype.enableDebug=function(){var e=this;addEventListener("keydown",function(t){"ArrowUp"==t.code&&t.ctrlKey&&t.altKey?e.nextLevel():"ArrowDown"==t.code&&t.ctrlKey&&t.altKey&&e.prevLevel()})},e.prototype.onInput=function(e){for(var t=this.content.querySelectorAll(".user"),n=this.content.querySelectorAll(".target"),r=e.target.value,o=0;o1&&this.currentLevel0&&(localStorage["level"+this.currentLevel]=this.userinput.value.trim()),this.maxLevel-1==this.currentLevel?this.endGame():this.currentLevel🏆 ¡Has terminado el juego!

';var n=document.createElement("table");n.classList.add("score");for(var r=0;rNivel "+(r+1)+""+o+""}t.appendChild(n);var l=document.createElement("button");l.classList.add("brilliant"),l.textContent="Volver a empezar",l.addEventListener("click",function(t){return e.resetGame()}),t.appendChild(l),document.querySelector(".tags").remove()},e.prototype.resetGame=function(){localStorage.clear(),localStorage.removeItem("endGame"),this.currentLevel=1,window.location.reload()},e}();exports.default=r; -},{"./Level":9,"./User":10}],3:[function(require,module,exports) { +},{"./Level":9,"./User":10}],6:[function(require,module,exports) { "use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var o=e(require("./Game")),a=new o.default;a.addLevel("Con las **expresiones regulares**, podemos utilizar `.` (*un punto*) como un comodín que simboliza un carácter cualquiera (**¡sólo uno!**), de modo que si escribes dos puntos simboliza una palabra con dos 2 carácteres. ¿Cómo representarías, por ejemplo, un DNI (que está formado por 8 dígitos + 1 letra)?",[["74921132A",[]]],[!0]),a.addLevel("Sin embargo, esto es sólo un ejemplo inicial y no tiene demasiado sentido. Vamos con algo más útil... Si nos fijamos en su primer carácter ¿Cómo podríamos seleccionar **sólo** el personaje feliz?",[["74921132A",[]],["84921132A",["happymouth","dance"]]],[!1,!0]),a.addLevel("Ahora buscamos seleccionar los dos personajes que se encuentran **en movimiento**. ¡Recuerda primero buscar el patrón de similitud con los candidatos y las diferencias con los que queremos descartar!",[["74921132A",["dance"]],["84921133C",["sadmouth"]],["84921132A",["happymouth","dance"]]],[!0,!1,!0]),a.addLevel("Pero utilizar varios puntos es engorroso e incómodo. A partir de ahora, vamos a intentar evitarlo. Si escribimos `7+` simboliza el **7** repetido muchas veces (**1 o más veces**). Intenta seleccionar el último personaje...",[["74921132A",[]],["84921133C",["sadmouth"]],["84921132A",["happymouth"]],["77777777A",["black","brows","smileteeth","dance"]]],[!1,!1,!1,!0],["nodot"]),a.addLevel("Ahora vamos a seleccionar todos los personajes salvo el que está asustado. Recordemos: `+` indica que se repite **1 o más veces** el carácter que lo precede (*que también puede ser parte de una expresión regular*). Además, el `*` indicar que se repite **0 o más veces** el carácter que lo precede. No uses varios puntos.",[["74921132A",["dance"]],["84921133C",["angrymouth"]],["84921132A",["happymouth","dance"]],["77777777A",["black","brows","smileteeth","dance"]]],[!0,!1,!0,!0],["<4","nodots"]),a.addLevel("Al usar `.` permitimos cualquier carácter (*sea número, letra, símbolo...*), por lo que no concretamos. En lugar de esto, nos interesa especificar un rango de carácteres específico. En lugar de `.` usaremos `[0-9]` (*cualquier dígito del 0 al 9*). Intenta ahora seleccionar sólo los personajes de tez clara.",[["74921132A",["happymouth","dance"]],["J-429112C",["orc","fangs","angrymouth"]],["84921133C",["black","smile"]],["84921132A",["smile","dance"]],["H-381234A",["orc","brows","fangs","angrymouth"]]],[!0,!1,!1,!0,!1],["nodot"]),a.addLevel("Vale, pongámoslo un poco más difícil... Selecciona ahora a los tres personajes que no son orcos verdes. Quizás tengas que crear rangos `[0-9]` que no sean sólo de números... ¡Recuerda que los puntos ya no están permitidos!",[["74921132A",["happymouth","dance"]],["J-429112C",["orc","fangs","angrymouth"]],["84921133C",["black","smile","dance"]],["84921132A",["smile","dance"]],["H-381234A",["orc","brows","fangs","angrymouth"]]],[!0,!1,!0,!0,!1],["nodot"]),a.addLevel("Modifiquemos un poco los personajes. Ahora hay tanto minúsculas como mayúsculas. Si queremos incluir varios rangos, podemos hacerlo así: `[A-Za-z]`, aunque también podemos incluir carácteres concretos sueltos: `[AHz]` (*Se acepta la letra A, la letra H y la letra z*).",[["74921132c",["happymouth","dance"]],["83811128h",["angrymouth","dance"]],["84921133W",["black","smile","dance"]],["84921132A",["smile","dance"]],["89187373H",["mouth"]]],[!0,!0,!0,!0,!1],["nodot"]),a.addLevel("También se le puede dar la vuelta a las expresiones regulares; En lugar de seleccionar los que cumplen un criterio, seleccionar los que no lo cumplen. Los rangos que tienen un circunflejo `^` en el interior de los corchetes (`[^A]`) simbolizan que no exista ese carácter o rango. Observa que los orcos siempre tienen un guión en su DNI. **Nota**: En el interior de los corchetes, si quieres indicar un guión explícitamente debe estar en la última posición, ya que sino se confundirá con el intervalo para indicar rangos.",[["J-429112C",["orc","smileteeth"]],["28395728a",["black","beard","smile","dance"]],["83713611H",["black","beard","angrymouth","dance"]],["7-381234A",["orc","fangs","angrymouth"]],["L-382271c",["orc","brows","fangs","angrymouth"]]],[!1,!0,!0,!1,!1],["hat","<6"]),a.addLevel("El formato de DNI de los orcos verdes es **Letra-Guión-6Números-Letra**, vamos a intentar concretar más. En lugar de usar `[0-9]+` (*1 o más repeticiones de un dígito del 0 al 9*), podemos utilizar `[0-9]{2}` (*2 repeticiones de un dígito del 0 al 9*). Con esto podemos especificar el número de veces que se repite un carácter.",[["74921132A",["happymouth"]],["J-429112C",["orc","fangs","angrymouth","dance"]],["84921133C",["black","smile"]],["84921132A",["smile"]],["H-381234A",["orc","brows","fangs","angrymouth","dance"]]],[!1,!0,!1,!1,!0],["nodot","curly"]),a.addLevel("La cosa se comienza a complicar. Los orcos verdes más viejos tienen un DNI más pequeño, ya que al principio tenían menos cifras. Con `{2,4}` podemos indicar que el carácter anterior debe tener una longitud **de 2 a 4 carácteres**. También se pueden usar `{2,}` para indicar **2 o más**.",[["K-882132U",["orc","smileteeth"]],["J-44392C",["oldorc","fangs","angrymouth","dance"]],["H-728a",["oldorc","smileteeth","dance"]],["H-281711A",["orc","brows","angrymouth"]],["H-3812A",["oldorc","brows","smileteeth","dance"]]],[!1,!0,!0,!1,!0],["nodot","curly"]),a.addLevel("Los payasos tienen un DNI especial similar al de los orcos verdes. En lugar de un **guión**, tienen un signo **+** (*más*). En las expresiones regulares podemos hacer uso del símbolo `|` para establecer alternativas. Por ejemplo, `(A|B)` significa **A** o **B**. ¡**Ojo**! Algunos carácteres (`+`, `*`, `(`, ...) hay que precederlos de una barra invertida (ej: `\\+`) para no interpretarlos como una expresión regular.",[["K+937212W",["clown","smileteeth","dance"]],["43244392T",["angrymouth"]],["H+421728a",["clown","smileteeth","dance"]],["H-837199R",["orc","brows","angrymouth","dance"]],["H+343421A",["clown","brows","smileteeth","dance"]]],[!0,!1,!0,!0,!0],["nodot","curly","pipe"]),a.addLevel("En algunos casos queremos indicar que el caracter anterior es **opcional**: puede existir o puede que no, y ambas opciones son correctas. Para ello, utilizaremos el símbolo `?`. Los fantasmas tienen un sistema de DNI muy complejo. Cuando han cumplido su tarea en la *no-vida*, se les asigna una letra en la **tercera posición**. Si aún tienen tareas pendientes, carecen de ella.",[["28A84721D",["ghost","sadmouth","dance"]],["39H71283L",["ghost","sadmouth","dance"]],["84118321a",["angrymouth"]],["39N83726D",["ghost","sadmouth","dance"]],["1762312D",["ghost","brows","sadmouth","dance"]]],[!0,!0,!1,!0,!0],["nodot","curly","question"]),a.addLevel("¿Y si quisieramos seleccionar sólo a los orcos que se hacen pasar por fantasmas? Sabremos cuales son porque han falsificado un DNI con menos números porque no saben contar...",[["28A84721D",["ghost","sadmouth"]],["39783L",["ghost","angrymouth","fangs","dance"]],["84118321a",["angrymouth"]],["39N8D",["ghost","brows","fangs","angrymouth","dance"]],["1762312D",["ghost","brows","sadmouth"]]],[!1,!0,!1,!0,!1],["nodot","curly","question"]),a.addLevel("Ahora queremos seleccionar sólo payasos y orcos viejos... Puedes usar la parentización `(+[0-9]|-[A-Z])` para agrupar fragmentos. Ten mucho cuidado con esto, puesto que no es lo mismo `CA|B` (*CA o B*) que `C(A|B)` (*CA o CB*).",[["H+421728a",["clown","smileteeth","dance"]],["28A84721D",["ghost","sadmouth"]],["H-837199R",["orc","brows","angrymouth"]],["83713611H",["black","beard","angrymouth"]],["H-3812A",["oldorc","brows","smileteeth","dance"]]],[!0,!1,!1,!1,!0],["nodot","curly"]),a.enableDebug(),a.start(); -},{"./Game":6}]},{},[3], null) +},{"./Game":8}]},{},[6], null) //# sourceMappingURL=js.13fb95b3.map \ No newline at end of file diff --git a/build/js.13fb95b3.map b/js.13fb95b3.map similarity index 100% rename from build/js.13fb95b3.map rename to js.13fb95b3.map diff --git a/package.json b/package.json deleted file mode 100644 index 535728e..0000000 --- a/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "regex-people", - "version": "1.0.0", - "description": "", - "main": "index.html", - "scripts": { - "build": "rm -rf build && parcel build src/index.html --out-dir build/ --public-url ./", - "start": "parcel src/index.html", - "dev": "parcel serve src/index.html && parcel watch src/index.html", - "clean": "rm -rf .cache node_modules package-lock.json dist", - "deploy": "git subtree push --prefix build origin gh-pages" - }, - "author": "Manz", - "license": "ISC", - "devDependencies": { - "@types/css": "0.0.31", - "@types/lodash-es": "^4.17.0", - "autoprefixer": "^8.6.0", - "babel-preset-env": "^1.7.0", - "cssnano": "^3.10.0", - "parcel-bundler": "^1.8.1", - "postcss": "^6.0.22", - "postcss-import": "^11.1.0", - "postcss-import-url": "^3.0.4", - "postcss-nested": "^3.0.0", - "postcss-preset-env": "^5.1.0", - "stylelint-config-recommended": "^2.1.0", - "typescript": "^2.9.1" - }, - "dependencies": { - "lodash-es": "^4.17.10", - "snarkdown": "^1.2.2" - } -} diff --git a/src/css/faces.pcss b/src/css/faces.pcss deleted file mode 100644 index c0c1e0d..0000000 --- a/src/css/faces.pcss +++ /dev/null @@ -1,155 +0,0 @@ -.head { - & .eye { - display: inline-block; - background: #fff; - width: 45px; - height: 45px; - border-radius: 25px; - margin-top: 1em; - animation: eyeBlink linear infinite; - animation-duration: 5s - } - - &.oldorc .eye { - background:linear-gradient(to bottom, RGB(255,200,200) 20%, #FFF 50%); - } - - & .pupil { - background: #000; - width: 17px; - height: 17px; - border-radius: 10px; - margin: auto; - margin-top: 6px; - } - - & .pupil.left { animation: pupilMoveLeft ease 1 } - & .pupil.right { animation: pupilMoveRight ease 1 } - & .pupil.down { animation: pupilMoveDown ease 1 } - - & .mustache { - background: #111; - width: 35px; - height: 15px; - margin: auto; - position: relative; - top: 8px - } - - & .mouth { - background: #222; - width: 20px; - height: 20px; - border-radius: 25px; - position: absolute; - right: 40px; - bottom: 30px - } - - & .happymouth { - background: #222; - width: 100px; - height: 40px; - border-radius: 0 0 75px 75px; - position: relative; - top: 10px; - margin: auto - } - - & .sadmouth { - border:4px solid #222; - border-bottom:0; - width: 100px; - height: 20px; - border-radius: 75px 75px 0 0; - position: relative; - top: 10px; - margin: auto - } - - & .shortsmile { - width: 80px; - height: 20px; - border: 4px solid #000; - border-top: 0; - border-radius: 0 0 50px 50px; - position: relative; - top: 10px; - margin: auto - } - - & .smile { - width: 100px; - height: 40px; - border: 4px solid #000; - border-top: 0; - border-radius: 0 0 50px 50px; - position: relative; - top: 10px; - margin: auto - } - - & .smileteeth { - width: 100px; - height: 40px; - border: 4px solid #000; - border-radius: 0 0 50px 50px; - position: relative; - top: 10px; - margin: auto; - background:#FFF; - } - - & .angrymouth { - background: #222; - width: 100px; - height: 30px; - border-radius: 75px 75px 0 0; - position: relative; - top: 10px; - margin: auto - } - - & .fangs { - width: 20px; - height: 20px; - background: #fff; - display: inline-block; - margin: 0 10px; - border-radius: 50px 50px 0 0 - } - - & .tongue { - display:block; - position:relative; - margin:auto; - width:50px; - height:30px; - border-radius: 0 0 50% 50%; - background:red; - } - - & .brows { - width: 40px; - height: 10px; - background: #222; - margin: 0 2px; - position: relative; - top: -30px - } -} - -@keyframes pupilMoveRight { - 0%,90% { transform:translate(0, 0) } - 25% { transform:translate(5px, 0) } -} - -@keyframes pupilMoveLeft { - 0%,90% { transform:translate(0, 0) } - 25% { transform:translate(-5px, 0) } -} - -@keyframes pupilMoveDown { - 0%,90% { transform:translate(0, 0) } - 25% { transform:translate(0, 5px) } -} \ No newline at end of file diff --git a/src/css/heads.pcss b/src/css/heads.pcss deleted file mode 100644 index e48ece4..0000000 --- a/src/css/heads.pcss +++ /dev/null @@ -1,87 +0,0 @@ -/* Heads */ -.head { - width: 150px; - height: 150px; - background: #e2cda8; - border-radius: 75px; - box-shadow: 5px 5px 0 #1e1503, -10px -10px 10px rgba(0, 0, 0, 0.4) inset; - position: relative; - margin: 0 14px; - text-align:center; - - &.black { - background: #7f5832 - } - - &.orc { - background: #11511a - } - - &.ghost { - background: #FFF; - border-bottom-left-radius:0; - border-bottom-right-radius:0; - } - - &.clown { - background: linear-gradient(to bottom, #e4200f 5%, #c52020 10%, transparent 20%), - radial-gradient(#f30808 10%, #ad0a0a 12%, #000 14%, transparent 16%), - radial-gradient(circle at bottom, #FFF 50%, #dab794 60%); - - & .smileteeth { - border-color:darkred; - border-width:6px; - } - } - - &.oldorc { - background: linear-gradient(to bottom, #FFF 2%, #04350b 15% 85%, #FFF 90%); - - &::after { - content:" "; - display:block; - margin:auto; - transform:translateY(25px); - width:0px; - height:0px; - border-left: 15px solid transparent; - border-right: 15px solid transparent; - border-top: 15px solid #FFF; - } - } - - &.beard { - background: linear-gradient(to bottom, #e2cda8 57%, #9a8a71 59%); - } -} - -/* Users */ -.user { - display: inline-block; - - & .target { - display:inline-block; - background: #fff; - color: #000; - box-shadow: 0 0 15px rgba(0, 0, 0, 0.5); - padding: 5px 30px; - position: relative; - font-weight:500; - top: 10px; - margin: 4px - } - - &.ok { - & .head { - box-shadow: 0 0 15px 5px #067600; - } - & .target { - background: #37e143 - } - } -} - -.user.dance .head, -span.dance { - animation: baileUser .5s linear alternate infinite; -} \ No newline at end of file diff --git a/src/css/index.pcss b/src/css/index.pcss deleted file mode 100644 index 4010548..0000000 --- a/src/css/index.pcss +++ /dev/null @@ -1,286 +0,0 @@ -@import "https://fonts.googleapis.com/css?family=Indie+Flower|Exo+2:700|Open+Sans:300,400|Inconsolata"; - -html { - background: #111; -} - -body { - margin: 0; - font-family: 'Open Sans', sans-serif; - font-weight: 300; - font-size: 22px; - letter-spacing: -1px; - background: #333; -} - -#title { - background: #000; - font-family: 'Exo 2', sans-serif; - font-size: 42px; - padding:4px 0; - color: #fff; - text-align: center; - text-shadow: 0 0 15px rgba(255, 255, 255, 0.5); - box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); - - & a { - text-decoration:none; - color:#FFF; - } - - & span { - font-family: 'Indie Flower', sans-serif; - font-size: 28px; - color: #e61e1e; - } -} - -#content { - text-align:center; - margin: 2em 0 -} - -@import "./heads.pcss"; -@import "./faces.pcss"; - -#question { - max-width: 800px; - min-height: 300px; - margin: 2em auto; - - & #info { - padding: 10px 30px; - background: linear-gradient(135deg, black 25px, #AAA 25px), #AAA; - min-height: 50px; - margin-bottom: 1em; - border:4px solid #000; - color:#222; - font-family:'Open Sans', sans-serif; - font-weight:400; - font-size:20px; - position:relative; /* for .nivel */ - - & em { - color:darkblue; - padding:0 6px 0 2px; - } - } - - & #userinput { - width: 400px; - height: 50px; - display: inline-block; - background: #111; - color:#067600; - border: 0; - outline: 0; - - &.not { - color:red; - } - } - - & .tags { - width: 700px; - display: block; - margin: auto; - background:#222; - color:#EEE; - } - - & .tags, - #userinput { - font-family: 'Inconsolata', monospace; - font-weight: 500; - font-size: 32px; - text-align: center; - letter-spacing: -1px - } -} - -@media screen and (max-width: 640px) { - #question span.tags { - width:auto; - padding:20px 0; - - & #userinput { - width:100%; - margin:20px 0; - display:flex; - } - } -} - -strong.nivel { - background:darkred; - font-weight:lighter; - padding:2px 10px; - color:#FFF; - position:absolute; - top:-15px; - right:25px; - transform:rotate(3deg); -} - -#footer { - display:flex; - flex-direction:column; - justify-content:center; - background: #111; - color: #fff; - height: 100px; - padding:25px 20px; - - & p { - font-family:'Muli', sans-serif; - letter-spacing:-1px; - font-weight:300; - font-size:18px; - text-align:center; - margin:6px; - - & a { - color:#287dcc; - text-decoration:none; - padding-bottom:1px; - border-bottom:1px solid #222; - } - } - - & .tw i { color: #0084b4 } - & .gh i { color:grey } - - & .social a { - border-bottom:0; - padding:0 4px; - font-size:28px; - - &:hover i { - color:#444; - } - } - - & .blue a { - color:#888; - } - - & a:hover { - color:red; - border-color:red; - } - -} - -button.brilliant { - font-family:Montserrat, sans-serif; - font-size:18px; - color:#FFF; - padding:10px 6px; - border:3px solid white; - background:#333; - margin:25px auto; - display:block; - width:150px; - outline:0; - - &.off { - visibility:hidden; - } - - &:hover { - background:#111; - cursor:pointer; - } - - & i.fa { - padding-right:5px; - color:white; - } -} - -code { - background:#888; - padding:2px 6px; - margin:0 2px; -} - -.off { - display: none; -} - -#question #info.end { - background:green; - color:white; - text-align:center; - font-size:42px; -} - -table.score { - border:3px solid #555; - background:#FFF; - width:auto; - margin:auto; - border-spacing:5px; - font-family:Montserrat, sans-serif; - font-size:18px; - - & td { - border-radius:5px; - padding:5px 40px; - color:#555; - } - - & td:nth-child(1) { - background:#777; - color:#FFF; - } - - & td:nth-child(2) { - border:1px solid #CCC; - font-family:monospace; - font-weight:600; - font-size:22px; - } - - & :nth-child(even) td:nth-child(2) { - background:#EDEDED; - color:#777; - } -} - -.trophy { - display:inline-block; -} - -@keyframes baileUser { - 0% { - transform: skew(-3deg) rotateZ(5deg) translateY(0) - } - 50% { - transform: skew(0) rotateZ(0) translateY(-10px) - } - 100% { - transform: skew(3deg) rotateZ(-5deg) translateY(0) - } -} - -@keyframes eyeBlink { - 0% { - opacity: 1 - } - 94% { - opacity: 1 - } - 95% { - opacity: .25 - } - 96% { - opacity: 0 - } - 97% { - opacity: .25 - } - 98% { - opacity: 1 - } -} \ No newline at end of file diff --git a/src/index.html b/src/index.html deleted file mode 100644 index 3d8ace7..0000000 --- a/src/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - RegEx People Game | By @Manz - - - - - - - -
-
-
-

- <input pattern=""> - -
-
- - - - \ No newline at end of file diff --git a/src/js/Game.ts b/src/js/Game.ts deleted file mode 100644 index 865908c..0000000 --- a/src/js/Game.ts +++ /dev/null @@ -1,141 +0,0 @@ -import Level from './Level'; -import User from './User'; - -export default class Game { - content: HTMLElement = document.querySelector('#content'); - userinput: HTMLInputElement = document.querySelector('#userinput'); - nextButton: HTMLButtonElement = document.querySelector('#next'); - level: Level; - levels: any[] = []; - maxLevel: number = 1; - currentLevel: number = 1; - - constructor() { - // handlers - this.nextButton.addEventListener('click', () => this.nextLevel()); - this.userinput.addEventListener('input', e => this.onInput(e)); - } - - addLevel(text: string, users: any[], solutions: boolean[], forbidden: string[] = []) { - this.levels[this.maxLevel] = { - number: this.maxLevel, - text, - users, - solutions, - forbidden, - }; - this.maxLevel++; - } - - setLevel(num : number) { - console.log('Starting ' + num + ' level / ' + this.maxLevel); - - // preload level - let level = this.levels[num]; - let users = level.users.map(e => new User(...e)); - this.level = new Level(level.number, level.text, users, level.solutions, this.maxLevel, level.forbidden); - - // save current level - this.currentLevel = num; - localStorage.currentLevel = num; - - // initialize - this.nextButton.classList.add('off'); - this.userinput.value = ''; - this.userinput.focus(); - } - - enableDebug() { - addEventListener('keydown', e => { - if ((e.code == 'ArrowUp') && (e.ctrlKey) && (e.altKey)) - this.nextLevel(); - else if ((e.code == 'ArrowDown') && (e.ctrlKey) && (e.altKey)) - this.prevLevel(); - }); - } - - onInput(e) { - let heads = this.content.querySelectorAll('.user'); - let targets = this.content.querySelectorAll('.target'); - let msg = e.target.value; - - for (var i = 0; i < targets.length; i++) { - let r; - try { - r = RegExp("^" + msg + "$").test(targets[i].textContent); - } - catch (e) { - console.info("Error controlado en Regex (todo bajo control):", r); - } - - if (r) - heads[i].classList.add('ok'); - else - heads[i].classList.remove('ok'); - } - - if (this.level.isCorrect(msg)) - this.nextButton.classList.remove('off'); - else - this.nextButton.classList.add('off'); - }; - - start(num?: number) { - if (localStorage.endGame) - return this.endGame(); - - let startLevel = num || Number(localStorage.currentLevel) || 1; - document.querySelector('#info').classList.remove('end'); // fix for development npm debug - this.setLevel(startLevel); - } - - prevLevel() { - if ((this.currentLevel > 1) && (this.currentLevel < this.maxLevel)) - this.setLevel(this.currentLevel-1); - } - - nextLevel() { - if (this.userinput.value.length > 0) - localStorage[`level${this.currentLevel}`] = this.userinput.value.trim(); - if (this.maxLevel-1 == this.currentLevel) - this.endGame(); - else - if (this.currentLevel < this.maxLevel) - this.setLevel(this.currentLevel+1); - } - - endGame() { - console.log('end'); - this.currentLevel = this.maxLevel; - localStorage.endGame = true; - this.content.innerHTML = ''; - this.nextButton.classList.add('off'); - let info = document.querySelector('#info'); - info.classList.add('end'); - info.innerHTML = `

🏆 ¡Has terminado el juego!

`; - - let table = document.createElement('table'); - table.classList.add('score'); - for (let i = 0; i < this.maxLevel-1; i++) { - let sol = localStorage['level'+(i+1)] || ''; - table.innerHTML += `Nivel ${i+1}${sol}`; - } - info.appendChild(table); - - let button = document.createElement('button'); - button.classList.add('brilliant'); - button.textContent = 'Volver a empezar'; - button.addEventListener('click', e => this.resetGame()); - info.appendChild(button); - - document.querySelector('.tags').remove(); - } - - resetGame() { - localStorage.clear(); - localStorage.removeItem('endGame'); - this.currentLevel = 1; - window.location.reload(); - } - -} \ No newline at end of file diff --git a/src/js/Level.ts b/src/js/Level.ts deleted file mode 100644 index e40da45..0000000 --- a/src/js/Level.ts +++ /dev/null @@ -1,63 +0,0 @@ -import User from './User'; -import { isEqual } from 'lodash'; -import snarkdown from 'snarkdown'; - -export default class Level { - content: HTMLDivElement = document.querySelector('#content'); - message: HTMLParagraphElement = document.querySelector('#info p'); - forbidden: string[] = []; - solution: boolean[]; - - constructor(num: number, text: string, users: User[], solution: boolean[], max, forbidden = []) { - this.clear(); - let md = snarkdown(text); - this.message.innerHTML = `${md} Nivel ${num} / ${max-1}`; - users.forEach(e => this.content.appendChild(e.toNode())); - this.solution = solution; - this.forbidden = forbidden; - } - - clear() { - this.content.innerHTML = ''; - } - - isCorrect(str : string) { - let tried = []; - let users = this.content.querySelectorAll('.user'); - - // TODO: Refactor pending... - if (this.forbidden.includes('nodot')) - if (str.includes('.')) - return false; - if (this.forbidden.includes('nodots')) - if (str.includes('..')) - return false; - if (this.forbidden.includes('noor')) - if (str.includes('|')) - return false; - if (this.forbidden.includes('hat')) - if (!str.includes('^')) - return false; - if (this.forbidden.includes('question')) - if (!str.includes('?')) - return false; - if (this.forbidden.includes('<4')) - if (str.length > 3) - return false; - if (this.forbidden.includes('<6')) - if (str.length > 5) - return false; - if (this.forbidden.includes('curly')) - if (!str.includes('{')) - return false; - if (this.forbidden.includes('pipe')) - if (!str.includes('|')) - return false; - - for (let i = 0; i < users.length; i++) - tried[i] = users[i].classList.contains('ok'); - - return (isEqual(tried, this.solution)); - } - -} \ No newline at end of file diff --git a/src/js/User.ts b/src/js/User.ts deleted file mode 100644 index 8dae6ea..0000000 --- a/src/js/User.ts +++ /dev/null @@ -1,70 +0,0 @@ -export default class User { - id: string; - user: HTMLDivElement; - options: string[]; - - constructor(id: string, options: string[]) { - this.id = id; - this.options = options; - - this.user = document.createElement('div'); - this.user.classList.add('user'); - this.user.innerHTML = `
${id}
`; - - this.genHead(); - this.genEyes(); - this.genNose(); - this.genMouth(); - this.genSpecials(); - } - - genHead() { - let head = this.user.querySelector('.head'); - - ['black', 'orc', 'oldorc', 'clown', 'beard', 'ghost'].forEach(e => { - if (this.options.includes(e)) - head.classList.add(e); - }); - } - - genEyes() { - let eyes = 2; - let seg = 2 + ~~(Math.random() * 5); - if (this.options.includes('oneeye')) - eyes = 1; - - for (let i = 0; i < eyes; i++) - this.user.querySelector('.head').innerHTML += `
`; - - if (this.options.includes('brows')) { - let eye = this.user.querySelectorAll('.eye'); - for (let i = 0; i < eyes; i++) - eye[i].innerHTML += `
`; - } - } - - genNose() { - if (this.options.includes('mustache')) - this.user.querySelector('.head').innerHTML += `
`; - } - - genMouth() { - ['happymouth', 'angrymouth', 'smile', 'smileteeth', 'sadmouth', 'mouth'].forEach(e => { - if (this.options.includes(e)) - this.user.querySelector('.head').innerHTML += `
`; - }); - - if (this.options.includes('fangs')) - this.user.querySelector('.angrymouth').innerHTML += `
`; - } - - genSpecials() { - if (this.options.includes('dance')) - this.user.classList.add('dance'); - } - - toNode(): HTMLElement { - return this.user; - } - -} \ No newline at end of file diff --git a/src/js/index.ts b/src/js/index.ts deleted file mode 100644 index 270c99e..0000000 --- a/src/js/index.ts +++ /dev/null @@ -1,187 +0,0 @@ -import Game from './Game'; - -let game = new Game(); - -game.addLevel( - 'Con las **expresiones regulares**, podemos utilizar `.` (*un punto*) como un comodín que simboliza un carácter cualquiera (**¡sólo uno!**), de modo que si escribes dos puntos simboliza una palabra con dos 2 carácteres. ¿Cómo representarías, por ejemplo, un DNI (que está formado por 8 dígitos + 1 letra)?', - [['74921132A', []]], - [true] -); - -game.addLevel( - 'Sin embargo, esto es sólo un ejemplo inicial y no tiene demasiado sentido. Vamos con algo más útil... Si nos fijamos en su primer carácter ¿Cómo podríamos seleccionar **sólo** el personaje feliz?', - [ - ['74921132A', []], - ['84921132A', ['happymouth', 'dance']] - ], - [false, true] -); - -game.addLevel( - 'Ahora buscamos seleccionar los dos personajes que se encuentran **en movimiento**. ¡Recuerda primero buscar el patrón de similitud con los candidatos y las diferencias con los que queremos descartar!', - [ - ['74921132A', ['dance']], - ['84921133C', ['sadmouth']], - ['84921132A', ['happymouth', 'dance']] - ], - [true, false, true] -); - -game.addLevel( - 'Pero utilizar varios puntos es engorroso e incómodo. A partir de ahora, vamos a intentar evitarlo. Si escribimos `7+` simboliza el **7** repetido muchas veces (**1 o más veces**). Intenta seleccionar el último personaje...', - [ - ['74921132A', []], - ['84921133C', ['sadmouth']], - ['84921132A', ['happymouth']], - ['77777777A', ['black', 'brows', 'smileteeth', 'dance']] - ], - [false, false, false, true], - ['nodot'] -); - -game.addLevel( - 'Ahora vamos a seleccionar todos los personajes salvo el que está asustado. Recordemos: `+` indica que se repite **1 o más veces** el carácter que lo precede (*que también puede ser parte de una expresión regular*). Además, el `*` indicar que se repite **0 o más veces** el carácter que lo precede. No uses varios puntos.', - [ - ['74921132A', ['dance']], - ['84921133C', ['angrymouth']], - ['84921132A', ['happymouth', 'dance']], - ['77777777A', ['black', 'brows', 'smileteeth', 'dance']] - ], - [true, false, true, true], - ['<4', 'nodots'] -); - -game.addLevel( - 'Al usar `.` permitimos cualquier carácter (*sea número, letra, símbolo...*), por lo que no concretamos. En lugar de esto, nos interesa especificar un rango de carácteres específico. En lugar de `.` usaremos `[0-9]` (*cualquier dígito del 0 al 9*). Intenta ahora seleccionar sólo los personajes de tez clara.', - [ - ['74921132A', ['happymouth', 'dance']], - ['J-429112C', ['orc', 'fangs', 'angrymouth']], - ['84921133C', ['black', 'smile']], - ['84921132A', ['smile', 'dance']], - ['H-381234A', ['orc', 'brows', 'fangs', 'angrymouth']] - ], - [true, false, false, true, false], - ['nodot'] -); - -game.addLevel( - 'Vale, pongámoslo un poco más difícil... Selecciona ahora a los tres personajes que no son orcos verdes. Quizás tengas que crear rangos `[0-9]` que no sean sólo de números... ¡Recuerda que los puntos ya no están permitidos!', - [ - ['74921132A', ['happymouth', 'dance']], - ['J-429112C', ['orc', 'fangs', 'angrymouth']], - ['84921133C', ['black', 'smile', 'dance']], - ['84921132A', ['smile', 'dance']], - ['H-381234A', ['orc', 'brows', 'fangs', 'angrymouth']] - ], - [true, false, true, true, false], - ['nodot'] -); - -game.addLevel( - 'Modifiquemos un poco los personajes. Ahora hay tanto minúsculas como mayúsculas. Si queremos incluir varios rangos, podemos hacerlo así: `[A-Za-z]`, aunque también podemos incluir carácteres concretos sueltos: `[AHz]` (*Se acepta la letra A, la letra H y la letra z*).', - [ - ['74921132c', ['happymouth', 'dance']], - ['83811128h', ['angrymouth', 'dance']], - ['84921133W', ['black', 'smile', 'dance']], - ['84921132A', ['smile', 'dance']], - ['89187373H', ['mouth']] - ], - [true, true, true, true, false], - ['nodot'] -); - -game.addLevel( - 'También se le puede dar la vuelta a las expresiones regulares; En lugar de seleccionar los que cumplen un criterio, seleccionar los que no lo cumplen. Los rangos que tienen un circunflejo `^` en el interior de los corchetes (`[^A]`) simbolizan que no exista ese carácter o rango. Observa que los orcos siempre tienen un guión en su DNI. **Nota**: En el interior de los corchetes, si quieres indicar un guión explícitamente debe estar en la última posición, ya que sino se confundirá con el intervalo para indicar rangos.', - [ - ['J-429112C', ['orc', 'smileteeth']], - ['28395728a', ['black', 'beard', 'smile', 'dance']], - ['83713611H', ['black', 'beard', 'angrymouth', 'dance']], - ['7-381234A', ['orc', 'fangs', 'angrymouth']], - ['L-382271c', ['orc', 'brows', 'fangs', 'angrymouth']] - ], - [false, true, true, false, false], - ['hat', '<6'] -); - -game.addLevel( - 'El formato de DNI de los orcos verdes es **Letra-Guión-6Números-Letra**, vamos a intentar concretar más. En lugar de usar `[0-9]+` (*1 o más repeticiones de un dígito del 0 al 9*), podemos utilizar `[0-9]{2}` (*2 repeticiones de un dígito del 0 al 9*). Con esto podemos especificar el número de veces que se repite un carácter.', - [ - ['74921132A', ['happymouth']], - ['J-429112C', ['orc', 'fangs', 'angrymouth', 'dance']], - ['84921133C', ['black', 'smile']], - ['84921132A', ['smile']], - ['H-381234A', ['orc', 'brows', 'fangs', 'angrymouth', 'dance']] - ], - [false, true, false, false, true], - ['nodot', 'curly'] -); - -// Level 11 - -game.addLevel( - 'La cosa se comienza a complicar. Los orcos verdes más viejos tienen un DNI más pequeño, ya que al principio tenían menos cifras. Con `{2,4}` podemos indicar que el carácter anterior debe tener una longitud **de 2 a 4 carácteres**. También se pueden usar `{2,}` para indicar **2 o más**.', - [ - ['K-882132U', ['orc', 'smileteeth']], - ['J-44392C', ['oldorc', 'fangs', 'angrymouth', 'dance']], - ['H-728a', ['oldorc', 'smileteeth', 'dance']], - ['H-281711A', ['orc', 'brows', 'angrymouth']], - ['H-3812A', ['oldorc', 'brows', 'smileteeth', 'dance']] - ], - [false, true, true, false, true], - ['nodot', 'curly'] -); - -game.addLevel( - 'Los payasos tienen un DNI especial similar al de los orcos verdes. En lugar de un **guión**, tienen un signo **+** (*más*). En las expresiones regulares podemos hacer uso del símbolo `|` para establecer alternativas. Por ejemplo, `(A|B)` significa **A** o **B**. ¡**Ojo**! Algunos carácteres (`+`, `*`, `(`, ...) hay que precederlos de una barra invertida (ej: `\\+`) para no interpretarlos como una expresión regular.', - [ - ['K+937212W', ['clown', 'smileteeth', 'dance']], - ['43244392T', ['angrymouth']], - ['H+421728a', ['clown', 'smileteeth', 'dance']], - ['H-837199R', ['orc', 'brows', 'angrymouth', 'dance']], - ['H+343421A', ['clown', 'brows', 'smileteeth', 'dance']] - ], - [true, false, true, true, true], - ['nodot', 'curly', 'pipe'] -); - -game.addLevel( - 'En algunos casos queremos indicar que el caracter anterior es **opcional**: puede existir o puede que no, y ambas opciones son correctas. Para ello, utilizaremos el símbolo `?`. Los fantasmas tienen un sistema de DNI muy complejo. Cuando han cumplido su tarea en la *no-vida*, se les asigna una letra en la **tercera posición**. Si aún tienen tareas pendientes, carecen de ella.', - [ - ['28A84721D', ['ghost', 'sadmouth', 'dance']], - ['39H71283L', ['ghost', 'sadmouth', 'dance']], - ['84118321a', ['angrymouth']], - ['39N83726D', ['ghost', 'sadmouth', 'dance']], - ['1762312D', ['ghost', 'brows', 'sadmouth', 'dance']] - ], - [true, true, false, true, true], - ['nodot', 'curly', 'question'] -); - -game.addLevel( - '¿Y si quisieramos seleccionar sólo a los orcos que se hacen pasar por fantasmas? Sabremos cuales son porque han falsificado un DNI con menos números porque no saben contar...', - [ - ['28A84721D', ['ghost', 'sadmouth']], - ['39783L', ['ghost', 'angrymouth', 'fangs', 'dance']], - ['84118321a', ['angrymouth']], - ['39N8D', ['ghost', 'brows', 'fangs', 'angrymouth', 'dance']], - ['1762312D', ['ghost', 'brows', 'sadmouth']] - ], - [false, true, false, true, false], - ['nodot', 'curly', 'question'] -); - -game.addLevel( - 'Ahora queremos seleccionar sólo payasos y orcos viejos... Puedes usar la parentización `(\+[0-9]|-[A-Z])` para agrupar fragmentos. Ten mucho cuidado con esto, puesto que no es lo mismo `CA|B` (*CA o B*) que `C(A|B)` (*CA o CB*).', - [ - ['H+421728a', ['clown', 'smileteeth', 'dance']], - ['28A84721D', ['ghost', 'sadmouth']], - ['H-837199R', ['orc', 'brows', 'angrymouth']], - ['83713611H', ['black', 'beard', 'angrymouth']], - ['H-3812A', ['oldorc', 'brows', 'smileteeth', 'dance']] - ], - [true, false, false, false, true], - ['nodot', 'curly'] -); - -game.enableDebug(); -game.start(); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 4fce22c..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "lib": ["es2016", "dom"], - "typeRoots": [ - "node_modules/@types" - ] - }, - "exclude": [ - "dist", - "build", - "node_modules" - ] -} \ No newline at end of file