-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDomInit.js
63 lines (62 loc) · 2.56 KB
/
DomInit.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
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
const genDom = new GeneratorDom()
document.getElementById('options').appendChild(genDom.initButtons())
document.getElementById('dropdowns').appendChild(genDom.initDropdowns())
document.getElementById('clearButton').addEventListener('click', function () {
genDom.clear()
})
document.getElementById('undoButton').addEventListener('click', function () {
genDom.undo()
})
document.getElementById('leftButton').addEventListener('click', function () {
genDom.setAlign(LEFT_ALIGN)
})
document.getElementById('rightButton').addEventListener('click', function () {
genDom.setAlign(RIGHT_ALIGN)
})
document.getElementById('defaultButton').addEventListener('click', function () {
genDom.clear()
genDom.setAlign(LEFT_ALIGN)
let colourReset = genDom.addColour('white', 'black')
let colourOne = genDom.addColour('black', 'lightgreen')
let colourTwo = genDom.addColour('lightblue', 'black')
let colourThree = genDom.addColour('lightgreen', 'black')
let colourFour = genDom.addColour('magenta', 'black')
genDom.addElement(colourOne)
genDom.addElement(findElement('Mode'), genDom.leftAlign)
genDom.addElement(colourReset)
genDom.addElement(findElement('Space character'))
genDom.addElement(findElement('Left chevron character'))
genDom.addElement(findElement('Left chevron character'))
genDom.addElement(findElement('Space character'))
genDom.addElement(findElement('Short filename'))
genDom.addElement(findElement('Space character'))
genDom.addElement(findElement('Right chevron character'))
genDom.addElement(findElement('Right chevron character'))
genDom.update()
genDom.setAlign(RIGHT_ALIGN)
genDom.addElement(findElement('Modified flag'))
genDom.addElement(findElement('Help flag'))
genDom.addElement(findElement('Read-only flag'))
genDom.addElement(findElement('Space character'))
genDom.addElement(colourTwo)
genDom.addElement(findElement('Git branch'))
genDom.addElement(colourReset)
genDom.addElement(findElement('Space character'))
genDom.addElement(colourThree)
genDom.addElement(findElement('Long filename'))
genDom.addElement(findElement('Colon character'))
genDom.addElement(findElement('Colon character'))
genDom.addElement(colourFour)
genDom.addElement(findElement('Current line number'))
genDom.addElement(findElement('Slash character'))
genDom.addElement(findElement('Total line number'))
genDom.addElement(colourReset)
genDom.addElement(findElement('Pipe character'))
genDom.addElement(findElement('File type'))
genDom.update()
})
function findElement (title) {
return options.find(elem => {
return elem.title === title
})
};