PageSourceSearch

https://www.rosier.de/wp-content/themes/breakdance-zero/js/scripts.js?ver=1.0.7

js rosier.de collected 2026-10-02 18:03:35 UTC 10,028 bytes, 297 lines download raw bytes

1
2(function($, window) {
3  var adjustAnchor = function() {
4
5    var $anchor = $(':target'), fixedElementHeight = 0;
6
7    if ($anchor.length > 0) {
8      $('html, body')
9        .stop()
10        .animate({
11          scrollTop: $anchor.offset().top - fixedElementHeight
12        }, 200);
13    }
14  };
15
16  $(window).on('hashchange load', function() {
17    adjustAnchor();
18  });
19
20})(jQuery, window);
21
22(function($) {
23
24  "use strict";
25
26  function removeBlursFromSlides(){
27    //find .bde-advancedslide with class blur and set it to fade-in after 1s
28    // if there are mor than on blur elements, do it every sec
29    // for each element
30    var blur_elements = $('.advanced-slider__slide .blur');
31    if(blur_elements.length > 0){
32      blur_elements.each(function(index){
33        var $this = $(this);
34        setTimeout(function(){
35          $this.addClass('fade-out');
36        }, index * 500);
37      });
38    }
39  }
40
41  removeBlursFromSlides();
42
43  $('.slider_prev button').on('click', function(e){
44    e.preventDefault();
45   var swiper_id = $(this).parent().attr('swiper-id');
46
47   $('.breakdance-swiper-wrapper[data-swiper-id='+swiper_id+'] .swiper.swiper-initialized').each(function(){
48     //console.log($(this));
49     var swiper = $(this).get(0).swiper;
50     swiper.slidePrev();
51     removeBlursFromSlides()
52   });
53  });
54
55  $('.slider_next button').on('click', function(e){
56    e.preventDefault();
57    var swiper_id = $(this).parent().attr('swiper-id');
58
59    $('.breakdance-swiper-wrapper[data-swiper-id='+swiper_id+'] .swiper.swiper-initialized').each(function(){
60      //console.log($(this));
61      var swiper = $(this).get(0).swiper;
62      swiper.slideNext();
63      removeBlursFromSlides()
64    });
65  });
66
67
68
69
70
71  //clickable header "logo"
72  const header_section = document.getElementById('header-section');
73
74  if(header_section != null){
75    header_section.addEventListener('click', (e) => {
76      const clientRect = e.currentTarget.getBoundingClientRect();
77      if (e.pageX < 300) {
78        console.log('Clicked logo space');
79        const logo_wrappers = document.querySelectorAll('.logo-wrapper');
80        logo_wrappers.forEach((logo_wrapper) => {
81          console.log('logo wrapper found: '+logo_wrapper.getAttribute('href'));
82          if(logo_wrapper.getAttribute('href') != null) window.location = logo_wrapper.getAttribute('href');
83          return;
84        });
85      } else {
86        console.log('Clicked right rest');
87      }
88    });
89  }
90
91  function checkStickyButtons(){
92    $('.tsmd-fixed-buttons.fixed-top').each(function(){
93      if(window.scrollY > 550) {
94        // 5W-50 28.09.2026: '.bde-header-builder:first-child' trifft nie, beide Kopfzeilen sind nicht das
95        // erste Kind von body. $header.css() lieferte undefined, .replace warf bei jedem Scroll-Ereignis
96        // "reading 'replace'" (rund 25-mal je Scrollvorgang, jede VDP). Jetzt die sichtbare Kopfzeile.
97        const $header = $('.bde-header-builder').filter(function(){ return this.offsetHeight > 0; }).first();
98        const margin_top = $header.length ? (parseInt($header.css('marginTop'), 10) || 0) : 0;
99        const needed_height = ($header.length ? $header.height() : 0) + margin_top;
100
101        $(this).css('margin-top',needed_height);
102
103        $(this).fadeIn();
104      }else{
105        $(this).fadeOut();
106      }
107
108    })
109  }
110
111  //first check
112  checkStickyButtons();
113  checkOffsetShortInfo();
114
115  var hashAlreadyShown = false;
116
117  //show up nav-tab content on VDP
118  if ($('#vdpTab.nav-tabs').length > 0) { // if #vdpTab.nav-tabs exists
119    var $tabs = $('#vdpTab.nav-tabs');
120    var hashtag = window.location.hash;
121
122    if (hashtag!='' && hashtag!='#anfrage' && hashtag!='#ratenrechner') {
123      $tabs.find('li > a.nav-link').removeClass('active');
124      $tabs.find('li a[data-bs-target="'+hashtag+'"]').addClass('active');
125      $('#vdpTabContent > div').removeClass('show active');
126      $(hashtag).addClass('show active');
127      hashAlreadyShown = true;
128
129      /*if(window.innerWidth < 768){
130        $('html, body').stop().animate({
131          scrollTop:$(hashtag).offset().top - 400
132        },'fast');
133      }*/
134    }
135  }
136
137  //tab bar links for offers page
138  $('.tab_buttons').find('a.button:first').addClass('active');
139  var $tab_btns = $('.tab_buttons').find('a.button:first');
140  var $tab_btns_href = $('.tab_buttons').find('a.button:first').map( function() {
141    return $(this).attr('href');
142  }).get();
143
144  function showTabById(id){
145    console.log(id);
146    if(id == '' || id == undefined) return;
147    
148    if(id === '#all'){
149      $('.tab_section, .column_offer, .photo_section').fadeIn();
150      return;
151    }
152    $('.tab_section, .column_offer, .photo_section').hide();
153    $(id).fadeIn();
154
155    if(window.innerWidth < 768){
156      if(id != '#ls_used' && id != '#ls_new'){
157        $('html, body').animate({
158          scrollTop:$(id).offset().top - 100
159        },'slow');
160      }
161    }
162  }
163
164  var hash = window.top.location.hash.substr(1);
165  if(!hashAlreadyShown){
166    if(hash !== '' && hash !== 'anfrage' && hash !== 'team'){
167      var $tab_btn = $tab_btns.filter(function(index){
168        return $(this).attr('href') == '#'+hash;
169      });
170      $tab_btns.removeClass('active');
171      $tab_btn.addClass('active');
172      showTabById('#'+hash);
173    }else{
174      showTabById($tab_btns_href[0]);
175    }
176  }
177
178  $('form.tsmd-filter-form').each(function(){
179    function livecountinput($form) {
180      let $selects = $form.find('select');
181
182      let length = $selects.filter(function(index){
183        return ($(this).val() !== '_ALL' && parseInt($(this).val()) !== 0)
184      }).length;
185
186      console.log('live input: '+length);
187
188      $form.closest('.tsmd-filter').find('.livecount').text('('+length+')');
189      //let count = document.getElementById('count');
190      //count.innerHTML = length
191    };
192    livecountinput($(this));
193
194    $(this).find('select').on('change.tsmd',function(){
195      livecountinput($(this).closest('form'));
196    });
197  });
198
199
200  $('.tab_buttons').find('a.button').on('click.gfxe.loadtab',function(e){
201    e.preventDefault();
202    $tab_btns.removeClass('active');
203    $(this).addClass('active');
204
205    showTabById($(this).attr('href'));
206  });
207
208  function checkOffset() {
209    var $stickyElement = $('.offerside.ts-sticky').first();
210    //console.log($stickyElement);
211    var $stickyParent = $stickyElement.parent();
212    //console.log($stickyParent.offset().top);
213
214    if ($stickyElement.length){
215      if(window.scrollY > 400) {
216        $stickyElement.addClass('scrolled-over');
217      }else{
218        $stickyElement.removeClass('scrolled-over');
219      }
220      if ($stickyElement.offset().top + $stickyElement.height() >= $('#breakdance-footer').offset().top - 10) {
221        $stickyElement.removeClass('fixed');
222        $stickyElement.addClass('absolute');
223        console.log('content height: '+parseInt($('#Content').height()));
224        console.log('footer height: '+parseInt($('#mfn-footer-template').height()));
225        console.log('parent top: '+$stickyParent.offset().top);
226        $stickyElement.css('top',parseInt($('#Content').height()) - $stickyParent.offset().top - $stickyElement.height() );
227      }
228      if ($(document).scrollTop() + window.innerHeight < $('#breakdance-footer').offset().top + $stickyElement.height() + 60) {
229        $stickyElement.removeClass('absolute');
230        $stickyElement.addClass('fixed'); // restore when you scroll up
231        $stickyElement.css('top','unset');
232        $stickyElement.css('bottom','unset');
233      }
234    }
235  }
236
237  function checkOffsetShortInfo() {
238    var $stickyElement = $('.short-info.ts-sticky').first();
239    var $stickyParent = $stickyElement.parent();
240
241    /*console.log('scroll Y: ' + window.scrollY);
242    console.log('content height: '+parseInt($('#Content').height()));
243    console.log('request height: '+parseInt($('#tsmd-request-detail').height()));
244    console.log('footer height: '+parseInt($('#mfn-footer-template').height()));
245    console.log('header height: '+parseInt($('#mfn-header-template').height()));
246
247     */
248
249    /*
250    console.log('real scroll: '+current_real_scroll_position);
251    console.log('bottom space: '+bottom_space_position);
252    */
253    
254    if ($stickyElement.length){
255      var current_real_scroll_position = window.scrollY ;//+ $stickyParent.offset().top + (parseInt($stickyElement.outerHeight()) );
256      var bottom_space_position = parseInt($('#breakdance-main').outerHeight()) - $stickyParent.offset().top - parseInt($('#anfrage').outerHeight()) - parseInt($stickyElement.outerHeight());
257
258      console.log('window scroll: '+window.scrollY);
259      console.log('sticky parent top: '+$stickyParent.offset().top);
260      console.log('sticky element height: '+parseInt($stickyElement.outerHeight()));
261      //console.log(parseInt($stickyElement.outerHeight()) + $stickyParent.offset().top);
262      console.log('current_real_scroll_position: '+current_real_scroll_position);
263      console.log('bottom_space_position: '+bottom_space_position);
264
265      if(window.scrollY > 600) {
266        $stickyElement.addClass('scrolled-over');
267      }else{
268        $stickyElement.removeClass('scrolled-over');
269      }
270
271      var top_value = parseInt($('#breakdance-main').outerHeight()) - parseInt($('#anfrage').outerHeight()) - $stickyParent.offset().top - parseInt($stickyElement.outerHeight());
272
273      if (current_real_scroll_position >= bottom_space_position) {
274        $stickyElement.removeClass('fixed');
275        $stickyElement.addClass('absolute');
276        $stickyElement.css('top', top_value);
277      }
278      if (current_real_scroll_position < bottom_space_position) {
279        $stickyElement.removeClass('absolute');
280        $stickyElement.addClass('fixed'); // restore when you scroll up
281        $stickyElement.css('top','unset');
282        $stickyElement.css('bottom','unset');
283      }
284    }
285  }
286
287  $('.used-car-link').on('click.gfxe.firstlink',function(){
288    window.location.href = $(this).find('a:first-child').attr('href');
289  })
290
291  $(document).scroll(function() {
292    checkOffset();
293    checkOffsetShortInfo();
294    checkStickyButtons();
295  });
296  
297})(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.