]> wagnertech.de Git - mfinanz.git/blobdiff - js/kivi.js
js: tab-widget cookie ignorieren wenn url hash vorhanden
[mfinanz.git] / js / kivi.js
index 43e3718c2499e2ae9e7f601657128cb3e4fc8946..f194b810766e6ac803f465e824f241fe513aab2d 100644 (file)
@@ -37,7 +37,7 @@ namespace("kivi", function(ns) {
     if (date === '')
       return null;
 
-    if (date === '0')
+    if (date === '0' || date === '00')
       return new Date();
 
     var parts = date.replace(/\s+/g, "").split(ns._date_format.sep);
@@ -75,14 +75,14 @@ namespace("kivi", function(ns) {
       }
       date = new Date(
         year,
-        (parts[ ns._date_format.m ] || 0) * 1 - 1, // Months are 0-based.
-        (parts[ ns._date_format.d ] || 0) * 1
+        (parts[ ns._date_format.m ] || (today.getMonth() + 1)) * 1 - 1, // Months are 0-based.
+        (parts[ ns._date_format.d ] || today.getDate()) * 1
       );
     } else if (parts.length == 2) {
       date = new Date(
         (new Date()).getFullYear(),
-        (parts[ (ns._date_format.m > ns._date_format.d) * 1 ] || 0) * 1 - 1, // Months are 0-based.
-        (parts[ (ns._date_format.d > ns._date_format.m) * 1 ] || 0) * 1
+        (parts[ (ns._date_format.m > ns._date_format.d) * 1 ] || (today.getMonth() + 1)) * 1 - 1, // Months are 0-based.
+        (parts[ (ns._date_format.d > ns._date_format.m) * 1 ] || today.getDate()) * 1
       );
     } else
       return undefined;
@@ -252,7 +252,10 @@ namespace("kivi", function(ns) {
 
     if (elementId) {
       var cookieName      = 'jquery_ui_tab_'+ elementId;
-      tabsParams.active   = $.cookie(cookieName);
+      if (!window.location.hash) {
+        // only activate if there's no hash to overwrite it
+        tabsParams.active   = $.cookie(cookieName);
+      }
       tabsParams.activate = function(event, ui) {
         var i = ui.newTab.parent().children().index(ui.newTab);
         $.cookie(cookieName, i);