PageSourceSearch

https://www.circet.com/fileadmin/themes/corporate/script/app.js?1740549055

js circet.com collected 2026-09-30 16:40:54 UTC 19,830 bytes, 629 lines download raw bytes

1(function($) {
2//
3// MEDIA QUERIES -- via Harvey.js
4//
5
6var fn_media_querie = function () {
7
8	var body = $('body');
9
10	// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
11	//
12	// On ajoute la class "rwd-desktop" sur body pour gérer le menu
13	// Toujours mettre min-width avant max-width
14	//
15	// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
16
17	// > 1200px
18	Harvey.attach('screen and (min-width:75em)', {
19		on: function () {
20			body.addClass('rwd-desktop');
21			body.removeClass('rwd-mobile');
22		}
23	});
24  
25	// < 1199px
26	Harvey.attach('screen and (max-width:74.9375em)', {
27		on: function () {
28			body.removeClass('rwd-desktop');
29			body.addClass('rwd-mobile');
30		}
31	});
32
33};
34
35//
36// Scroll Top
37// See: https://codyhouse.co/demo/back-to-top/index.html
38//
39var fn_scroll_top = function () {
40
41
42    // Back to Top - by CodyHouse.co
43	var backTop = document.getElementsByClassName('js-cd-top')[0],
44		// browser window scroll (in pixels) after which the "back to top" link is shown
45		offset = 300,
46		//browser window scroll (in pixels) after which the "back to top" link opacity is reduced
47		offsetOpacity = 1200,
48		scrollDuration = 700,
49		scrolling = false;
50	if( backTop ) {
51		//update back to top visibility on scrolling
52		window.addEventListener("scroll", function(event) {
53			if( !scrolling ) {
54				scrolling = true;
55				(!window.requestAnimationFrame) ? setTimeout(checkBackToTop, 250) : window.requestAnimationFrame(checkBackToTop);
56			}
57		});
58		//smooth scroll to top
59		backTop.addEventListener('click', function(event) {
60			event.preventDefault();
61			(!window.requestAnimationFrame) ? window.scrollTo(0, 0) : scrollTop(scrollDuration);
62		});
63	}
64
65	function checkBackToTop() {
66		var windowTop = window.scrollY || document.documentElement.scrollTop;
67		( windowTop > offset ) ? addClass(backTop, 'cd-top--show') : removeClass(backTop, 'cd-top--show', 'cd-top--fade-out');
68		( windowTop > offsetOpacity ) && addClass(backTop, 'cd-top--fade-out');
69		scrolling = false;
70	}
71	
72	function scrollTop(duration) {
73	    var start = window.scrollY || document.documentElement.scrollTop,
74	        currentTime = null;
75	        
76	    var animateScroll = function(timestamp){
77	    	if (!currentTime) currentTime = timestamp;        
78	        var progress = timestamp - currentTime;
79	        var val = Math.max(Math.easeInOutQuad(progress, start, -start, duration), 0);
80	        window.scrollTo(0, val);
81	        if(progress < duration) {
82	            window.requestAnimationFrame(animateScroll);
83	        }
84	    };
85
86	    window.requestAnimationFrame(animateScroll);
87	}
88
89	Math.easeInOutQuad = function (t, b, c, d) {
90 		t /= d/2;
91		if (t < 1) return c/2*t*t + b;
92		t--;
93		return -c/2 * (t*(t-2) - 1) + b;
94	};
95
96	//class manipulations - needed if classList is not supported
97	function hasClass(el, className) {
98	  	if (el.classList) return el.classList.contains(className);
99	  	else return !!el.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'));
100	}
101	function addClass(el, className) {
102		var classList = className.split(' ');
103	 	if (el.classList) el.classList.add(classList[0]);
104	 	else if (!hasClass(el, classList[0])) el.className += " " + classList[0];
105	 	if (classList.length > 1) addClass(el, classList.slice(1).join(' '));
106	}
107	function removeClass(el, className) {
108		var classList = className.split(' ');
109	  	if (el.classList) el.classList.remove(classList[0]);	
110	  	else if(hasClass(el, classList[0])) {
111	  		var reg = new RegExp('(\\s|^)' + classList[0] + '(\\s|$)');
112	  		el.className=el.className.replace(reg, ' ');
113	  	}
114	  	if (classList.length > 1) removeClass(el, classList.slice(1).join(' '));
115	}
116
117};
118
119//
120// COVER IMG
121//
122var fn_cover = function () {
123
124    $('.cover').each(function (i, el) {
125        var $el = $(el);
126        var $img = $el.find('>img, >a>img').eq(0);
127
128        function setBackgroundImage(url) {
129            if (!url) {
130                return;
131            }
132            $el.css('background-image', 'url(' + url + ')');
133        }
134        setBackgroundImage($img.attr('src'));
135    });
136
137};
138// 
139// > Caution: adding .rwd-desktop CSS class for limiting processing to an 992px min window size
140
141var fn_sticky = function () {
142  var header = $('.rwd-desktop .header__wrapper')
143  var headerHeight = $('.rwd-desktop .header__wrapper').outerHeight();
144
145  $(window).scroll(function () {
146    scrollPos = $(window).scrollTop()
147
148    if (scrollPos > (headerHeight*1.5)) {
149      header.addClass('is-sticky')
150    }else {
151      header.removeClass('is-sticky')
152    }
153  })
154}
155
156var fn_header_move_up = function () {
157  // SOURCE : http://jsfiddle.net/mariusc23/s6mLJ/31/
158
159  // Hide Header on on scroll down
160  var didScroll
161  var lastScrollTop = 0
162  var delta = 5
163  var navbarHeight = $('.header__wrapper').outerHeight()
164
165  $(window).scroll(function (event) {
166    didScroll = true
167  })
168
169  setInterval(function () {
170    if (didScroll) {
171      hasScrolled()
172      didScroll = false
173    }
174  }, 250)
175
176  function hasScrolled () {
177    var st = $(this).scrollTop()
178
179    // Make sure they scroll more than delta
180    if (Math.abs(lastScrollTop - st) <= delta)
181      return
182
183    // If they scrolled down and are past the navbar, add class .nav-up.
184    // This is necessary so you never see what is "behind" the navbar.
185    if (st > lastScrollTop && st > navbarHeight) {
186      // Scroll Down
187      $('.rwd-desktop .header__wrapper').addClass('is-moving-up')
188
189      // Closing Meganav while moving for we may have just a meganav stuck onto the screen...
190      $('.rwd-desktop .header__wrapper .dropdown-menu.show').dropdown('toggle')
191    } else {
192      // Scroll Up
193      if (st + $(window).height() < $(document).height()) {
194        $('.header__wrapper').removeClass('is-moving-up')
195      }
196    }
197
198    lastScrollTop = st
199  }
200}
201
202// NAV
203
204var fn_navigation_rwd = function () {
205
206    var $el = $("#nav-primary__wrapper");
207    $el.on('show.bs.dropdown', function () {
208        // do something...
209        // console.log('MegaNav opening !');
210        $('body').addClass('nav-is-open');
211    })
212    $el.on('hide.bs.dropdown', function () {
213        // do something...
214        // console.log('MegaNav closing !');
215        $('body').removeClass('nav-is-open');
216    })
217
218}
219//
220var fn_owl_carousel = function () {
221
222  // > Slider-1
223  $('.owl-carousel.slider-1').owlCarousel({
224    items: 1,
225    slideBy: 1,
226    loop: false,
227    rewind: false,
228    nav: true,
229    pagination: true,
230    navText: ['<span class="sr-only">Précédent</span><span class="icon icon-fleche-prev" aria-hidden="true"></span>', '<span class="sr-only">Suivant</span><span class="icon icon-fleche-next" aria-hidden="true"></span>'],
231    navClass: ['btn btn-owl--prev', 'btn btn-owl--next'],
232    // rewindNav: true,
233    // stagePadding: 100,
234    margin: 0,
235    URLhashListener: true,
236    autoplayHoverPause: true,
237    startPosition: 'URLHash',
238    responsiveClass: true
239  })
240
241  // > Slider-hero
242  var sliderhero = $('.owl-carousel.slider-hero')
243  var content_is_clonable = sliderhero.parents('.o-section-hero__inner').find('.o-section-hero__svg-holder')
244
245  sliderhero
246    .on('initialized.owl.carousel', function () {
247      if ($(content_is_clonable).length > 0) {
248        $(content_is_clonable).clone().appendTo(sliderhero)
249        $(content_is_clonable).remove()
250      }
251    })
252    .owlCarousel({
253      items: 1,
254      slideBy: 1,
255      autoplay: true,
256      autoplayTimeout: 7000,
257      loop: false,
258      rewind: true,
259      nav: false,
260      navText: ['<span class="sr-only">Précédent</span><span class="icon icon-arrow-left" aria-hidden="true"></span>', '<span class="sr-only">Suivant</span><span class="icon icon-arrow-right" aria-hidden="true"></span>'],
261      navClass: ['btn btn-owl--prev', 'btn btn-owl--next'],
262      rewindNav: true,
263      // stagePadding: 100,
264      margin: 0,
265      URLhashListener: true,
266      // autoplayHoverPause: true,
267      startPosition: 'URLHash',
268      responsiveClass: true,
269      responsive: {
270        992: {
271          nav: false
272        },
273        1200: {
274          nav: true
275        }
276      }
277
278    })
279
280  // > Slider-news
281  // Get Left of bs4 container so we can move owl news carousel accordingly - offset is only calculated while .rwd-desktop 
282  // setTimeout(function () {}, 500);
283  var slidernews = $('.owl-carousel.slider-news');
284  var slidernews_currentItem = slidernews.currentItem;
285  if ($('.o-section-news__wrapper .container').length > 0){
286    var slidernews_pad_l = $('.o-section-news__wrapper .container').offset().left;
287  }
288
289  slidernews
290    .on('initialized.owl.carousel', function (e) {
291      // > Setting left position
292      slidernews.css('left', slidernews_pad_l)
293      slidernews.children().find('.owl-item').removeClass('owl-item-scaled')
294      slidernews_currentItem = $('.owl-item', slidernews).eq(e.item.index)
295      slidernews_currentItem.addClass('owl-item-scaled')
296    })
297    .owlCarousel({
298      items: 1,
299      slideBy: 1,
300      autoWidth: true,
301      autoHeight: false,
302      loop: true,
303      rewind: false,
304      nav: false,
305      dots: true,
306      pagination: true,
307      // navContainerClass: $('.slider-news-btn__wrapper'),
308      navText: ['<span class="sr-only">Précédent</span><span class="icon icon-fleche-prev" aria-hidden="true"></span>', '<span class="sr-only">Suivant</span><span class="icon icon-fleche-next" aria-hidden="true"></span>'],
309      navClass: ['btn btn-owl--prev', 'btn btn-owl--next'],
310      // rewindNav: true,
311      margin: 0,
312      // URLhashListener: true,
313      autoplayHoverPause: true,
314      // startPosition: 'URLHash',
315      responsiveClass: true,
316      responsive: {
317        768: {
318          items: 2,
319          slideBy: 1,
320          nav: false,
321          dots: true
322        },
323        1200: {
324          items: 3,
325          slideBy: 1,
326          nav: true,
327          dots: true
328        }
329      }
330    })
331  slidernews
332    .on('resized.owl.carousel', function () {
333      // > Setting left position
334      // Redefining VAr to get updated value here
335      if ($('.o-section-news__wrapper .container').length > 0){
336        var slidernews_pad_l = $('.o-section-news__wrapper .container').offset().left;
337      }
338      slidernews.css('left', slidernews_pad_l)
339    })
340    .on('changed.owl.carousel', function (e) {
341      // console.log("current: ",e.relatedTarget.current())
342      // console.log("current: ",e.item.index) //same
343      // console.log("total: ",e.item.count)   //total
344      slidernews.children().find('.owl-item').removeClass('owl-item-scaled')
345      slidernews_currentItem = $('.owl-item', slidernews).eq(e.item.index)
346      slidernews_currentItem.addClass('owl-item-scaled')
347    })
348    .on('changed.owl.carousel', function (event) {
349      // slidernews.children().find('.owl-item').removeClass('owl-item-scaled')
350    })
351    .on('translated.owl.carousel', function (event) {
352      // slidernews_currentItem = $('.owl-item', slidernews).eq(event.item.index)
353      // slidernews_currentItem.addClass('owl-item-scaled')
354      // slidernews.children().find('.owl-item').removeClass('owl-item-scaled')
355    })
356
357
358  // > Slider-kfact
359  $('.owl-carousel.slider-kfact').owlCarousel({
360    items: 1,
361    slideBy: 1,
362    autoWidth: false,
363    autoHeight: true,
364    loop: false,
365    rewind: true,
366    nav: false,
367    dots: true,
368    pagination: true,
369    // navContainerClass: $('.slider-news-btn__wrapper'),
370    navText: ['<span class="sr-only">Précédent</span><span class="icon icon-fleche-prev" aria-hidden="true"></span>', '<span class="sr-only">Suivant</span><span class="icon icon-fleche-next" aria-hidden="true"></span>'],
371    navClass: ['btn btn-owl--prev', 'btn btn-owl--next'],
372    // rewindNav: true,
373    margin: 0,
374    // URLhashListener: true,
375    autoplay: true,
376    autoplayTimeout: 3000,
377    autoplayHoverPause: true,
378    // startPosition: 'URLHash',
379    responsiveClass: true,
380    animateOut: 'fadeOut'
381  })
382
383  // > Slider-partners
384  $('.owl-carousel.slider-partners').owlCarousel({
385    items: 1,
386    slideBy: 1,
387    autoWidth: false,
388    autoHeight: false,
389    loop: true,
390    rewind: false,
391    nav: false,
392    dots: false,
393    pagination: false,
394    navText: ['<span class="sr-only">Précédent</span><span class="icon icon-fleche-prev" aria-hidden="true"></span>', '<span class="sr-only">Suivant</span><span class="icon icon-fleche-next" aria-hidden="true"></span>'],
395    navClass: ['btn btn-owl--prev', 'btn btn-owl--next'],
396    // rewindNav: true,
397    margin: 0,
398    // URLhashListener: true,
399    autoplay: true,
400    autoplayTimeout: 2000,
401    autoplayHoverPause: true,
402    // startPosition: 'URLHash',
403    responsiveClass: true,
404    responsive: {
405      768: {
406        items: 3,
407        slideBy: 1,
408        nav: false
409      },
410      1200: {
411        items: 5,
412        slideBy: 1,
413        nav: false
414      }
415    }
416  })
417}
418
419//
420// Scroll to next section
421// 
422
423// Hero - btn scroll to next section
424var fn_scroll_next_section = function () {
425
426    $(".js-scroll-to-next-section").on("click", function(){
427        var sectionNext = $(this).closest('.section').next();
428
429        $("html, body").animate({
430            scrollTop: sectionNext.offset().top - 100
431        }, 700);
432    });
433
434};
435// https://stackoverflow.com/questions/24933430/img-src-svg-changing-the-fill-color?answertab=active#tab-top
436
437/*
438 * Replace all SVG images with inline SVG
439 */
440
441var fn_svg_inline = function () {
442
443    jQuery('img.js-svg-inline').each(function(){
444        var $img = jQuery(this);
445        var imgID = $img.attr('id');
446        var imgClass = $img.attr('class');
447        var imgURL = $img.attr('src');
448    
449        jQuery.get(imgURL, function(data) {
450            // Get the SVG tag, ignore the rest
451            var $svg = jQuery(data).find('svg');
452    
453            // Add replaced image's ID to the new SVG
454            if(typeof imgID !== 'undefined') {
455                $svg = $svg.attr('id', imgID);
456            }
457            // Add replaced image's classes to the new SVG
458            if(typeof imgClass !== 'undefined') {
459                $svg = $svg.attr('class', imgClass+' replaced-svg');
460            }
461    
462            // Remove any invalid XML tags as per http://validator.w3.org
463            $svg = $svg.removeAttr('xmlns:a');
464    
465            // Check if the viewport is set, if the viewport is not set the SVG wont't scale.
466            if(!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) {
467                $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width'))
468            }
469    
470            // Replace image with new SVG
471            $img.replaceWith($svg);
472    
473        }, 'xml');
474    
475    });
476
477};
478
479// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
480//
481// FLOAT LABEL
482// src : http://jsfiddle.net/RyanWalters/z9ymd852/
483//
484// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
485var fn_float_label = function () {
486
487    $('.float-target').on('focus blur', function (e) {
488        $(this).parents('.float-target-parent').toggleClass('focused', (e.type === 'focus' || this.value != ''));
489    });
490
491    $('.float-target').each(function () {
492        if($(this).val() != "") {
493            $(this).parents('.float-target-parent').addClass('focused');
494        }
495    });
496
497}
498//
499// Scroll to next section
500// 
501
502// Fn to add onClick and onChange states an "error" CSS class to ":invalid" form items
503var fn_form_invalid = function () {
504
505    $(".powermail_form input.a-button-design").on("click", function(){
506        $(this).parents().find('.powermail_form')
507        .children().find(':invalid').closest('.float-target-parent')
508        .addClass('error');
509    });
510
511    $(".powermail_form").on("change", function(){
512        $(this).children().find(':valid').closest('.float-target-parent').removeClass('error');
513        $(this).children().find(':invalid').closest('.float-target-parent').addClass('error');
514    });
515
516};
517var fn_search_nav = function () {
518
519    // popover footer
520    var search_button = $('.nav-item-button-search');
521    var search_button_txt = $('.nav-item-button-search span + span');
522    var search_wrapper = $('.nav-item-block-search');
523
524    search_button.on('click', function () {
525        if( $(this).hasClass('open') ) {
526            $(this).removeClass('open').attr('aria-expanded', 'false');
527            search_button_txt.html('Ouvrir la recherche');
528            search_wrapper.removeClass('show').attr('aria-hidden', 'true');
529        } else {
530            $(this).addClass('open').attr('aria-expanded', 'true');
531            search_button_txt.html('Fermer la recherche');
532            search_wrapper.addClass('show').attr('aria-hidden', 'false');            
533        }
534    });
535
536    // > 1200px
537	Harvey.attach('screen and (min-width:75em)', {
538		on: function () {
539            search_button.removeClass('d-none');
540            search_wrapper.removeClass('show').attr('aria-labelledby','search-content').attr('aria-hidden', 'true');
541		}
542	});
543    
544	// < 1199px
545	Harvey.attach('screen and (max-width:74.9375em)', {
546        on: function () {
547            search_button.addClass('d-none');
548            search_wrapper.addClass('show').removeAttr('aria-labelledby').attr('aria-hidden', 'false');
549		}
550	});
551
552}
553var fn_masthead = function () {
554    // begin masthead video //
555    // Video paused when out of viewport
556    // See: http://morr.github.io/appear.html
557    // Masthead - SPLASH VIDEO
558    // Adding class ".Desktop" to activate video injection only on
559    // desktop browser
560    $('.desktop .slider-hero').each(function () {
561        var header = $(this),
562            videoPath = header.data('video'),
563            covervid = $('<div class="data-is-video-wrapper animated fader"><video playsinline="" autoplay="" muted="" loop="" poster="' + videoPath + '.jpg"  onplaying="this.controls=false" class="slider-hero__video"><source src="' + videoPath + '.mp4" type="video/mp4"></video></div>')
564        //
565        covervid.find('video').on('canplay', function () {
566            covervid.addClass('fadeIn').removeClass('fader')
567            header.find('.fader').addClass('animated fadeInUpHeader').removeClass('fader')
568        })
569        // $(this).append(covervid).find('video').appear()
570        // $(this).find('video').on('appear', appearVideo).on('disappear', disappearVideo)
571    })
572
573    $('.mobile .masthead-has-video .fader, .tablet .masthead-has-video .fader').addClass('animated fadeInUpHeader').removeClass('fader')
574
575    // $(window).on('load', function () {
576        
577    //     // Is in viewport detection - see Masthead JS + Covervid JS
578    //     // Is in viewport detection - see Masthead JS + Covervid JS
579    //     // > Pause video when out of viewport
580    //     // See: https://github.com/zeusdeux/isInViewport
581    //     // --> Conflict with jquery no conflict so we change for another lib - see below jquery.appear
582    //     // See: https://github.com/morr/jquery.appear
583    //     //
584    //     // Other wise check out: https://www.npmjs.com/package/video-in-view
585    //     //
586    //     $('video').appear().on('appear', appearVideo).on('disappear', disappearVideo)
587
588    // })
589    // end masthead video //
590}
591
592
593var fn_hide_streak = function () {
594    $('.m-card-citation').each( function() {
595         $(this).prev(".lead__wrapper").addClass("no-streak")
596    } )
597}
598// * * * * * * * * * * * * * * * * * * * * 
599//
600// On donne le focus à la fenetre du site et non au navigateur
601//
602// * * * * * * * * * * * * * * * * * * * * 
603$(window).focus()
604
605// * * * * * * * * * * * * * * * * * * * *
606//
607// DOM READY : init function
608//
609// * * * * * * * * * * * * * * * * * * * *
610$(document).ready(function () {
611        fn_media_querie();
612        fn_scroll_top();
613        fn_cover();
614        fn_sticky();
615        fn_header_move_up();
616        fn_navigation_rwd();
617        fn_owl_carousel();
618        fn_scroll_next_section();
619        fn_svg_inline();
620        fn_float_label();
621        fn_form_invalid();
622        fn_search_nav();
623        fn_masthead();
624        fn_hide_streak();
625//
626})
627
628})(jQuery);
629//# sourceMappingURL=app.js.map

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.