2009-11-21 03:22:39 +01:00
|
|
|
(function($){
|
2009-11-21 03:22:33 +01:00
|
|
|
/**
|
2009-11-21 03:22:39 +01:00
|
|
|
* Lightweight wrapper around jQuery UI tabs.
|
|
|
|
* Ensures that anchor links are set properly,
|
|
|
|
* and any nested tabs are scrolled if they have
|
|
|
|
* their height explicitly set. This is important
|
|
|
|
* for forms inside the CMS layout.
|
2009-11-21 03:22:33 +01:00
|
|
|
*/
|
2009-11-21 03:22:39 +01:00
|
|
|
$('.ss-tabset').concrete({
|
|
|
|
onmatch: function() {
|
|
|
|
this.rewriteHashlinks();
|
|
|
|
|
|
|
|
// Initialize jQuery UI tabs
|
|
|
|
this.tabs();
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Replace prefixes for all hashlinks in tabs.
|
|
|
|
* SSViewer rewrites them from "#Root_MyTab" to
|
|
|
|
* e.g. "/admin/#Root_MyTab" which makes them
|
|
|
|
* unusable for jQuery UI.
|
|
|
|
*/
|
|
|
|
rewriteHashlinks: function() {
|
|
|
|
$(this).find('ul a').each(function() {
|
|
|
|
var href = $(this).attr('href').replace(/.*(#.*)/, '$1');
|
|
|
|
if(href) $(this).attr('href', href);
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If tab has no nested tabs, set overflow to auto
|
|
|
|
*/
|
|
|
|
setOverflows: function() {
|
|
|
|
$(this).find('.tab').not(':has(.tab)').css('overflow', 'auto');
|
|
|
|
}
|
|
|
|
});
|
2009-11-21 03:22:43 +01:00
|
|
|
})(jQuery);
|