|
@@ -117,31 +117,38 @@ class ajax_page extends WebPage
|
|
<<<EOF
|
|
<<<EOF
|
|
// The "tab widgets" to handle.
|
|
// The "tab widgets" to handle.
|
|
var tabs = $('div[id^=tabbedContent]');
|
|
var tabs = $('div[id^=tabbedContent]');
|
|
-
|
|
|
|
- // This selector will be reused when selecting actual tab widget A elements.
|
|
|
|
- var tab_a_selector = 'ul.ui-tabs-nav a';
|
|
|
|
-
|
|
|
|
- // Enable tabs on all tab widgets. The `event` property must be overridden so
|
|
|
|
- // that the tabs aren't changed on click, and any custom event name can be
|
|
|
|
- // specified. Note that if you define a callback for the 'select' event, it
|
|
|
|
- // will be executed for the selected tab whenever the hash changes.
|
|
|
|
- tabs.tabs({ event: 'change' });
|
|
|
|
-
|
|
|
|
- // Define our own click handler for the tabs, overriding the default.
|
|
|
|
- tabs.find( tab_a_selector ).click(function()
|
|
|
|
|
|
+
|
|
|
|
+ if ($.bbq)
|
|
{
|
|
{
|
|
- var state = {};
|
|
|
|
-
|
|
|
|
- // Get the id of this tab widget.
|
|
|
|
- var id = $(this).closest( 'div[id^=tabbedContent]' ).attr( 'id' );
|
|
|
|
|
|
+ // This selector will be reused when selecting actual tab widget A elements.
|
|
|
|
+ var tab_a_selector = 'ul.ui-tabs-nav a';
|
|
|
|
+
|
|
|
|
+ // Enable tabs on all tab widgets. The `event` property must be overridden so
|
|
|
|
+ // that the tabs aren't changed on click, and any custom event name can be
|
|
|
|
+ // specified. Note that if you define a callback for the 'select' event, it
|
|
|
|
+ // will be executed for the selected tab whenever the hash changes.
|
|
|
|
+ tabs.tabs({ event: 'change' });
|
|
|
|
|
|
- // Get the index of this tab.
|
|
|
|
- var idx = $(this).parent().prevAll().length;
|
|
|
|
-
|
|
|
|
- // Set the state!
|
|
|
|
- state[ id ] = idx;
|
|
|
|
- $.bbq.pushState( state );
|
|
|
|
- });
|
|
|
|
|
|
+ // Define our own click handler for the tabs, overriding the default.
|
|
|
|
+ tabs.find( tab_a_selector ).click(function()
|
|
|
|
+ {
|
|
|
|
+ var state = {};
|
|
|
|
+
|
|
|
|
+ // Get the id of this tab widget.
|
|
|
|
+ var id = $(this).closest( 'div[id^=tabbedContent]' ).attr( 'id' );
|
|
|
|
+
|
|
|
|
+ // Get the index of this tab.
|
|
|
|
+ var idx = $(this).parent().prevAll().length;
|
|
|
|
+
|
|
|
|
+ // Set the state!
|
|
|
|
+ state[ id ] = idx;
|
|
|
|
+ $.bbq.pushState( state );
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ tabs.tabs();
|
|
|
|
+ }
|
|
EOF
|
|
EOF
|
|
);
|
|
);
|
|
}
|
|
}
|