TabMenus now properly revert if hash is empty
authorAlexander Ebert <ebert@woltlab.com>
Tue, 31 Jan 2012 17:00:07 +0000 (18:00 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 31 Jan 2012 17:00:07 +0000 (18:00 +0100)
Fixes #397

wcfsetup/install/files/js/WCF.js

index bc3364feda1de91749781de3cb52f1e59e78bafd..8149c828aa746e5b9a11881264e8e8737c91dd02 100644 (file)
@@ -2223,6 +2223,12 @@ WCF.TabMenu = {
                                }
                        }
                }
+               else {
+                       // revert to default values
+                       for (var $containerID in this._containers) {
+                               this._containers[$containerID].wcfTabs('revertToDefault');
+                       }
+               }
        }
 };
 
@@ -4388,6 +4394,16 @@ $.widget('ui.wcfTabs', $.ui.tabs, {
                });
                
                return $matches;
+       },
+       
+       /**
+        * Shows default tab.
+        */
+       revertToDefault: function() {
+               var $active = this.element.data('active');
+               if (!$active || $active === '') $active = 0;
+               
+               this.select($active);
        }
 });