Skip to content

Commit

Permalink
MINOR Formatting in TabSet.js
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92554 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information
chillu committed Nov 21, 2009
1 parent f418cdd commit 1afe18a
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions javascript/TabSet.js
Expand Up @@ -6,27 +6,29 @@
* their height explicitly set. This is important
* for forms inside the CMS layout.
*/
$('.ss-tabset').concrete({
onmatch: function() {
this.rewriteHashlinks();
$('.ss-tabset').concrete('ss', function($){
return {
onmatch: function() {
this.rewriteHashlinks();

// Initialize jQuery UI tabs
this.tabs({
cookie: $.cookie ? { expires: 30, path: '/', name: 'ui-tabs-' + this.attr('id') } : false
});
},
// Initialize jQuery UI tabs
this.tabs({
cookie: $.cookie ? { expires: 30, path: '/', name: 'ui-tabs-' + this.attr('id') } : false
});
},

/**
* 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);
});
}
/**
* 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);
});
}
};
});
})(jQuery);

0 comments on commit 1afe18a

Please sign in to comment.