PageSourceSearch

https://www.gerstungen.de/res/vendor/bootstrap/plugin/js/responsive-tabs.js?v=v5.52.00

js gerstungen.de collected 2026-10-03 17:46:26 UTC 7,284 bytes, 206 lines download raw bytes

1// heavily modified BS4 version of https://github.com/openam/bootstrap-responsive-tabs
2var fakewaffle = ( function ( $, fakewaffle ) {
3    'use strict';
4
5    fakewaffle.responsiveTabs = function ( collapseDisplayed ) {
6
7        fakewaffle.currentPosition = 'tabs';
8
9        var tabGroups = $( '.nav-tabs.responsive' );
10        var hidden    = '';
11        var visible   = '';
12        var activeTab = '';
13
14// 		if ( collapseDisplayed === undefined ) {
15// 			collapseDisplayed = [ 'xs', 'sm' ];
16// 		}
17
18// 		$.each( collapseDisplayed, function () {
19// 			hidden  += ' banana-' + this;
20// 			visible += ' visible-' + this;
21// 		} );
22
23        hidden = ' d-none d-sm-flex';
24        visible = ' d-sm-none';
25
26        $.each( tabGroups, function ( index ) {
27            var collapseDiv;
28            var $tabGroup = $( this );
29            var tabs      = $tabGroup.find( 'li a' );
30
31            if ( $tabGroup.attr( 'id' ) === undefined ) {
32                $tabGroup.attr( 'id', 'tabs-' + index );
33            }
34
35            collapseDiv = $( '<div></div>', {
36                'class' : 'card-soup responsive' + visible,
37                'id'    : 'collapse-' + $tabGroup.attr( 'id' )
38            } );
39
40            $.each( tabs, function () {
41                var $this          = $( this );
42                var oldLinkClass   = $this.attr( 'class' ) === undefined ? '' : $this.attr( 'class' );
43                var newLinkClass   = 'accordion-toggle';
44                var oldParentClass = $this.parent().attr( 'class' ) === undefined ? '' : $this.parent().attr( 'class' );
45                var newParentClass = 'card';
46                var newHash        = $this.get( 0 ).hash.replace( '#', 'collapse-' );
47
48                if ( oldLinkClass.length > 0 ) {
49                    newLinkClass += ' ' + oldLinkClass;
50                }
51
52                if ( oldParentClass.length > 0 ) {
53                    oldParentClass = oldParentClass.replace( /\bactive\b/g, '' );
54                    newParentClass += ' ' + oldParentClass;
55                    newParentClass = newParentClass.replace( /\s{2,}/g, ' ' );
56                    newParentClass = newParentClass.replace( /^\s+|\s+$/g, '' );
57                }
58
59                if ( $this.parent().hasClass( 'active' ) ) {
60                    activeTab = '#' + newHash;
61                }
62
63                collapseDiv.append(
64                    $( '<div>' ).attr( 'class', newParentClass ).html(
65                        $( '<div>' ).attr( 'class', 'card-header' ).html(
66                            $( '<h5>' ).attr( 'class', 'm-0 p-0' ).html(
67                                $( '<a>', {
68                                    'class'       : newLinkClass,
69                                    'data-toggle' : 'collapse',
70                                    'data-parent' : '#collapse-' + $tabGroup.attr( 'id' ),
71                                    'href'        : '#' + newHash,
72                                    'html'        : $this.html()
73                                } )
74                            )
75                        )
76                    ).append(
77                        $( '<div>', {
78                            'id'    : newHash,
79                            'class' : 'collapse'
80                        } )
81                    )
82                );
83            } );
84
85            $tabGroup.next().after( collapseDiv );
86            $tabGroup.addClass( hidden );
87            $( '.tab-content.responsive' ).addClass( hidden );
88
89            if ( activeTab ) {
90                $( activeTab ).collapse( 'show' );
91            }
92        } );
93
94        fakewaffle.checkResize();
95        fakewaffle.bindTabToCollapse();
96    };
97
98    fakewaffle.checkResize = function () {
99
100        if ( $( '.card-soup.responsive' ).is( ':visible' ) === true && fakewaffle.currentPosition === 'tabs' ) {
101            fakewaffle.tabToPanel();
102            fakewaffle.currentPosition = 'panel';
103        } else if ( $( '.card-soup.responsive' ).is( ':visible' ) === false && fakewaffle.currentPosition === 'panel' ) {
104            fakewaffle.panelToTab();
105            fakewaffle.currentPosition = 'tabs';
106        }
107
108    };
109
110    fakewaffle.tabToPanel = function () {
111
112        var tabGroups = $( '.nav-tabs.responsive' );
113
114        $.each( tabGroups, function ( index, tabGroup ) {
115
116            // Find the tab
117            var tabContents = $( tabGroup ).next( '.tab-content' ).find( '.tab-pane' );
118
119            $.each( tabContents, function ( index, tabContent ) {
120                // Find the id to move the element to
121                var destinationId = $( tabContent ).attr( 'id' ).replace ( /^/, '#collapse-' );
122
123                // Convert tab to panel and move to destination
124                $( tabContent )
125                    .removeClass( 'tab-pane' )
126                    .addClass( 'card-body fw-previous-tab-pane' )
127                    .appendTo( $( destinationId ) );
128
129            } );
130
131        } );
132
133    };
134
135    fakewaffle.panelToTab = function () {
136
137        var panelGroups = $( '.card-soup.responsive' );
138
139        $.each( panelGroups, function ( index, panelGroup ) {
140
141            var destinationId = $( panelGroup ).attr( 'id' ).replace( 'collapse-', '#' );
142            var destination   = $( destinationId ).next( '.tab-content' )[ 0 ];
143
144            // Find the panel contents
145            var panelContents = $( panelGroup ).find( '.card-body.fw-previous-tab-pane' );
146
147            // Convert to tab and move to destination
148            panelContents
149                .removeClass( 'card-body fw-previous-tab-pane' )
150                .addClass( 'tab-pane' )
151                .appendTo( $( destination ) );
152
153        } );
154
155    };
156
157    fakewaffle.bindTabToCollapse = function () {
158
159        var tabs     = $( '.nav-tabs.responsive' ).find( 'li a' );
160        var collapse = $( '.card-soup.responsive' ).find( '.card-collapse' );
161
162        // Toggle the panels when the associated tab is toggled
163        tabs.on( 'shown.bs.tab', function ( e ) {
164
165            if (fakewaffle.currentPosition === 'tabs') {
166                var $current  = $( e.currentTarget.hash.replace( /#/, '#collapse-' ) );
167                $current.collapse( 'show' );
168
169                if ( e.relatedTarget ) {
170                    var $previous = $( e.relatedTarget.hash.replace( /#/, '#collapse-' ) );
171                    $previous.collapse( 'hide' );
172                }
173            }
174
175        } );
176
177        // Toggle the tab when the associated panel is toggled
178        collapse.on( 'shown.bs.collapse', function ( e ) {
179
180            if (fakewaffle.currentPosition === 'panel') {
181                // Activate current tabs
182                var current = $( e.target ).context.id.replace( /collapse-/g, '#' );
183                $( 'a[href="' + current + '"]' ).tab( 'show' );
184
185                // Update the content with active
186                var panelGroup = $( e.currentTarget ).closest( '.card-soup.responsive' );
187                $( panelGroup ).find( '.card-body' ).removeClass( 'active' );
188                $( e.currentTarget ).find( '.card-body' ).addClass( 'active' );
189            }
190
191        } );
192    };
193
194    $( window ).resize( function () {
195        fakewaffle.checkResize();
196    } );
197
198    return fakewaffle;
199}( window.jQuery, fakewaffle || { } ) );
200
201
202jQuery(function(){
203    fakewaffle.responsiveTabs();
204});
205
206

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.