Mercurial > repos > jankanis > blast2html
annotate NCBI Blast reference example_files/toggle.js @ 123:720efb818f1b
really fix python 2.6 array type code issue
author | Jan Kanis <jan.code@jankanis.nl> |
---|---|
date | Thu, 31 Jul 2014 18:40:28 +0200 |
parents | 344cd76f6fd2 |
children |
rev | line source |
---|---|
0
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
1 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
2 Toggle = function(node) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
3 this.init(node); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
4 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
5 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
6 /** |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
7 * @class Creates a new Toggle class with "node" as src |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
8 * @return Reutrns a new toggle instance |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
9 */ |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
10 Toggle.prototype = { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
11 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
12 init: function(node) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
13 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
14 // Subclass instance? |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
15 if (typeof(arguments[0]) == 'undefined') return; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
16 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
17 var oThis = this; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
18 this.node = node; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
19 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
20 // Initialize "showing" variable based on presence of "showing" or |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
21 // "hiding" class. If neither, then showing. Be sure class is |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
22 // set to reflect variable value |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
23 node.showing = |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
24 utils.hasClass(node, "showing") || !utils.hasClass(node, "hiding"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
25 utils.addClass(node, node.showing ? "showing" : "hiding"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
26 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
27 // Set notifier for node |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
28 utils.addEvent(node, "click", function(e) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
29 e = e || window.event; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
30 utils.preventDefault(e); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
31 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
32 var theNode = utils.getTargetObj(e); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
33 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
34 // Send message to global notifier, if one exists |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
35 if (typeof(Notifier) != 'undefined') { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
36 var notifier = Notifier.getInstance(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
37 // Notify before change |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
38 notifier.Notify(oThis, "change:" + theNode.id, !this.showing); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
39 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
40 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
41 // Hide or show based on current state |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
42 if (this.showing) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
43 oThis.hide(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
44 } else { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
45 oThis.show(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
46 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
47 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
48 }, false); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
49 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
50 utils.addEvent(node, "selectstart", function(e) { utils.preventDefault(e); }, true); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
51 utils.addEvent(node, "drag", function(e) { utils.preventDefault(e); }, true); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
52 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
53 // Cache "this" for ID lookup |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
54 if (!node.id) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
55 node.id = utils.createNewId(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
56 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
57 var m = Toggle.getSrcs(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
58 m[node.id] = this; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
59 }, |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
60 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
61 // Hide targets, and set self to hiding. |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
62 hide: function() { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
63 var oThis = this; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
64 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
65 oThis.setHiding(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
66 if (oThis.listeners) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
67 forEach(oThis.listeners, function(l) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
68 oThis.hideTarget(l); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
69 }); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
70 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
71 }, |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
72 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
73 // Show targets, and set self to showing. |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
74 show: function() { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
75 var oThis = this; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
76 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
77 oThis.setShowing(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
78 if (oThis.listeners) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
79 forEach(oThis.listeners, function(l) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
80 oThis.showTarget(l); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
81 }); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
82 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
83 }, |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
84 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
85 // Set own presentation to "showing" |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
86 setShowing: function() { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
87 utils.addClass(this.node, "showing"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
88 utils.removeClass(this.node, "hiding"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
89 this.node.showing = true; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
90 }, |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
91 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
92 // Set own presentation to "hiding" |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
93 setHiding: function() { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
94 utils.addClass(this.node, "hiding"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
95 utils.removeClass(this.node, "showing"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
96 this.node.showing = false; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
97 }, |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
98 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
99 // Show a target |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
100 showTarget: function(l) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
101 utils.addClass(l, "shown"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
102 utils.removeClass(l, "hidden"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
103 }, |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
104 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
105 // Hide a target |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
106 hideTarget: function(l) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
107 utils.addClass(l, "hidden"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
108 utils.removeClass(l, "shown"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
109 }, |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
110 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
111 // Add a target to this toggle. |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
112 add: function(target) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
113 if (!this.listeners) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
114 this.listeners = new Array(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
115 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
116 this.listeners[this.listeners.length] = target; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
117 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
118 if (utils.hasClass(target, "hidden")) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
119 this.setHiding(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
120 this.node.showing = false; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
121 } else { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
122 this.setShowing(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
123 this.node.showing = true; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
124 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
125 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
126 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
127 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
128 // Show/hide a "target" (a node controlled by the node with the given ID) |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
129 Toggle.addTarget = function(srcid, target) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
130 var tn = Toggle.findOrMake(srcid); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
131 tn.add(target); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
132 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
133 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
134 // Assoc array of srcs indexed by their ids |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
135 Toggle.getSrcs = function() { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
136 if (!Toggle.srcs) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
137 Toggle.srcs = new Object(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
138 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
139 return Toggle.srcs; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
140 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
141 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
142 // Find or make toggle for given id |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
143 Toggle.findOrMake = function(srcid) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
144 var ts = Toggle.getSrcs(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
145 var tn = ts[srcid]; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
146 if (!tn) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
147 tn = new Toggle($(srcid)); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
148 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
149 return tn; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
150 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
151 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
152 // This dispatches the call to Toggle.onload, which may be |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
153 // overridden by instances (subclasses) |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
154 Toggle._onload = function() { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
155 Toggle.onload(); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
156 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
157 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
158 // A toggle source node controls other nodes that reference it by id using |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
159 // their toggle= attribute. A node may be both a toggle source and destination. |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
160 Toggle.onload = function() { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
161 //alert("toggle start"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
162 if(utils.hasClass(document.body,"noToggleCheck")) return; |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
163 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
164 shnodes = jQuery("[toggle]"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
165 // Now hook up dst nodes |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
166 forEach(shnodes, function(node) { |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
167 // Link toggle node to its source |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
168 var srcid = node.getAttribute("toggle"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
169 Toggle.addTarget(srcid, node); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
170 }); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
171 //alert("toggle 2 end"); |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
172 } |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
173 |
bad241dc701f
add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff
changeset
|
174 utils.addEvent(window, 'load', Toggle._onload, false); |