-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintrotext.js
25 lines (21 loc) · 899 Bytes
/
introtext.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class IntroText{
constructor(){
this.introText = document.createElement('p');
this.introText.classList.add("centerscreen")
this.introText.id = "introText"
this.introText.style.whiteSpace = "pre"
this.introText.style.textAlign = "center"
this.introText.textContent = "Hover the left side to open menu\n(Or use \"?\" for keybinds)"
document.body.appendChild(this.introText)
// Thanks Javascript, I have to mention what "this" means with whatever this means
this.removeIntro = this.removeIntro.bind(this)
document.body.addEventListener("mousedown", this.removeIntro, true)
document.body.addEventListener("keydown", this.removeIntro, true)
setTimeout(this.removeIntro, 5000)
}
removeIntro(){
this.introText.remove()
document.body.removeEventListener("mousedown", this.removeIntro, false);
document.body.removeEventListener("keydown", this.removeIntro, false);
}
}