Files
tabu/public/script.js
T
Glitch (hello-express) e5f41af5c2 🌏🌏 Checkpoint
./public/script.js:1954897/22904
./views/index.html:1954897/34498
2019-06-28 06:17:18 +00:00

50 lines
1.4 KiB
JavaScript

(function() {
'use strict';
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
});
}
)
;[].forEach.call(
document.querySelectorAll('[data-fire]'),
function (el) {
el.addEventListener('click', function (e) {
document.dispatchEvent(new Event(this.dataset.fire))
});
}
)
document.addEventListener('word', (e) => {
// wordBank.innerHTML = ''
wordBank.innerHTML = Math.random()
});
document.addEventListener('fs', (e) => {
if (!screen.orientation.lock) return
document
.documentElement
.requestFullscreen()
.then(function () {
screen.orientation.lock('landscape').catch(function () {
document.exitFullscreen()
})
})
});
}());