PageSourceSearch

https://www.dozorme-claude.fr/wp-content/themes/wat-wp-theme/js/script.js

js dozorme-claude.fr collected 2026-09-25 00:27:42 UTC 15,561 bytes, 516 lines download raw bytes

1function throttle(callback, delay) {
2    var last;
3    var timer;
4    return function() {
5        var context = this;
6        var now = +new Date();
7        var args = arguments;
8        if (last && now < last + delay) {
9            clearTimeout(timer);
10            timer = setTimeout(function() {
11                last = now;
12                callback.apply(context, args);
13            }, delay);
14        } else {
15            last = now;
16            callback.apply(context, args);
17        }
18    };
19}
20
21jQuery(function($)
22{
23    'use strict';
24
25
26    if ($('.container_archive ').length > 0) {
27        var titre = $('h1').html();
28
29        var lastChar = titre[titre.length -1];
30        if (lastChar == "®") {
31            var new_titre = titre.slice(0,-1);
32            new_titre = new_titre+'<span>®</span>';
33            $('h1').html(new_titre);
34        }
35
36        $("h1").addClass('active');
37    }
38
39    $("h2").each(function() {
40        var text = $(this).text();
41        console.log(text);
42        text = text.replace("®", "<span class='symb'>®</span>");
43        $(this).html(text);
44    });
45
46
47    // ====================================================================
48     //     TOGGLE
49     // ====================================================================
50
51	$('.site_header .toggle').on('click',function() {
52        $(this).toggleClass('active');
53        $('.responsive_panel').toggleClass('opened');
54        $('body').toggleClass('frozen');
55	});
56
57    // =====================================================================
58    //      GET INLINE SVG FROM IMG
59    // =====================================================================
60    $('img.svg').each(function() {
61        var $img = $(this);
62        var imgID = $img.attr('id');
63        var imgClass = $img.attr('class');
64        var imgURL = $img.attr('src');
65
66        $.get(imgURL, function(data) {
67            // Get the SVG tag, ignore the rest
68            var $svg = $(data).find('svg');
69
70            // Add replaced image's ID to the new SVG
71            if (typeof imgID !== 'undefined') {
72                $svg = $svg.attr('id', imgID);
73            }
74            // Add replaced image's classes to the new SVG
75            if (typeof imgClass !== 'undefined') {
76                $svg = $svg.attr('class', imgClass + ' replaced-svg');
77            }
78
79            // Remove any invalid XML tags as per http://validator.w3.org
80            $svg = $svg.removeAttr('xmlns:a');
81
82            // Check if the viewport is set, if the viewport is not set the SVG wont't scale.
83            if (!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) {
84                $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width'))
85            }
86
87            // Replace image with new SVG
88            $img.replaceWith($svg);
89
90        }, 'xml');
91    });
92
93
94
95
96    $('.design_collab .slider').on('init', function(event, slick){
97      var dots = $( '.slick-dots li' );
98      dots.each( function( k, v){
99        $(this).find( 'button' ).addClass( 'heading'+ k );
100      });
101      var items = slick.$slides;
102      items.each( function( k, v){
103          var text = $(this).find( '.titre' ).text();
104          $( '.heading' + k ).text(text);
105      });
106    });
107
108    $('.design_collab .slider').slick({
109      dots: true,
110      arrows:true,
111      infinite: true,
112      speed: 300,
113      cssEase: 'linear',
114      slidesToShow: 1,
115       fade: true,
116       adaptiveHeight: true
117    });
118
119
120    inView('.home .savoir_faire .blocs')
121        .once('enter', el => {
122
123
124            setTimeout(() => {
125                $(el).closest('.savoir_faire').addClass('animated');
126            }, 500);
127    });
128
129    inView('.wp-block-acf-images-escalier .images')
130        .once('enter', el => {
131
132
133            setTimeout(() => {
134                $(el).addClass('animated');
135            }, 500);
136    });
137
138
139    inView('.home .personnalisation')
140        .once('enter', el => {
141
142
143            setTimeout(() => {
144                $(el).addClass('animated');
145            }, 500);
146    });
147
148    inView('.wp-block-acf-texte-image')
149        .once('enter', el => {
150
151
152            setTimeout(() => {
153                $(el).addClass('animated');
154            }, 500);
155    });
156
157    inView('.container_home .home_products_selection.first .blocs')
158        .once('enter', el => {
159
160
161            $(el).find('.bloc').each(function(index){
162                setTimeout(() => {
163                    $(this).addClass('animated');
164                }, (300*index) + 50);
165
166            });
167
168    });
169
170    inView('.container_home .home_products_selection.second .blocs')
171        .once('enter', el => {
172
173
174            $(el).find('.bloc').each(function(index){
175                setTimeout(() => {
176                    $(this).addClass('animated');
177                }, (300*index) + 50);
178
179            });
180
181    });
182
183
184
185
186
187
188    var scrolled = false;
189
190    //if I scroll more than 1000px...
191    if($(window).scrollTop() > 10 && scrolled == false){
192        console.log('fixed');
193      scrolled = true;
194
195      $('.site_header').addClass('fixed');
196      $('body').addClass('menu_fixed');
197    } else if($(window).scrollTop() == 0) {
198      scrolled = false;
199      console.log('not_fixed');
200      $('.site_header').removeClass('fixed');
201      $('body').removeClass('menu_fixed');
202    }
203
204
205    $(window).scroll(function() {
206
207        if($(window).scrollTop() > 10 && scrolled == false){
208            console.log('fixed');
209          scrolled = true;
210
211          $('.site_header').addClass('fixed');
212          $('body').addClass('menu_fixed');
213        } else if($(window).scrollTop() == 0) {
214          scrolled = false;
215          console.log('not_fixed');
216          $('.site_header').removeClass('fixed');
217          $('body').removeClass('menu_fixed');
218        }
219    });
220
221
222
223
224
225    $('.filter_button').on('click', function(){
226        $('.filtre_container').addClass('active');
227    });
228
229    $('.filtre_container .close').on('click', function(){
230        $(this).closest('.filtre_container').removeClass('active');
231    });
232
233
234    $('.onglets .boutons li a').on('click', function(e){
235        e.preventDefault();
236        $('.onglets .boutons li').removeClass('active');
237        $(this).closest('li').addClass('active');
238        var cible = $(this).attr('href');
239        $('.onglets section').removeClass('active');
240        $(cible).addClass('active');
241    });
242
243
244
245    $(function() {
246      $('audio').audioPlayer();
247    });
248
249
250    $('.bloc.audio .player_button button').on('click', function(){
251        $('.audioplayer:not(.audioplayer-playing) .audioplayer-playpause').trigger('click');
252        $(this).addClass('hide');
253
254        $('.audioplayer').addClass('active');
255    });
256
257
258
259    $('.wp-block-acf-audio-video-telecharger .bloc.video a').on('click', function(e){
260        e.preventDefault();
261        $(this).closest('.bloc').find('.popup').addClass('active');
262        $('body').addClass('frozen');
263    });
264
265    $('.container_home .intro .buttons .link_button.video').on('click', function(e){
266        e.preventDefault();
267        $(this).closest('.buttons').find('.popup').addClass('active');
268        $('body').addClass('frozen');
269    });
270
271    $('.popup .close').on('click', function(){
272        $(this).closest('.popup').removeClass('active');
273        $('body').removeClass('frozen');
274        $('body').removeClass('popupactive');
275        $('iframe').each(function(){
276            // $(this).attr('src', '');
277            this.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}', '*');
278            // console.log( this.contentWindow);
279        });
280    });
281
282
283
284    $('.wp-block-acf-historique .slider').on('init', function(event, slick){
285      var dots = $( '.slick-dots li' );
286      dots.each( function( k, v){
287        $(this).find( 'button' ).addClass( 'heading'+ k );
288      });
289      var items = slick.$slides;
290      items.each( function( k, v){
291          var text = $(this).find( '.annee' ).text();
292          $( '.heading' + k ).text(text);
293      });
294    });
295
296    $('.wp-block-acf-historique .slider').slick({
297      dots: true,
298      arrows:false,
299      infinite: true,
300      speed: 300,
301      cssEase: 'linear',
302      slidesToShow: 1,
303       fade: true,
304    });
305
306
307    $('.container_contact').on('change', 'input[name="input_3"]', function() {
308        if ($(this).closest('.gchoice').hasClass('active')){
309            $(this).closest('.gchoice').removeClass('active')
310        }else{
311            $('.gfield_radio .gchoice').removeClass('active');
312            $(this).closest('.gchoice').addClass('active')
313        }
314    });
315
316
317    $('.ouvrir_recherche').on('click', function(){
318        $(this).closest('.recherche').addClass('active');
319        $('body').addClass('frozen');
320    });
321
322    $('.site_header .recherche form button.close').on('click', function(){
323        $(this).closest('.recherche').removeClass('active');
324        $('body').removeClass('frozen');
325    });
326
327
328    $('.footer_nl').on('click', '#field_2_1 .ginput_container_radio', function(){
329        if ($(this).hasClass('active')){
330            $(this).removeClass('active');
331            $('#choice_2_1_0').prop('checked', false);
332            $('#choice_2_1_1').prop('checked', true);
333        }else{
334            $(this).addClass('active');
335            $('#choice_2_1_0').prop('checked', true);
336            $('#choice_2_1_1').prop('checked', false);
337        }
338    });
339
340
341
342
343    ///menu responsive
344    $('.responsive_panel ul>.menu-item.menu-item-has-children a').on('click', function(e){
345
346        if ($(this).closest('li').hasClass('menu-item-has-children')) {
347            e.preventDefault();
348
349            //on met active sur le parent aussi, si on est sous un sous enfant
350            // $(this).closest('li.menu-item-has-children').closest('li.menu-item-has-children').addClass('children_active');
351
352            if ($(this).parents("li:eq(2)").hasClass('children_active')) {
353                $(this).closest('li').addClass('active');
354            }else{
355                $(this).closest('li').addClass('children_active');
356            }
357            $('.responsive_panel .retour').addClass('active');
358        }else{
359            //comportement normale
360        }
361    });
362
363
364    //Retour
365    $('.responsive_panel .retour').on('click', function(){
366
367        if ($('.responsive_panel ul>.menu-item.menu-item-has-children.active').length > 0 ) {
368            $('.responsive_panel ul>.menu-item.menu-item-has-children.active').removeClass('active');
369        }else{
370            $('.responsive_panel ul>.menu-item.menu-item-has-children.children_active').removeClass('children_active');
371            $('.responsive_panel .retour').removeClass('active');
372        }
373
374    });
375
376
377    $('.site_footer .footer_wrapper .footer_menus_nl .footer_menus .menu-menu-footer-univers-container ul li a').on('click', function(e){
378        // e.preventDefault();
379        if ($(this).closest('li').hasClass('menu-item-has-children')) {
380            e.preventDefault();
381
382            if ($(this).closest('li').hasClass('active')) {
383                $('.site_footer .footer_wrapper .footer_menus_nl .footer_menus .menu-menu-footer-univers-container ul li').removeClass('active');
384            }else{
385                $('.site_footer .footer_wrapper .footer_menus_nl .footer_menus .menu-menu-footer-univers-container ul li').removeClass('active');
386                $(this).closest('li').addClass('active');
387            }
388
389        }else{
390            //comportement normale
391        }
392    });
393
394    if ($('#gform_confirmation_message_2').length > 0) {
395        $('html, body').animate({
396           scrollTop: $("#gform_confirmation_message_2").offset().top
397        }, 1000);
398    }
399
400
401    $('.container_archive .filtre_recherche .filtre_container .cols .col h2').on('click', function(){
402        $(this).closest('.col').toggleClass('active');
403    });
404
405
406    if ($('.gform_wrapper').length > 0) {
407        $('.ginput_container_textarea textarea').each(function(){
408            var val = $(this).attr('placeholder');
409            if (val !== "") {
410                $(this).html(val);
411                $(this).attr('placeholder', "");
412            }
413        })
414    }
415
416
417    // Breadcrumb : masquer les niveaux intermédiaires uniquement en mobile
418    if ($(window).width() < 768) {
419        var nb_breadcrumb_li = $('.breadcrumb ul li').length;
420        if (nb_breadcrumb_li > 3) {
421            $('.breadcrumb ul li:nth-child(2)').addClass("hide");
422            $('.breadcrumb ul li:nth-child(3)').addClass("hide");
423            $("<li class='show_all'>...</li>").insertAfter(".breadcrumb ul li:nth-child(3)");
424        }
425    }
426
427
428    $('.breadcrumb li.show_all').on('click', function(){
429        $('.breadcrumb ul li.hide').removeClass('hide');
430        $(this).addClass('hide');
431    })
432
433    var x, i, j, l, ll, selElmnt, a, b, c;
434/* Look for any elements with the class "custom-select": */
435x = document.getElementsByClassName("custom-select");
436l = x.length;
437for (i = 0; i < l; i++) {
438  selElmnt = x[i].getElementsByTagName("select")[0];
439
440  ll = selElmnt.length;
441  console.log(selElmnt.options[selElmnt.selectedIndex]);
442  /* For each element, create a new DIV that will act as the selected item: */
443  a = document.createElement("DIV");
444  a.setAttribute("class", "select-selected");
445  a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
446
447  x[i].appendChild(a);
448  /* For each element, create a new DIV that will contain the option list: */
449  b = document.createElement("DIV");
450  b.setAttribute("class", "select-items select-hide");
451  for (j = 0; j < ll; j++) {
452    /* For each option in the original select element,
453    create a new DIV that will act as an option item: */
454    c = document.createElement("DIV");
455    c.innerHTML = selElmnt.options[j].innerHTML;
456    c.addEventListener("click", function(e) {
457        /* When an item is clicked, update the original select box,
458        and the selected item: */
459        var y, i, k, s, h, sl, yl;
460        s = this.parentNode.parentNode.getElementsByTagName("select")[0];
461        sl = s.length;
462        h = this.parentNode.previousSibling;
463        for (i = 0; i < sl; i++) {
464          if (s.options[i].innerHTML == this.innerHTML) {
465            s.selectedIndex = i;
466            h.innerHTML = this.innerHTML;
467            y = this.parentNode.getElementsByClassName("same-as-selected");
468            yl = y.length;
469            for (k = 0; k < yl; k++) {
470              y[k].removeAttribute("class");
471            }
472            this.setAttribute("class", "same-as-selected");
473            break;
474          }
475        }
476        h.click();
477    });
478    b.appendChild(c);
479  }
480  x[i].appendChild(b);
481  a.addEventListener("click", function(e) {
482    /* When the select box is clicked, close any other select boxes,
483    and open/close the current select box: */
484    e.stopPropagation();
485    closeAllSelect(this);
486    this.nextSibling.classList.toggle("select-hide");
487    this.classList.toggle("select-arrow-active");
488  });
489}
490
491function closeAllSelect(elmnt) {
492  /* A function that will close all select boxes in the document,
493  except the current select box: */
494  var x, y, i, xl, yl, arrNo = [];
495  x = document.getElementsByClassName("select-items");
496  y = document.getElementsByClassName("select-selected");
497  xl = x.length;
498  yl = y.length;
499  for (i = 0; i < yl; i++) {
500    if (elmnt == y[i]) {
501      arrNo.push(i)
502    } else {
503      y[i].classList.remove("select-arrow-active");
504    }
505  }
506  for (i = 0; i < xl; i++) {
507    if (arrNo.indexOf(i)) {
508      x[i].classList.add("select-hide");
509    }
510  }
511}
512
513/* If the user clicks anywhere outside the select box,
514then close all select boxes: */
515document.addEventListener("click", closeAllSelect);
516});

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.