[Mapbender-commits] r6432 - trunk/mapbender/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jun 29 05:32:43 EDT 2010


Author: christoph
Date: 2010-06-29 09:32:43 +0000 (Tue, 29 Jun 2010)
New Revision: 6432

Modified:
   trunk/mapbender/lib/wizard.js
Log:


Modified: trunk/mapbender/lib/wizard.js
===================================================================
--- trunk/mapbender/lib/wizard.js	2010-06-29 09:28:22 UTC (rev 6431)
+++ trunk/mapbender/lib/wizard.js	2010-06-29 09:32:43 UTC (rev 6432)
@@ -5,120 +5,118 @@
 $.widget("mb.wizard", {
 	_create: function () {
 		var args = arguments;
-		return this.each(function () {
-			var getPath = function ($t) {
-				var m = $t.metadata({
-					type: "attr",
-					name: "data"
-				});
-				var p = [];
-				if (m && m.path) {
-					p = m.path.split("/");
-				}
-				o.onClickLink(p);			
-			};
-			
-			var navigate = function ($t) {
-				if (o.fade) {
-					$t.siblings("div").fadeOut(function () {
-						$t.fadeIn();
-					});
-				}		
-				else {
-					$t.siblings("div").hide();
-					$t.show();
-				}
-			};
-	
-			var clickHandler = function (e, $t) {
-				getPath($t);
-				navigate($t);
-				if (e) {
-					e.preventDefault();
-				}
-			};
+		var getPath = function ($t) {
+			var m = $t.metadata({
+				type: "attr",
+				name: "data"
+			});
+			var p = [];
+			if (m && m.path) {
+				p = m.path.split("/");
+			}
+			o.onClickLink(p);			
+		};
 		
-			var to = function () {
-				if (arguments.length === 2) {
-					var $target = arguments[1];
-					var href = "#" + $target.attr("id");
-					var me = null;
-					var e = null;
-				}
-				else {
-					var href = $(this).attr("href");
-					var $target = $(href);
-					var me = this;
-					var e = arguments[0];
-				}
-				var found = false;
-				var abort = false;
-				$target.parents().each(function () {
-					if (abort || found) {
-						return;
-					}
-					var $currentElement = $(this);
-					// not this target's wizard
-					if ($(this).data("isWizard") && this !== wizardInstance) {
-						abort = true;
-						return;
-					}				
-					// this target's wizard
-					if ($(this).data("isWizard") && this === wizardInstance) {
-						found = true;
-						return;
-					}				
+		var navigate = function ($t) {
+			if (o.fade) {
+				$t.siblings("div").fadeOut(function () {
+					$t.fadeIn();
 				});
-				if (abort || !found) {
-					new Mapbender.Warning("not this target's wizard, or not found, aborting");
-					return;
-				}
+			}		
+			else {
+				$t.siblings("div").hide();
+				$t.show();
+			}
+		};
+
+		var clickHandler = function (e, $t) {
+			getPath($t);
+			navigate($t);
+			if (e) {
+				e.preventDefault();
+			}
+		};
 	
-				var proceed = me === null ? true : o.onBeforeClickLink(e, $(me));
-				if (proceed === false) {
-					new Mapbender.Warning("Clicked link " + href + " in wizard " + wizardInstance.id + " aborted!");
+		var to = function () {
+			if (arguments.length === 2) {
+				var $target = arguments[1];
+				var href = "#" + $target.attr("id");
+				var me = null;
+				var e = null;
+			}
+			else {
+				var href = $(this).attr("href");
+				var $target = $(href);
+				var me = this;
+				var e = arguments[0];
+			}
+			var found = false;
+			var abort = false;
+			$target.parents().each(function () {
+				if (abort || found) {
 					return;
 				}
-				
-				new Mapbender.Warning("Clicked link " + href + " in wizard " + wizardInstance.id);
-				clickHandler(e, $target);
-			};
-	
-			if (typeof options === "string") {
-				if (!$(this).data("isWizard")) {
+				var $currentElement = $(this);
+				// not this target's wizard
+				if ($(this).data("isWizard") && this !== wizardInstance) {
+					abort = true;
 					return;
-				}
-				var wizardInstance = this;
-				var o = $(this).data("wizardOptions");
-				if (options === "to" && args.length === 2) {
-					return to(null, args[1]);
-				}
+				}				
+				// this target's wizard
+				if ($(this).data("isWizard") && this === wizardInstance) {
+					found = true;
+					return;
+				}				
+			});
+			if (abort || !found) {
+				new Mapbender.Warning("not this target's wizard, or not found, aborting");
 				return;
 			}
-	
-			var wizardInstance = this;
-			var $wiz = $(wizardInstance);
-			$wiz.data("isWizard", true);
-	
-			var o = $.extend({
-				fade: false,
-				onClickLink: function () {
-					return true;
-				},
-				onBeforeClickLink: function () {
-					return true;
-				}
-			}, options || {});
-			$wiz.data("wizardOptions", o);
-	
+
+			var proceed = me === null ? true : o.onBeforeClickLink(e, $(me));
+			if (proceed === false) {
+				new Mapbender.Warning("Clicked link " + href + " in wizard " + wizardInstance.id + " aborted!");
+				return;
+			}
 			
-			if (o.startWith) {
-				getPath(o.startWith);
+			new Mapbender.Warning("Clicked link " + href + " in wizard " + wizardInstance.id);
+			clickHandler(e, $target);
+		};
+
+		if (typeof options === "string") {
+			if (!$(this).data("isWizard")) {
+				return;
 			}
-	
-			$("a.wizard").live("click", function (e) {
-				to.apply($(this), [e]);
-			});
-		});		
+			var wizardInstance = this;
+			var o = $(this).data("wizardOptions");
+			if (options === "to" && args.length === 2) {
+				return to(null, args[1]);
+			}
+			return;
+		}
+
+		var wizardInstance = this;
+		var $wiz = $(wizardInstance);
+		$wiz.data("isWizard", true);
+
+		var o = $.extend({
+			fade: false,
+			onClickLink: function () {
+				return true;
+			},
+			onBeforeClickLink: function () {
+				return true;
+			}
+		}, options || {});
+		$wiz.data("wizardOptions", o);
+
+		
+		if (o.startWith) {
+			getPath(o.startWith);
+		}
+
+		$("a.wizard").live("click", function (e) {
+			to.apply($(this), [e]);
+		});
 	}
 });



More information about the Mapbender_commits mailing list