-
Notifications
You must be signed in to change notification settings - Fork 0
/
Behaviours.js
133 lines (117 loc) · 4.53 KB
/
Behaviours.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
Behaviours.js
Purpose:
This file will add all event handlers to the proper HTML elements
Uses Behaviour.js for this functionality.
Dependencies:
Requires Behaviour.js to be installed. This can be located at
http://bennolan.com/behaviour/
*/
function loadBehaviours()
{
/*
This variable implementation allows us to use selectors to determine what elements to add
behaviours too
if doOnHover = true from the constants file then we want to have the events change on mouseover
otherwise we want it to occur onclick
*/
if (doOnHover)
{
var myrules = {
'.element' : function(el){
el.onmouseover = function(){
loadElement(el);
}
el.onclick = function(){
fixElementHover(el);
}
}
,
'.elementData' : function(el){
el.onclick = function(){
loadColorScheme(el.id);
}
}
,
'.elementGraphBar' : function(el){
el.onmouseover = function(){
loadElement(el);
}
el.onclick = function(){
fixElementHover(el);
}
}
,
'.dataLabel' : function(el){
el.onmouseover = function(){
loadColorScheme(el.nextSibling.id);
}
}
};
}
// We know if we dont want the elements to change on hover then we want then
// to change on click
else
{
var myrules = {
'.element' : function(el){
el.onclick = function(){
loadElement(el);
}
}
,
'.elementData' : function(el){
el.onclick = function(){
loadColorScheme(el.id);
}
}
,
'.elementGraphBar' : function(el){
el.onmouseover = function(){
loadElement(el);
}
}
,
'.dataLabel' : function(el){
el.onmouseover = function(){
loadColorScheme(el.nextSibling.id);
}
}
};
}
// Register the behaviour with our behaviours object
Behaviour.register(myrules);
// Add other behaviours
document.getElementById("resizeGraph").onclick = function() { resizeGraph(); };
// Menu behaviours
document.getElementById("menu_iMass").onclick = function() { loadColorScheme("iMass"); };
document.getElementById("menu_iDensity").onclick = function() { loadColorScheme("iDensity"); };
document.getElementById("menu_iAR").onclick = function() { loadColorScheme("iAR"); };
document.getElementById("menu_iAV").onclick = function() { loadColorScheme("iAV"); };
document.getElementById("menu_iCR").onclick = function() { loadColorScheme("iCR"); };
document.getElementById("menu_iMP").onclick = function() { loadColorScheme("iMP"); };
document.getElementById("menu_iBP").onclick = function() { loadColorScheme("iBP"); };
document.getElementById("menu_iSHC").onclick = function() { loadColorScheme("iSHC"); };
document.getElementById("menu_iHoV").onclick = function() { loadColorScheme("iHoV"); };
document.getElementById("menu_iEN").onclick = function() { loadColorScheme("iEN"); };
document.getElementById("menu_iFIP").onclick = function() { loadColorScheme("iFIP"); };
document.getElementById("menu_iIE").onclick = function() { loadColorScheme("iIE"); };
document.getElementById("menu_i1s").onclick = function() { loadColorScheme("i1s"); };
document.getElementById("menu_i2s").onclick = function() { loadColorScheme("i2s"); };
document.getElementById("menu_i2p").onclick = function() { loadColorScheme("i2p"); };
document.getElementById("menu_i3s").onclick = function() { loadColorScheme("i3s"); };
document.getElementById("menu_i3p").onclick = function() { loadColorScheme("i3p"); };
document.getElementById("menu_i3d").onclick = function() { loadColorScheme("i3d"); };
document.getElementById("menu_i4s").onclick = function() { loadColorScheme("i4s"); };
document.getElementById("menu_i4p").onclick = function() { loadColorScheme("i4p"); };
document.getElementById("menu_i4d").onclick = function() { loadColorScheme("i4d"); };
document.getElementById("menu_i4f").onclick = function() { loadColorScheme("i4f"); };
document.getElementById("menu_i5s").onclick = function() { loadColorScheme("i5s"); };
document.getElementById("menu_i5p").onclick = function() { loadColorScheme("i5p"); };
document.getElementById("menu_i5d").onclick = function() { loadColorScheme("i5d"); };
document.getElementById("menu_i5f").onclick = function() { loadColorScheme("i5f"); };
document.getElementById("menu_i6s").onclick = function() { loadColorScheme("i6s"); };
document.getElementById("menu_i6p").onclick = function() { loadColorScheme("i6p"); };
document.getElementById("menu_i6d").onclick = function() { loadColorScheme("i6d"); };
document.getElementById("menu_i7s").onclick = function() { loadColorScheme("i7s"); };
}