[Mapbender-commits] r5363 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jan 20 05:16:14 EST 2010


Author: christoph
Date: 2010-01-20 05:16:14 -0500 (Wed, 20 Jan 2010)
New Revision: 5363

Modified:
   trunk/mapbender/http/javascripts/mod_copyright.php
   trunk/mapbender/http/javascripts/mod_dependentDiv.php
   trunk/mapbender/http/javascripts/mod_featureInfo.php
Log:
refactoring: better solution for setting defaults if element vars are not set

Modified: trunk/mapbender/http/javascripts/mod_copyright.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_copyright.php	2010-01-20 10:14:45 UTC (rev 5362)
+++ trunk/mapbender/http/javascripts/mod_copyright.php	2010-01-20 10:16:14 UTC (rev 5363)
@@ -19,12 +19,8 @@
 ?>
 var mod_copyright_target = options.target;
 
-try{
-	if (options.mod_copyright_text){}
-}
-catch(e){
-	options.mod_copyright_text = "mapbender.org";
-}
+options.mod_copyright_text = typeof options.mod_copyright_text === "undefined" ? "mapbender.org" : options.mod_copyright_text;
+
 var mod_copyright_text = options.mod_copyright_text;
 
 var mod_copyright_left = 5;

Modified: trunk/mapbender/http/javascripts/mod_dependentDiv.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_dependentDiv.php	2010-01-20 10:14:45 UTC (rev 5362)
+++ trunk/mapbender/http/javascripts/mod_dependentDiv.php	2010-01-20 10:16:14 UTC (rev 5363)
@@ -22,22 +22,9 @@
 
 echo "var mod_dependentDiv_target = '".$e_target[0]."';";
 ?>
+var dependentDiv_offsetLeft = typeof dependentDiv_offsetLeft === "undefined" ? 1 : dependentDiv_offsetLeft;
+var dependentDiv_offsetTop = typeof dependentDiv_offsetTop === "undefined" ? 10 : dependentDiv_offsetTop;
 
-try{
-	if (dependentDiv_offsetLeft){}
-}
-catch(e){
-	dependentDiv_offsetLeft = 1;
-}
-
-try{
-	if (dependentDiv_offsetTop){}
-}
-catch(e){
-	dependentDiv_offsetTop = 10;
-}
-
-
 eventAfterMapRequest.register(function () {
 	mod_dependentDiv();
 });

Modified: trunk/mapbender/http/javascripts/mod_featureInfo.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_featureInfo.php	2010-01-20 10:14:45 UTC (rev 5362)
+++ trunk/mapbender/http/javascripts/mod_featureInfo.php	2010-01-20 10:16:14 UTC (rev 5363)
@@ -21,13 +21,7 @@
 include '../include/dyn_js.php';
 //defaults for element vars
 ?>
-try {
-	if (ignoreWms) {
-	}
-}
-catch (e) {
-	ignoreWms = [];
-}
+var ignoreWms = typeof ignoreWms === "undefined" ? [] : ignoreWms;
 
 if(typeof(featureInfoLayerPopup)==='undefined')
 	var featureInfoLayerPopup = 'false';



More information about the Mapbender_commits mailing list