🌏🌏 Checkpoint
./public/script.js:1954897/22904 ./views/index.html:1954897/34498
This commit is contained in:
+24
-23
@@ -1,36 +1,37 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
var btns = document.querySelectorAll('[data-open]')
|
||||
let prev = null
|
||||
const wordBank = document.getElementById('wordBank')
|
||||
const input = document.getElementById('input')
|
||||
|
||||
|
||||
;[].forEach.call(
|
||||
document.querySelectorAll('[data-open]'),
|
||||
function (el) {
|
||||
el.addEventListener('click', function (e) {
|
||||
const iam = Array.from(document.body.children).filter(el => !el.hidden)[0];
|
||||
iam.hidden = true;
|
||||
if (this.dataset.open === 'prev') {
|
||||
prev.hidden = false;
|
||||
} else {
|
||||
document.getElementById(this.dataset.open).hidden = false
|
||||
}
|
||||
prev = iam
|
||||
});
|
||||
}
|
||||
)
|
||||
|
||||
for (var i = 0; i < btns.length; i++) {
|
||||
;btns[i].addEventListener('click', function (e) {
|
||||
|
||||
const iam = Array.from(document.body.children).filter(el => !el.hidden)[0];
|
||||
console.log({iam, prev})
|
||||
|
||||
|
||||
iam.hidden = true;
|
||||
if (this.dataset.open === 'prev') {
|
||||
prev.hidden = false;
|
||||
} else {
|
||||
document.getElementById(this.dataset.open).hidden = false
|
||||
}
|
||||
prev = iam
|
||||
})
|
||||
if (btns[i].dataset.fire) {
|
||||
btns[i].addEventListener('click', function (e) {
|
||||
console.log(this, e)
|
||||
;[].forEach.call(
|
||||
document.querySelectorAll('[data-fire]'),
|
||||
function (el) {
|
||||
el.addEventListener('click', function (e) {
|
||||
document.dispatchEvent(new Event(this.dataset.fire))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
document.addEventListener('word', (e) => {
|
||||
console.log('Word dispatched')
|
||||
// wordBank.innerHTML = ''
|
||||
wordBank.innerHTML = Math.random()
|
||||
});
|
||||
|
||||
document.addEventListener('fs', (e) => {
|
||||
|
||||
+5
-2
@@ -51,7 +51,6 @@
|
||||
Esta <em>debe</em> ser un sustantivo, verbo, adjetivo, adverbio o frase común.
|
||||
<strong>No</strong> puede ser un artículo, pronombre, conjunción ni exclamación.
|
||||
</p>
|
||||
<p></p>
|
||||
<div class="btn-row">
|
||||
<button class="btn" data-open="prev">Entendido</button>
|
||||
</div>
|
||||
@@ -72,7 +71,7 @@
|
||||
<input type="text" placeholder="p. ej., " id="input">
|
||||
<div class="flex" id="wordBank">…</div>
|
||||
<div class="btn-row">
|
||||
<button class="btn" data-dispatch="word">Más palabras</button>
|
||||
<button class="btn" data-fire="word">Más palabras</button>
|
||||
<button class="btn" data-open="view3" data-fire="fs" disabled>¡Listo!</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -80,6 +79,10 @@
|
||||
<h1 class="h4">Coloca el teléfono sobre la frente</h1>
|
||||
<p>Toca la pantalla cuando estés listo.</p>
|
||||
</div>
|
||||
<!-- <div class="container middle" id="view3" hidden>
|
||||
<h1 class="h4">Coloca el teléfono sobre la frente</h1>
|
||||
<p>Toca la pantalla cuando estés listo.</p>
|
||||
</div> -->
|
||||
</body>
|
||||
<script src="./script.js" charset="utf-8"></script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user