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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Jun 18 06:57:37 EDT 2010


Author: christoph
Date: 2010-06-18 10:57:37 +0000 (Fri, 18 Jun 2010)
New Revision: 6341

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


Modified: trunk/mapbender/lib/wizard.js
===================================================================
--- trunk/mapbender/lib/wizard.js	2010-06-18 10:27:38 UTC (rev 6340)
+++ trunk/mapbender/lib/wizard.js	2010-06-18 10:57:37 UTC (rev 6341)
@@ -3,28 +3,39 @@
  * Link between various interfaces, imagine a wizard
  */
 $.fn.wizard = function (options) {
-	var o = $.extend({
-		fade: false
-	}, options || {});
-	
-	var clickHandler = function (e, $t) {
-		$t.siblings("div").hide();
-		$t.show();
-		e.preventDefault();
-	};
+	return this.each(function () {
 
-	if (o.fade) {
-		clickHandler = function (e, $t) {
-			$t.siblings("div:visible").fadeOut(function () {
-				$t.fadeIn();
-			});
+		var wizardInstance = this;
+		$(wizardInstance).data("isWizard", true);
+
+		var history = [
+			wizardInstance.title
+		];
+
+		var o = $.extend({
+			fade: false,
+			onSelect: function (targetTitle) {
+				history.push(targetTitle);
+				console.log(history);
+			}
+		}, options || {});
+		
+		var clickHandler = function (e, $t) {
+			$t.siblings("div").hide();
+			$t.show();
 			e.preventDefault();
 		};
-	}
+	
+		if (o.fade) {
+			clickHandler = function (e, $t) {
+				$t.siblings("div:visible").fadeOut(function () {
+					$t.fadeIn();
+				});
+				o.onSelect($t.attr("title"));
+				e.preventDefault();
+			};
+		}
 
-	return this.each(function () {
-		var wizardInstance = this;
-		$(wizardInstance).data("isWizard", true);
 		$("a.wizard").live("click", function (e) {
 			var href = $(this).attr("href");
 			var $target = $(href);



More information about the Mapbender_commits mailing list