PageSourceSearch

https://www.nomos-leattualitaneldiritto.it/wp-content/plugins/synv…/script/jquery.scrolltab.js?ver=1.0

js nomos-leattualitaneldiritto.it collected 2026-10-02 07:00:00 UTC 6,020 bytes, 160 lines download raw bytes

1/*!
2 * jQuery UI Tab Scroll Plugin V 1.0
3 * http://riteshsblog.blogspot.com/
4 *
5 * Copyright 2011, Ritesh Jha
6 * Code Licensed Apache License 2.0
7 * Date: Thu Sep 1 2011
8 */
9
10(function($){  
11    $.fn.scrolltab = function(options) {  
12         
13        var settings = {
14            ulid: 'tabUl',
15            leftId:'left',
16            rightId:'right',
17            visibleTab:0, 
18            totalTab:0
19        };  
20         
21        return this.each(function(){
22            var options = $.extend(settings, options); 
23            options.tabWidth = 0;
24            options.maxLeft = 0;
25            options.totalTab = 0;
26            
27            $tabs = $(this),
28            $tabUL = $('#'+options.ulid);
29            $left = $('#'+options.leftId);
30            $right = $('#'+options.rightId);
31            
32            $tabUL.css('width',$tabs.width());
33            
34            /*tab slider*/
35            $left.click(function() {
36                if($tabUL.position().left > (options.maxLeft)){
37                    $left.hide();
38                    $tabUL.animate({
39                        left: '-='+options.tabWidth
40                        },300, function(){
41                        $tabs.trigger('showArrow'); 
42                    });
43                }
44            });
45                    
46            $right.click(function() {
47                if($tabUL.position().left < 0){
48                    $right.hide();
49                    $tabUL.animate({
50                        left: '+='+options.tabWidth
51                        } ,300, function(){
52                        $tabs.trigger('showArrow'); 
53                    });
54                }
55            });
56            
57            //if tab closed
58            $tabs.find("span.ui-icon-close" ).live( "click", function() {
59                var index = $( "li", $tabs ).index( $( this ).parent() );
60                $tabs.tabs( "remove", index );
61                //update totalTab
62                options.totalTab = $('li', $tabUL).length;
63                
64                $tabs.trigger('tabMaxLeft');
65                
66                if($tabUL.position().left < 0){
67                    $tabUL.css('width', ($tabUL.width() - options.tabWidth) + 'px');
68                    $right.trigger('click');
69                }else if($tabUL.position().left > (options.maxLeft)){
70                    $tabUL.css('width', ($tabUL.width() - options.tabWidth) + 'px');
71                    $left.trigger('click');
72                }
73                
74                if(options.totalTab <= 0){
75                    $tabs.css('visibility','hidden');
76                }
77            });
78            
79            //bind event
80            $tabs.bind('addTab',function(event,id,title){
81                var tabid = '#tabs-'+id;
82                $tabs.tabs('add', tabid, title);
83                //increase totalTab
84                options.totalTab = $('li', $tabUL).length;
85                //add width in ul
86                if(options.visibleTab == 0){ //calculate number of visible tab
87                    options.tabWidth = $("li", $tabUL).outerWidth(true);
88                    options.visibleTab = Math.floor($tabs.width()/options.tabWidth);
89                }
90
91                //add width in tab ul
92                if(options.totalTab > options.visibleTab){
93                    var cuiwidth = $tabUL.width();
94                    $tabUL.css('width', (cuiwidth + options.tabWidth) + 'px');
95                    $tabs.trigger('tabMaxLeft');
96                    $tabs.trigger('selectTab',[options.totalTab - 1 ]);
97                }else{
98                    $tabs.tabs('select', (options.totalTab - 1));
99                }
100            });
101            
102            $tabs.bind('tabMaxLeft', function(){
103                var extraTabs = options.totalTab - options.visibleTab;
104                options.maxLeft = -(extraTabs * options.tabWidth);
105            });
106            
107            $tabs.bind('selectTab', function(event, index){
108                $tabs.tabs('select', index);
109                index++;
110                var currentleftPos = $tabUL.position().left;
111                var tabHiddenLeft = Math.round(Math.abs(currentleftPos)/options.tabWidth);
112                if(tabHiddenLeft >= index){
113                    var rigtAnimate = (tabHiddenLeft - index +1 ) * options.tabWidth;
114                    $tabUL.animate({
115                        left: '+='+rigtAnimate
116                        },300, function() {
117                        $tabs.trigger('showArrow'); 
118                    });
119                }else{
120                    var tabonleft = tabHiddenLeft + options.visibleTab;
121                    var tabHiddenRight = options.totalTab - tabHiddenLeft - options.visibleTab;
122
123                    if(tabHiddenRight > 0 && index > tabonleft){
124                        var rightIndex = (index - tabonleft);
125                        var leftAnimate = rightIndex * options.tabWidth;
126                        $tabUL.animate({
127                            left: '-='+leftAnimate
128                            },300, function(){
129                            $tabs.trigger('showArrow'); 
130                        });
131                        
132                    }
133                }
134                       
135            });
136            
137            $tabs.bind('showArrow', function(){
138                var currentleftPos = $tabUL.position().left;
139                var tabHiddenLeft = Math.round(Math.abs(currentleftPos)/options.tabWidth);
140                var tabonleft = tabHiddenLeft + options.visibleTab;
141                var tabHiddenRight = options.totalTab - tabHiddenLeft - options.visibleTab;
142                
143                if(tabHiddenLeft > 0){
144                    $right.show();
145                }else{
146                    $right.hide();
147                }
148                
149                if(tabHiddenRight > 0){
150                    $left.show();
151                }else{
152                    $left.hide();
153                }
154            });
155            
156        });// return part
157    };  //function body end
158})(jQuery);  
159
160

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.