[Mapbender-commits] r2100 - branches/2.5/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Feb 19 08:47:59 EST 2008


Author: christoph
Date: 2008-02-19 08:47:59 -0500 (Tue, 19 Feb 2008)
New Revision: 2100

Modified:
   branches/2.5/http/javascripts/mod_tab.js
Log:
jslinted

Modified: branches/2.5/http/javascripts/mod_tab.js
===================================================================
--- branches/2.5/http/javascripts/mod_tab.js	2008-02-19 13:43:38 UTC (rev 2099)
+++ branches/2.5/http/javascripts/mod_tab.js	2008-02-19 13:47:59 UTC (rev 2100)
@@ -9,7 +9,7 @@
 	}
 }
 catch(e){
-	var e = new Mb_warning("mod_tab.js: tab_init: open_tab is not set.");
+	var z = new Mb_warning("mod_tab.js: tab_init: open_tab is not set.");
 	open_tab = "";
 }
 
@@ -82,12 +82,13 @@
 		if (top.ie) {
 		
 		   node.onclick = function() {
-		      var x = new Function ("", "tabs.toggleTab('"+that.module+"');"); 
-		      x(); 
+		      tabs.toggleTab(that.module);
 		   };
 		}
 		else {
-			node.setAttribute("onclick", "tabs.toggleTab('"+that.module+"');");
+			node.onclick = function(){
+				tabs.toggleTab(that.module);
+			};
 		}
 		
 		// tab header
@@ -175,7 +176,7 @@
 				var currentNode = this.get(i).getNode();
 				
 				// parseInt removes "px"
-				var currentTop = parseInt(currentNode.style.top);
+				var currentTop = parseInt(currentNode.style.top, 10);
 				currentNode.style.top = currentTop - tabHeight;
 			}			
 		}
@@ -190,7 +191,7 @@
 		// if no tab is currently opening or closing
 		if (isAnimationFinished()) {
 			for (var i=0; i < this.count(); i++) {
-				hideFrame(this.get(i).module)
+				hideFrame(this.get(i).module);
 			}
 			// if the opened tab is the active tab, close it
 			if (id === activeTabId) {
@@ -218,8 +219,9 @@
 	 this.getCoords = function(id) {
 	 	var coords=[];
 	 	//get indixes
-	 	if(activeTabId)
-	 		var indexOfOpeningTab = getIndexById(activeTabId);
+	 	if (activeTabId) {
+			var indexOfOpeningTab = getIndexById(activeTabId);
+		}
 		var index = getIndexById(id);
 	 	
 	 	//left
@@ -232,7 +234,7 @@
 	 	coords[3] = coords[1] + (id==activeTabId?this.get(indexOfOpeningTab).height+tabHeight:tabHeight);
 	 	
 	 	return coords.join(",");
-	 }
+	 };
 
 	/**
 	 * Animated opening and closing of the tab with the given id.
@@ -259,7 +261,7 @@
 				}	
 				//The current 'top' position of the i-th tab
 				//(parseInt removes 'px')
-				var currentTabCurrentTop = parseInt(this.get(i).getNode().style.top);
+				var currentTabCurrentTop = parseInt(this.get(i).getNode().style.top, 10);
 				
 				// animation is finished
 				if (currentTabCurrentTop == currentTabNewTop) {
@@ -330,7 +332,7 @@
   		// if no tab is currently opening or closing
   		if (isAnimationFinished()) {
   			for (var i=0; i < this.count(); i++) {
-  				hideFrame(this.get(i).module)
+  				hideFrame(this.get(i).module);
   			}
   		}
       activeTabId = id;
@@ -362,11 +364,11 @@
 		var index = getIndexById(id);
 		if (index !== null) {
 			var obj = document.getElementById(id).style;
-			var newpos = ((index+1) * tabHeight) + parseInt(tabTopOffset);
+			var newpos = ((index+1) * tabHeight) + parseInt(tabTopOffset, 10);
 			obj.top = (newpos + 1) + "px";
 			obj.left = (tabLeftOffset) + "px";
 			obj.width = tabWidth;
-			obj.height = (parseInt(that.get(index).height) - 2);
+			obj.height = (parseInt(that.get(index).height, 10) - 2);
 			obj.visibility = 'visible';
 		}
 	};
@@ -432,10 +434,10 @@
 	var tabInterval;
 
 
-	var tabTopOffset = parseInt(rootNode.style.top);
-	var tabLeftOffset = parseInt(rootNode.style.left);
-	var tabWidth = parseInt(rootNode.style.width);
-	var tabHeight = parseInt(rootNode.style.height);
+	var tabTopOffset = parseInt(rootNode.style.top, 10);
+	var tabLeftOffset = parseInt(rootNode.style.left, 10);
+	var tabWidth = parseInt(rootNode.style.width, 10);
+	var tabHeight = parseInt(rootNode.style.height, 10);
 	var tabStyle = cssString;
 
 	



More information about the Mapbender_commits mailing list