🌏🌏 Checkpoint
./public/script.js:1954897/22904 ./views/index.html:1954897/34498
This commit is contained in:
1 parent
611bbf7624
commit
e5f41af5c2
2 files changed
+29
-25
No files matched your search
+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) => {
|
||||
|
||||
Reference in new issue
Block a user