-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscreen.js
46 lines (42 loc) · 1.56 KB
/
screen.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
var screen = module.exports = {}
screen.tracks = {}
screen.desc = {}
screen.desc.width = 300
screen.tree = {}
screen.scrollbar = {}
screen.scrollbar.width = 17
screen.document = null
screen.window = null
screen.descriptions = null
screen.headings = null
screen.render = function render(e) {
var trackDiv = screen.document.getElementById('track-navigation')
var treeDiv = screen.document.getElementById('course-tree')
var descDiv = screen.document.getElementById('course-description')
screen.height = window.innerHeight
screen.width = window.innerWidth
screen.tracks.width = trackDiv.clientWidth
screen.tree.width = screen.width - screen.tracks.width - screen.desc.width
var trackCSS = "height: "+screen.height+"px;"
var treeCSS = "height: "+screen.height+"px;"
+ "width: "+screen.tree.width+"px;"
var descCSS = "height: "+screen.height+"px;"
+ "width: "+screen.desc.width+"px;"
trackDiv.setAttribute('style',trackCSS)
treeDiv.setAttribute('style',treeCSS)
descDiv.setAttribute('style',descCSS)
}
screen.setHeadings = function setHeadings(text) {
if(!screen.headings)
screen.headings = screen.document.getElementsByClassName("description-heading")
for(var i=0; i < screen.headings.length; i++) {
screen.headings.item(i).innerHTML = text
}
}
screen.setDescriptions = function setDescriptions(text) {
if(!screen.descriptions)
screen.descriptions = screen.document.getElementsByClassName("description-content")
for(var i=0; i < screen.descriptions.length; i++) {
screen.descriptions.item(i).innerHTML = text
}
}