-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclasses.js
More file actions
76 lines (71 loc) · 2.03 KB
/
classes.js
File metadata and controls
76 lines (71 loc) · 2.03 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
class BotMessage {
constructor(name, content) {
this.content = content
var p = document.createElement('div')
id('messages_container').appendChild(p)
p.className = 'message'
p.style.background = 'lightgrey'
p.textContent = `${name} > ${content}`
p.style.opacity = 0;
var a = 0;
var op = setInterval(function() {
p.style.opacity = a
a += 0.1
if(p.style.opacity == 1) {
clearInterval(op)
}
}, 20)
this.e = p
}
}
class Contact {
constructor(name) {
this.name = name
this.elem = document.createElement('span')
id('contacts').appendChild(this.elem)
this.elem.className = "contact"
this.elem.innerHTML = `<div class="contact-name">${name}</div>`
}
openDM() {
current = this
// anything else?
// yes
}
}
class Dialogue {
constructor(text) {
var p = document.createElement('div')
id('messages_container').appendChild(p)
p.style.background = '#eeeeee'
p.innerHTML = text
p.className = 'message'
p.style.opacity = 0;
var a = 0;
var op = setInterval(function() {
p.style.opacity = a
a += 0.1
if(p.style.opacity == 1) {
clearInterval(op)
}
}, 20)
this.e = p
}
}
class UserMessage {
constructor(content) {
var p = document.createElement('div')
id('messages_container').appendChild(p)
p.className = 'message'
p.textContent = `${user.name} > ${content}`
p.style.opacity = 0;
var a = 0;
var op = setInterval(function() {
p.style.opacity = a
a += 0.1
if(p.style.opacity == 1) {
clearInterval(op)
}
}, 20)
this.e = p
}
}