Index: extensions/rv_menutree/trunk/changelog.txt
===================================================================
--- extensions/rv_menutree/trunk/changelog.txt	(revision 6509)
+++ extensions/rv_menutree/trunk/changelog.txt	(revision 6608)
@@ -1,9 +1,13 @@
+2.1.c
+	- improved javascript (faster, async loading in browser, better compressed zith google closure compiler)
+
+2.1.b
+	- themes can define their own rv_menutree_categories.tpl
+
+2.1.a
+	- compatibility with piwigo 2.1
+
 2.0.c
 	- optimizations by calling make_index_url less frequently
 	- compatible with IE8
 
-2.1.a
-	- compatibility with piwigo 2.1
-
-2.1.b
-	- themes can define their own rv_menutree_categories.tpl
Index: extensions/rv_menutree/trunk/js/rvtree-min.js
===================================================================
--- extensions/rv_menutree/trunk/js/rvtree-min.js	(revision 6509)
+++ extensions/rv_menutree/trunk/js/rvtree-min.js	(revision 6608)
@@ -1,1 +1,4 @@
-var XElement={hasClassName:function(element,className){if(!element)return false;var elementClassName=element.className;if(elementClassName.length==0)return false;if(elementClassName==className||elementClassName.match(new RegExp("(^|\\s)"+className+"(\\s|$)")))return true;return false},addClassName:function(element,className){if(!element)return;var classNames=element.className.split(/\s+/);for(var i=0;i<classNames.length;i++)if(className==classNames[i])return;classNames.splice(0,0,className);element.className=classNames.join(' ');return element},toggleClassName:function(element,className){if(!element)return;var classNames=element.className.split(/\s+/);for(var i=0;i<classNames.length;i++)if(classNames[i]==className)break;if(i==classNames.length)classNames.splice(0,0,className);else classNames.splice(i,1);element.className=classNames.join(' ');return element}};var RVTree={options:{nodeClosedClass:"liClosed",nodeOpenClass:"liOpen",nodeBulletClass:"liBullet",nodeLinkClass:"bullet"},convertTree:function(root){if(!document.createElement)return;if(window.attachEvent&&!window.opera){if(new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})").exec(navigator.userAgent)!=null)RVTree.options.IEVersion=parseFloat(RegExp.$1)}RVTree._processList(root,true)},_processList:function(ul,isRoot){if(!ul.childNodes||ul.childNodes.length==0)return;for(var i=0;i<ul.childNodes.length;i++){var item=ul.childNodes[i];if(item.nodeName!="LI")continue;var subLists=false;for(var sitemi=0;sitemi<item.childNodes.length;sitemi++){var sitem=item.childNodes[sitemi];if(sitem.nodeName=="UL"){subLists=true;RVTree._processList(sitem,false)}}var s=document.createElement("SPAN");var t='\u00A0';s.className=RVTree.options.nodeLinkClass;if(subLists){if(!XElement.hasClassName(item,RVTree.options.nodeOpenClass))XElement.addClassName(item,RVTree.options.nodeClosedClass);if(item.firstChild.nodeName=="#text"){t=t+item.firstChild.nodeValue;item.removeChild(item.firstChild)}s.onclick=function(){XElement.toggleClassName(this.parentNode,RVTree.options.nodeOpenClass);XElement.toggleClassName(this.parentNode,RVTree.options.nodeClosedClass);return false}}else{if(XElement.hasClassName(item,RVTree.options.nodeClosedClass)){s.onclick=function(){var nodes=this.parentNode.getElementsByTagName("A");if(nodes.length)document.location=nodes[0].href}}else XElement.addClassName(item,RVTree.options.nodeBulletClass)}item.style.listStyleType='none';if(isRoot&&RVTree.options.IEVersion&&RVTree.options.IEVersion<8)item.style.marginLeft="-16px";if(s){s.appendChild(document.createTextNode(t));item.insertBefore(s,item.firstChild)}}ul.style.marginLeft=0;ul.style.paddingLeft=isRoot?0:"8px"}}
+var XElement={hasClass:function(b,e){if(!b)return false;var f=b.className;return f.length>0&&(f==e||(new RegExp("(^|\\s)"+e+"(\\s|$)")).test(f))},addClass:function(b,e){if(b){XElement.hasClass(b,e)||(b.className+=(b.className?" ":"")+e);return b}},toggleClasses:function(b,e,f){if(b){for(var a=b.className.split(/\s+/),g=-1,c=-1,d=0;d<a.length;d++){if(a[d]==e)g=d;if(a[d]==f)c=d}if(g>=0){a.splice(g,1);c>=g&&c--}else a.push(e);c>=0?a.splice(c,1):a.push(f);b.className=a.join(" ");return b}}},RVTree={options:{nodeClosedClass:"liClosed",
+nodeOpenClass:"liOpen",nodeBulletClass:"liBullet",nodeLinkClass:"bullet"},convertTree:function(b){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(b,true)}},_processList:function(b,e){if(!(!b.childNodes||b.childNodes.length==0)){for(var f=0;f<b.childNodes.length;f++){var a=b.childNodes[f];if(a.nodeName=="LI"){for(var g=false,c=0;c<a.childNodes.length;c++){var d=
+a.childNodes[c];if(d.nodeName=="UL"){g=true;RVTree._processList(d,false)}}c=document.createElement("SPAN");d="\u00a0";c.className=RVTree.options.nodeLinkClass;if(g){XElement.hasClass(a,RVTree.options.nodeOpenClass)||XElement.addClass(a,RVTree.options.nodeClosedClass);if(a.firstChild.nodeName=="#text"){d+=a.firstChild.nodeValue;a.removeChild(a.firstChild)}c.onclick=function(){XElement.toggleClasses(this.parentNode,RVTree.options.nodeOpenClass,RVTree.options.nodeClosedClass);return false}}else if(XElement.hasClass(a,
+RVTree.options.nodeClosedClass))c.onclick=function(){var h=this.parentNode.getElementsByTagName("A");if(h.length)document.location=h[0].href};else XElement.addClass(a,RVTree.options.nodeBulletClass);a.style.listStyleType="none";if(e&&RVTree.options.IEVersion&&RVTree.options.IEVersion<8)a.style.marginLeft="-16px";if(c){c.appendChild(document.createTextNode(d));a.insertBefore(c,a.firstChild)}}}b.style.marginLeft=0;b.style.paddingLeft=e?0:"8px"}}};typeof rvTreeAutoConvert!="undefined"&&RVTree.convertTree(rvTreeAutoConvert);
Index: extensions/rv_menutree/trunk/js/rvtree.js
===================================================================
--- extensions/rv_menutree/trunk/js/rvtree.js	(revision 6509)
+++ extensions/rv_menutree/trunk/js/rvtree.js	(revision 6608)
@@ -1,34 +1,41 @@
-/* this is not directly used - compress it as rvtree-min.js on http://www.compressjavascript.com/ or somewhere else
+/* this is not directly used - compress it as rvtree-min.js on http://javascriptcompressor.com/ or http://closure-compiler.appspot.com
 Based on Matt Kruse <matt@mattkruse.com> http://www.mattkruse.com/ */
 var XElement = {
-	hasClassName: function(element, className) {
+	hasClass: function(element, className) {
 		if (!element) return false;
 		var elementClassName = element.className;
-		if (elementClassName.length == 0) return false;
-		if (elementClassName == className ||
-				elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
-			return true;
-		return false;
+		return ( elementClassName.length > 0 && (elementClassName == className ||
+						new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)) );
 	},
 
-	addClassName: function(element, className) {
+	addClass: function(element, className) {
 		if (!element) return;
-		var classNames = element.className.split(/\s+/);
-		for (var i=0; i<classNames.length; i++)
-			if (className==classNames[i]) return;
-		classNames.splice(0,0,className);
-		element.className = classNames.join(' ');
+		if (!XElement.hasClass(element, className))
+				element.className += (element.className ? ' ' : '') + className;
 		return element;
 	},
 
-	toggleClassName: function(element, className) {
+	toggleClasses: function(element, class1, class2) {
 		if (!element) return;
 		var classNames = element.className.split(/\s+/);
+		var i1=-1, i2=-1;
 		for (var i=0; i<classNames.length; i++)
-			if (classNames[i]==className) break;
-		if (i==classNames.length)
-			classNames.splice(0,0,className);
+		{
+				if (classNames[i]==class1) i1=i;
+				if (classNames[i]==class2) i2=i;
+		}
+		if (i1>=0)
+		{
+				classNames.splice(i1,1);
+				if (i2>=i1)
+						i2--;
+		}
 		else
-			classNames.splice(i, 1);
+				classNames.push(class1);
+	 
+		if (i2>=0)
+				classNames.splice(i2,1);
+		else
+				classNames.push(class2);
 		element.className = classNames.join(' ');
 		return element;
@@ -48,5 +55,6 @@
 	convertTree: function (root)
 	{
-		if (!document.createElement) return; // Without createElement, we can't do anything
+		if (!document.createElement)
+			return; // Without createElement, we can't do anything
 		if (window.attachEvent && !window.opera)
 		{
@@ -59,5 +67,6 @@
 	_processList: function(ul, isRoot)
 	{
-		if (!ul.childNodes || ul.childNodes.length==0) return;
+		if (!ul.childNodes || ul.childNodes.length==0) 
+			return;
 
 		for (var i=0; i<ul.childNodes.length; i++)
@@ -85,6 +94,6 @@
 			{
 				// This LI has UL's in it, so it's a +/- node
-				if ( !XElement.hasClassName(item, RVTree.options.nodeOpenClass) )
-					XElement.addClassName(item, RVTree.options.nodeClosedClass);
+				if ( !XElement.hasClass(item, RVTree.options.nodeOpenClass) )
+					XElement.addClass(item, RVTree.options.nodeClosedClass);
 
 				// If it's just text, make the text work as the link also
@@ -96,6 +105,5 @@
 				s.onclick = function ()
 				{
-					XElement.toggleClassName( this.parentNode, RVTree.options.nodeOpenClass );
-					XElement.toggleClassName( this.parentNode, RVTree.options.nodeClosedClass );
+					XElement.toggleClasses(this.parentNode, RVTree.options.nodeOpenClass, RVTree.options.nodeClosedClass );
 					return false;
 				}
@@ -103,5 +111,5 @@
 			else
 			{// No sublists
-				if ( XElement.hasClassName(item, RVTree.options.nodeClosedClass) )
+				if ( XElement.hasClass(item, RVTree.options.nodeClosedClass) )
 				{
 					s.onclick = function()
@@ -113,5 +121,5 @@
 				}
 				else
-					XElement.addClassName(item, RVTree.options.nodeBulletClass);
+					XElement.addClass(item, RVTree.options.nodeBulletClass);
 			}
 
@@ -129,2 +137,7 @@
 	}
 }
+
+if ( typeof rvTreeAutoConvert != 'undefined')
+{
+	RVTree.convertTree( rvTreeAutoConvert );
+}
Index: extensions/rv_menutree/trunk/template/rv_menutree_categories.tpl
===================================================================
--- extensions/rv_menutree/trunk/template/rv_menutree_categories.tpl	(revision 6509)
+++ extensions/rv_menutree/trunk/template/rv_menutree_categories.tpl	(revision 6608)
@@ -1,10 +1,9 @@
-{known_script id="rvtree" src=$RVMT_PATH|@cat:"js/rvtree-min.js" }
 {html_head}
 <style type="text/css">
-ul.rvTree li .bullet {ldelim}padding-left:14px;margin-left:0;background:url({$RVMT_PATH}img/bpm.gif) no-repeat scroll;}
-ul.rvTree li.liOpen .bullet {ldelim}cursor:pointer;background-position:-38px center;}
-ul.rvTree li.liClosed .bullet {ldelim}cursor:pointer;background-position:-19px center;}
-ul.rvTree li.liBullet .bullet {ldelim}cursor:default;background-position:0 center;}
-ul.rvTree li.liClosed ul {ldelim}display:none;}
+.rvTree li .bullet {ldelim}padding-left:14px;margin-left:0;background:url({$RVMT_PATH}img/bpm.gif) no-repeat scroll;}
+.rvTree li.liOpen .bullet {ldelim}cursor:pointer;background-position:-38px center;}
+.rvTree li.liClosed .bullet {ldelim}cursor:pointer;background-position:-19px center;}
+.rvTree li.liBullet .bullet {ldelim}cursor:default;background-position:0 center;}
+.rvTree li.liClosed ul {ldelim}display:none;}
 </style>
 {/html_head}
@@ -55,5 +54,10 @@
 {'</li></ul>'|@str_repeat:$ref_level}
 <script type="text/javascript">
-  RVTree.convertTree( document.getElementById("theCategoryMenu") );
+	rvTreeAutoConvert = document.getElementById("theCategoryMenu");
+	(function () {ldelim}
+	var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = '{$RVMT_PATH|@cat:"js/rvtree-min.js"}';
+	var s0 = document.getElementsByTagName('script')[0]; s0.parentNode.insertBefore(s, s0);
+	})();
+  //RVTree.convertTree( document.getElementById("theCategoryMenu") );
 </script>
 	{if isset($block->data.U_UPLOAD)}
