6 $.fn.toolbarize = function(options) {
7 var $toolbar = $(this);
8 var $container = $('.button_group_container', $toolbar);
10 $('.button_group button', $toolbar).click(function(event){
11 event.preventDefault();
13 var params = eval("(" + $(this).attr('data-ui-action-params') + ")");
15 scriptletCenter.callInteractive({
16 action: $(this).attr('data-ui-action'),
17 context: options.actionContext,
22 $('select', $toolbar).change(function(event){
23 var slug = $(this).val();
24 $container.scrollLeft(0);
25 $('*[data-group]').hide().filter('[data-group="' + slug + '"]').show();
28 $('button.next', $toolbar).click(function() {
29 var $current_group = $('.button_group:visible', $toolbar);
30 var scroll = $container.scrollLeft();
32 var $hidden = $("li", $current_group).filter(function() {
33 return ($(this).position().left + $(this).outerWidth()) > $container.width();
36 if($hidden.length > 0) {
37 scroll = $hidden.position().left + scroll + $hidden.outerWidth() - $container.width() + 1;
38 $container.scrollLeft(scroll);
42 $('button.prev', $toolbar).click(function() {
43 var $current_group = $('.button_group:visible', $toolbar);
44 var scroll = $container.scrollLeft();
46 /* first not visible element is: */
47 var $hidden = $("li", $current_group).filter(function() {
48 return $(this).position().left < 0;
51 if( $hidden.length > 0)
53 scroll = scroll + $hidden.position().left;
54 $container.scrollLeft(scroll);