summaryrefslogtreecommitdiff
path: root/assignment1/materials/Environmental Impact Assessment Course Module » 2-6 Summary_files/unu.js
diff options
context:
space:
mode:
Diffstat (limited to 'assignment1/materials/Environmental Impact Assessment Course Module » 2-6 Summary_files/unu.js')
-rw-r--r--assignment1/materials/Environmental Impact Assessment Course Module » 2-6 Summary_files/unu.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/assignment1/materials/Environmental Impact Assessment Course Module » 2-6 Summary_files/unu.js b/assignment1/materials/Environmental Impact Assessment Course Module » 2-6 Summary_files/unu.js
new file mode 100644
index 0000000..5e70cf1
--- /dev/null
+++ b/assignment1/materials/Environmental Impact Assessment Course Module » 2-6 Summary_files/unu.js
@@ -0,0 +1,64 @@
+/*
+ UNU-specific JavaScript
+*/
+
+var UNU = {
+
+prepareNavigation:function()
+{
+ var lis = $('navul').childNodes;
+ for(var i=0;i<lis.length;i++)
+ {
+ // grab just the list items
+ if(lis[i].nodeType == 1 && lis[i].tagName.toLowerCase() == 'li')
+ {
+
+
+ current = lis[i].childNodes;
+ current[0].className = 'h';
+ el = current[0];
+ var wrapper = document.createElement('span');
+ el.parentNode.replaceChild(wrapper, el);
+ wrapper.appendChild(el);
+
+ var sub = lis[i].getElementsByTagName("ul");
+ if(sub.length > 0)
+ {
+ // attach a rollup effect and onclick event to the span inside the list item
+ // this element must be the first element (ie: no space between the open
+ // li and the <span> or <a>
+ lis[i].childNodes[0].fx = new fx.Height(sub[0], {duration:300});
+ lis[i].childNodes[0].fx.hide();
+ lis[i].childNodes[0].onclick = this.fxonclick;
+ }
+ }
+ }
+
+ var lis = $('navul').getElementsByTagName('li');
+ for(var i=0;i<lis.length;i++)
+ {
+ if(lis[i].className && lis[i].className.match(/current_page_item/))
+ {
+
+ if(lis[i].childNodes[0].fx)
+ {
+
+
+ lis[i].childNodes[0].fx.toggle();
+ }else if(lis[i].parentNode.parentNode.parentNode.parentNode.childNodes[0].fx){
+ lis[i].parentNode.parentNode.parentNode.parentNode.childNodes[0].fx.toggle();
+ } else if(lis[i].parentNode.parentNode.childNodes[0].fx){
+
+
+ lis[i].parentNode.parentNode.childNodes[0].fx.toggle();
+ }
+ }
+ }
+},
+
+fxonclick:function(){
+ this.fx.toggle();
+ return false;
+}
+
+};