PageSourceSearch

https://shop.denkmal.film/wp-content/themes/books/js/workdo/easyResponsiveTabs.js?ver=7.1.2

js denkmal.film collected 2026-10-02 22:35:16 UTC 8,720 bytes, 152 lines download raw bytes

1// Easy Responsive Tabs Plugin
2// Author: Samson.Onna <Email : [email protected]>
3(function ($) {
4    $.fn.extend({
5        easyResponsiveTabs: function (options) {
6            //Set the default values, use comma to separate the settings, example:
7            var defaults = {
8                type: 'default', //default, vertical, accordion;
9                width: 'auto',
10                fit: true,
11                closed: false,
12                activate: function(){}
13            }
14            //Variables
15            var options = $.extend(defaults, options);            
16            var opt = options, jtype = opt.type, jfit = opt.fit, jwidth = opt.width, vtabs = 'vertical', accord = 'accordion';
17            var hash = window.location.hash;
18            var historyApi = !!(window.history && history.replaceState);
19            //Events
20            $(this).on('tabactivate', function(e, currentTab) {
21                if(typeof options.activate === 'function') {
22                    options.activate.call(currentTab, e)
23                }
24            });
25            //Main function
26            this.each(function () {
27                var $respTabs = $(this);
28                var $respTabsList = $respTabs.find('ul.resp-tabs-list');
29                var respTabsId = $respTabs.attr('id');
30                $respTabs.find('ul.resp-tabs-list li').addClass('resp-tab-item');
31                $respTabs.css({
32                    'display': 'block',
33                    'width': jwidth
34                });
35                $respTabs.find('.resp-tabs-container > div').addClass('resp-tab-content');
36                jtab_options();
37                //Properties Function
38                function jtab_options() {
39                    if (jtype == vtabs) {
40                        $respTabs.addClass('resp-vtabs');
41                    }
42                    if (jfit == true) {
43                        $respTabs.css({ width: '100%', margin: '0px' });
44                    }
45                    if (jtype == accord) {
46                        $respTabs.addClass('resp-easy-accordion');
47                        $respTabs.find('.resp-tabs-list').css('display', 'none');
48                    }
49                }
50                //Assigning the h2 markup to accordion title
51                var $tabItemh2;
52                $respTabs.find('.resp-tab-content').before("<h2 class='resp-accordion' role='tab'><span class='resp-arrow'></span></h2>");
53                var itemCount = 0;
54                $respTabs.find('.resp-accordion').each(function () {
55                    $tabItemh2 = $(this);
56                    var $tabItem = $respTabs.find('.resp-tab-item:eq(' + itemCount + ')');
57                    var $accItem = $respTabs.find('.resp-accordion:eq(' + itemCount + ')');
58                    $accItem.append($tabItem.html());
59                    $accItem.data($tabItem.data());
60                    $tabItemh2.attr('aria-controls', 'tab_item-' + (itemCount));
61                    itemCount++;
62                });
63                //Assigning the 'aria-controls' to Tab items
64                var count = 0,
65                    $tabContent;
66                $respTabs.find('.resp-tab-item').each(function () {
67                    $tabItem = $(this);
68                    $tabItem.attr('aria-controls', 'tab_item-' + (count));
69                    $tabItem.attr('role', 'tab');
70                    //Assigning the 'aria-labelledby' attr to tab-content
71                    var tabcount = 0;
72                    $respTabs.find('.resp-tab-content').each(function () {
73                        $tabContent = $(this);
74                        $tabContent.attr('aria-labelledby', 'tab_item-' + (tabcount));
75                        tabcount++;
76                    });
77                    count++;
78                });
79                // Show correct content area
80                var tabNum = 0;
81                if(hash!='') {
82                    var matches = hash.match(new RegExp(respTabsId+"([0-9]+)"));
83                    if (matches!==null && matches.length===2) {
84                        tabNum = parseInt(matches[1],10)-1;
85                        if (tabNum > count) {
86                            tabNum = 0;
87                        }
88                    }
89                }
90                //Active correct tab
91                $($respTabs.find('.resp-tab-item')[tabNum]).addClass('resp-tab-active');
92                //keep closed if option = 'closed' or option is 'accordion' and the element is in accordion mode
93                if(options.closed !== true && !(options.closed === 'accordion' && !$respTabsList.is(':visible')) && !(options.closed === 'tabs' && $respTabsList.is(':visible'))) {                  
94                    $($respTabs.find('.resp-accordion')[tabNum]).addClass('resp-tab-active');
95                    $($respTabs.find('.resp-tab-content')[tabNum]).addClass('resp-tab-content-active').attr('books', 'display:block');
96                }
97                //assign proper classes for when tabs mode is activated before making a selection in accordion mode
98                else {
99                    $($respTabs.find('.resp-tab-content')[tabNum]).addClass('resp-tab-content-active resp-accordion-closed')
100                }
101                //Tab Click action function
102                $respTabs.find("[role=tab]").each(function () {
103                    var $currentTab = $(this);
104                    $currentTab.click(function () {  
105                        var $currentTab = $(this);
106                        var $tabAria = $currentTab.attr('aria-controls');
107                        if ($currentTab.hasClass('resp-accordion') && $currentTab.hasClass('resp-tab-active')) {
108                            $respTabs.find('.resp-tab-content-active').slideUp('', function () { $(this).addClass('resp-accordion-closed'); });
109                            $currentTab.removeClass('resp-tab-active');
110                            return false;
111                        }
112                        if (!$currentTab.hasClass('resp-tab-active') && $currentTab.hasClass('resp-accordion')) {
113                            $respTabs.find('.resp-tab-active').removeClass('resp-tab-active');
114                            $respTabs.find('.resp-tab-content-active').slideUp().removeClass('resp-tab-content-active resp-accordion-closed');
115                            $respTabs.find("[aria-controls=" + $tabAria + "]").addClass('resp-tab-active');
116                            $respTabs.find('.resp-tab-content[aria-labelledby = ' + $tabAria + ']').slideDown().addClass('resp-tab-content-active');
117                        } else {
118                            $respTabs.find('.resp-tab-active').removeClass('resp-tab-active');
119                            $respTabs.find('.resp-tab-content-active').removeAttr('books').removeClass('resp-tab-content-active').removeClass('resp-accordion-closed');
120                            $respTabs.find("[aria-controls=" + $tabAria + "]").addClass('resp-tab-active');
121                            $respTabs.find('.resp-tab-content[aria-labelledby = ' + $tabAria + ']').addClass('resp-tab-content-active').attr('books', 'display:block');
122                        }
123                        //Trigger tab activation event
124                        $currentTab.trigger('tabactivate', $currentTab);
125                        //Update Browser History
126                        if(historyApi) {
127                            var currentHash = window.location.hash;
128                            var newHash = respTabsId+(parseInt($tabAria.substring(9),10)+1).toString();
129                            if (currentHash!="") {
130                                var re = new RegExp(respTabsId+"[0-9]+");
131                                if (currentHash.match(re)!=null) {                                    
132                                    newHash = currentHash.replace(re,newHash);
133                                }
134                                else {
135                                    newHash = currentHash+"|"+newHash;
136                                }
137                            }
138                            else {
139                                newHash = '#'+newHash;
140                            }
141                            history.replaceState(null,null,newHash);
142                        }
143                    });
144                });
145                //Window resize function                   
146                $(window).resize(function () {
147                    $respTabs.find('.resp-accordion-closed').removeAttr('books');
148                });
149            });
150        }
151    });
152})(jQuery);

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.