Last change
on this file since 15713 was
7956,
checked in by rvelices, 14 years ago
|
rv menu tree async javascript changes
|
-
Property svn:eol-style set to
LF
|
File size:
2.2 KB
|
Line | |
---|
1 | var XElement={hasClass:function(a,d){if(!a)return false;var f=a.className;return f.length>0&&(f==d||RegExp("(^|\\s)"+d+"(\\s|$)").test(f))},addClass:function(a,d){if(a){XElement.hasClass(a,d)||(a.className+=(a.className?" ":"")+d);return a}},toggleClasses:function(a,d,f){if(a){for(var b=a.className.split(/\s+/),g=-1,c=-1,e=0;e<b.length;e++){if(b[e]==d)g=e;if(b[e]==f)c=e}if(g>=0){b.splice(g,1);c>=g&&c--}else b.push(d);c>=0?b.splice(c,1):b.push(f);a.className=b.join(" ");return a}}},RVTree={options:{nodeClosedClass:"liClosed", |
---|
2 | nodeOpenClass:"liOpen",nodeBulletClass:"liBullet",nodeLinkClass:"bullet"},convertTree:function(a){if(document.createElement){if(window.attachEvent&&!window.opera)if(/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)!=null)RVTree.options.IEVersion=parseFloat(RegExp.$1);RVTree._processList(a,true)}},_processList:function(a,d){if(!(!a.childNodes||a.childNodes.length==0)){for(var f=0;f<a.childNodes.length;f++){var b=a.childNodes[f];if(b.nodeName=="LI"){for(var g=false,c=0;c<b.childNodes.length;c++){var e= |
---|
3 | b.childNodes[c];if(e.nodeName=="UL"){g=true;RVTree._processList(e,false)}}c=document.createElement("SPAN");e="\u00a0";c.className=RVTree.options.nodeLinkClass;if(g){XElement.hasClass(b,RVTree.options.nodeOpenClass)||XElement.addClass(b,RVTree.options.nodeClosedClass);if(b.firstChild.nodeName=="#text"){e+=b.firstChild.nodeValue;b.removeChild(b.firstChild)}c.onclick=function(){XElement.toggleClasses(this.parentNode,RVTree.options.nodeOpenClass,RVTree.options.nodeClosedClass);return false}}else if(XElement.hasClass(b, |
---|
4 | RVTree.options.nodeClosedClass))c.onclick=function(){var h=this.parentNode.getElementsByTagName("A");if(h.length)document.location=h[0].href};else XElement.addClass(b,RVTree.options.nodeBulletClass);b.style.listStyleType="none";if(d&&RVTree.options.IEVersion&&RVTree.options.IEVersion<8)b.style.marginLeft="-16px";if(c){c.appendChild(document.createTextNode(e));b.insertBefore(c,b.firstChild)}}}a.style.marginLeft=0;a.style.paddingLeft=d?0:"8px"}}}; |
---|
5 | (function(){if(typeof _rvTreeAutoQueue!="undefined"&&_rvTreeAutoQueue.length)for(var a=0;a<_rvTreeAutoQueue.length;a++)RVTree.convertTree(_rvTreeAutoQueue[a]);_rvTreeAutoQueue={push:function(d){RVTree.convertTree(d)}}})(); |
---|
Note: See
TracBrowser
for help on using the repository browser.