2009-11-21 03:22:52 +01:00
|
|
|
(function($){
|
2010-04-13 07:45:29 +02:00
|
|
|
$.entwine('ss', function($){
|
2009-11-21 03:33:06 +01:00
|
|
|
/**
|
|
|
|
* Lightweight wrapper around jQuery UI tabs.
|
|
|
|
*/
|
2010-04-13 07:45:29 +02:00
|
|
|
$('.ss-tabset').entwine({
|
2012-06-12 12:48:08 +02:00
|
|
|
onadd: function() {
|
2011-07-21 18:39:26 +02:00
|
|
|
// Can't name redraw() as it clashes with other CMS entwine classes
|
|
|
|
this.redrawTabs();
|
2011-07-15 10:37:46 +02:00
|
|
|
this._super();
|
|
|
|
},
|
2012-06-12 12:48:08 +02:00
|
|
|
onremove: function() {
|
|
|
|
this.tabs('destroy');
|
2012-05-11 07:36:18 +02:00
|
|
|
this._super();
|
|
|
|
},
|
2011-07-21 18:39:26 +02:00
|
|
|
redrawTabs: function() {
|
2009-11-21 03:32:38 +01:00
|
|
|
this.rewriteHashlinks();
|
2012-04-17 17:40:37 +02:00
|
|
|
this.tabs();
|
2009-11-21 03:32:38 +01:00
|
|
|
},
|
2009-11-21 03:33:06 +01:00
|
|
|
|
2009-11-21 03:32:38 +01:00
|
|
|
/**
|
|
|
|
* 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() {
|
2012-05-23 05:53:46 +02:00
|
|
|
var href = $(this).attr('href');
|
|
|
|
if(href) $(this).attr('href', href.replace(/.*(#.*)/, '$1'));
|
2009-11-21 03:32:38 +01:00
|
|
|
});
|
|
|
|
}
|
2009-11-21 03:33:06 +01:00
|
|
|
});
|
2009-11-21 03:22:52 +01:00
|
|
|
});
|
2012-05-11 07:36:18 +02:00
|
|
|
})(jQuery);
|