PageSourceSearch

https://www.brainsonic.com/wp-content/themes/bs-kalium-child/assets/js/bs-custom.js

js brainsonic.com collected 2026-10-02 07:31:41 UTC 12,912 bytes, 297 lines download raw bytes

1(function(window, $, undefined){
2
3  /* -------------------------------- windows size  */
4    var __ww, __wh;
5    updateReferentSize();
6    function updateReferentSize(){
7      __ww = isNaN(window.innerWidth) ? window.clientWidth : window.innerWidth;
8      __wh = isNaN(window.innerHeight) ? window.clientHeight : window.innerHeight;
9    }
10
11    $(window).resize(function() {
12      updateReferentSize();
13    });
14
15  /* -------------------------------- global btn gdpr */
16    $( document ).ready(function() {
17      $('#btn-show-banner-gdpr').on('click', function(event) {
18        event.preventDefault();
19        $('#bs-gdpr-banner').removeClass('hidden');
20      });
21      header_anim_SVG();
22    });
23
24  /* -------------------------------- HOME/PAGE BG Line effect */
25    var __animLineDelay = 3000;
26    var __animLineSpeed = 1200;
27    var __homeSliderLoaded = false;
28    var __ease = "easeInSine";
29
30    function home__AnimateHeaderBgLine(){
31      if(  $('body').hasClass('home') ){
32        if( $('.home .bs-line-element.bs-header').length ){
33          $('.home .bs-line-element.bs-header').height( __wh + 100 );
34          $('.home .bs-line-element.bs-header .bs-line-top-left').animate({height: '100%'}, __animLineSpeed, __ease, function(){
35            $('.home .bs-line-element.bs-header .bs-line-top-left-small').animate({width: '100%'}, __animLineSpeed, __ease);
36            $('.home .bs-line-element.bs-header .bs-line-top-right').animate({height: '240px'}, __animLineSpeed, __ease);
37            $('.home .bs-line-element.bs-header .bs-line-bottom-right').delay( 200 ).animate({height: '100%'}, __animLineSpeed, __ease);
38            $('.home .bs-line-element.bs-header .bs-line-bottom-right-small').delay( 100 ).animate({width: '100%'}, __animLineSpeed, __ease);
39          });
40        }
41      }
42    }
43    function home__AddContentBg(){
44      /* .home-content est une class ajouté dans le BO via visual composer, sur la "rangée" de contenu située sous le slider*/
45      if( $('.home-content').length ){
46        if( $('.bs-page-bg').length <= 0){
47
48          var htmlbg = '';
49          htmlbg += '<div class="bs-page-bg hidden-xs">';
50          htmlbg += '  <div class="bs-page-bg-container">';
51          htmlbg += '    <div class="bs-page-bg-item border-right"></div>';
52          htmlbg += '    <div class="bs-page-bg-item border-bottom"></div>';
53          htmlbg += '    <div class="bs-page-bg-item border-right border-bottom large"></div>';
54          htmlbg += '    <div class="bs-page-bg-item large"></div>';
55          htmlbg += '    <div class="bs-page-bg-item border-right bg-gray"></div>';
56          htmlbg += '    <div class="bs-page-bg-item bg-gray"></div>';
57          htmlbg += '  </div>';
58          htmlbg += '</div>';
59
60          $('.home-content').parent().append(htmlbg);
61        }
62        var h = $('.home-content').height() + 150;
63        $('.bs-page-bg').find('.bs-page-bg-item.large').height(h);
64      }
65    }
66    function home__InitSlider(){
67
68      if($('.bs-home-swiper-container').length){
69
70        var videoElement = $('.home_slider_video');
71        $('.bs-home-swiper-container').height(__wh);
72
73        var swiper = new Swiper('.bs-home-swiper-container', {
74          autoplay: {
75            delay: 10000,
76            disableOnInteraction: false
77          },
78          speed: 1000,
79          loop: true,
80          pagination: {
81            el: '.bs-home-swiper-container .swiper-pagination',
82            clickable: true,
83          },
84          navigation: {
85            nextEl: '.bs-home-swiper-container .swiper-button-next',
86            prevEl: '.bs-home-swiper-container .swiper-button-prev'
87          },
88          on: {
89            init: function () {
90              var slideBg = $('.bs-home-swiper-container').find('.swiper-slide').eq(this.activeIndex).data('bs-bg');
91              if(slideBg){
92                $('.bs-home-swiper-container').css('background-image', 'url('+slideBg+')');
93              }else{
94                $('.bs-home-swiper-container').css('background-image', 'none');
95              }
96
97              if( __ww > 767 ){
98                videoElement.css('display', 'block');
99                var videoFile = $('.bs-home-swiper-container').find('.swiper-slide').eq(this.activeIndex).data('bs-video');
100                videoElement.attr('src', videoFile);
101                videoElement[0].load();
102                videoElement[0].play();
103              }
104              else{
105                videoElement.css('display', 'none');
106              }
107            },
108            slideChange: function () {
109              var index = this.activeIndex;
110              var slideBg = $('.bs-home-swiper-container').find('.swiper-slide').eq(this.activeIndex).data('bs-bg');
111              if(slideBg){
112                $('.bs-home-swiper-container').css('background-image', 'url('+slideBg+')');
113              }else{
114                $('.bs-home-swiper-container').css('background-image', 'none');
115              }
116
117              if( __ww > 767 ){
118                videoElement.css('display', 'block');
119                videoElement[0].pause();
120                videoElement.fadeOut(500, function(){
121                  var videoFile = $('.bs-home-swiper-container').find('.swiper-slide').eq(index).data('bs-video');
122                  videoElement.attr('src', videoFile);
123                  videoElement[0].load();
124                  videoElement[0].play();
125                  videoElement.fadeIn(500); 
126                });
127              }else{
128                videoElement.css('display', 'none');
129              }
130            },
131          },
132        });
133
134        $('.bs-home-swiper-container').on('click', '.scrolldown', function(event) {
135          event.preventDefault();
136          var anchor = $(this).data('href');
137          $("html, body").animate( { scrollTop: $(anchor).offset().top - 40}, 500);
138        });
139
140      }
141    }
142
143    function home__AddElements(){
144      home__AnimateHeaderBgLine();
145      home__AddContentBg();
146      home__InitSlider();
147    }
148
149    __homeSliderLoaded = true;
150    home__AddElements();
151
152    $(window).resize(function() {
153      if(__homeSliderLoaded){
154        $('.bs-home-swiper-container').height(__wh);
155        home__AnimateHeaderBgLine();
156      }
157    });
158
159  /* -------------------------------- SVG header animation */
160    function header_anim_SVG(){
161      if( $('.bs-svg-line-element.bs-header').length ){
162        var offset = $('.svg-header-line').css('stroke-dashoffset');
163        if(offset < 0) cancelAnimationFrame(header_anim_SVG);
164        $('.svg-header-line').animate({ 'stroke-dashoffset': 0}, 3000);
165      }
166    }
167
168    $( document ).ready(function() {
169      $('.bs-home-swiper-container').height(__wh);
170      header_anim_SVG();
171    });
172
173  /* -------------------------------- CONTACT weather */
174    var weatherCode =  {
175      "0": { "en" : "tornado", "fr" :"tornade" },
176      "1" : { "en" : "tropical storm", "fr" : "tempête tropicale"},
177      "2" : { "en" : "hurricane", "fr" : "ouragan"},
178      "3" : { "en" : "severe thunderstorms", "fr" : "orages"},
179      "4" : { "en" : "thunderstorms", "fr" : "orages"},
180      "5" : { "en" : "mixed rain and snow", "fr" : "neige"},
181      "6" : { "en" : "mixed rain and sleet", "fr" : "pluie"},
182      "7" : { "en" : "mixed snow and sleet", "fr" : "neige"},
183      "8" : { "en" : "freezing drizzle", "fr" : "bruine"},
184      "9" : { "en" : "drizzle", "fr" : "bruine"},
185      "10" : { "en" : "freezing rain", "fr" : "pluie"},
186      "11" : { "en" : "showers", "fr" : "averse"},
187      "12" : { "en" : "showers", "fr" : "averse"},
188      "13" : { "en" : "snow flurries", "fr" : "neige"},
189      "14" : { "en" : "light snow showers", "fr" : "neige"},
190      "15" : { "en" : "blowing snow", "fr" : "neige"},
191      "16" : { "en" : "snow", "fr" : "neige"},
192      "17" : { "en" : "hail", "fr" : "grêle"},
193      "18" : { "en" : "sleet", "fr" : "grêle"},
194      "19" : { "en" : "dust", "fr" : "brumeux"},
195      "20" : { "en" : "foggy", "fr" : "brumeux"},
196      "21" : { "en" : "haze", "fr" : "brumeux"},
197      "22" : { "en" : "smoky", "fr" : "brumeux"},
198      "23" : { "en" : "blustery", "fr" : "brumeux"},
199      "24" : { "en" : "windy", "fr" : "vent"},
200      "25" : { "en" : "cold", "fr" : "froid"},
201      "26" : { "en" : "cloudy", "fr" : "nuageux"},
202      "27" : { "en" : "mostly cloudy (night)", "fr" : "nuageux"},
203      "28" : { "en" : "mostly cloudy (day)", "fr" : "nuageux"},
204      "29" : { "en" : "partly cloudy (night)", "fr" : "nuageux"},
205      "30" : { "en" : "partly cloudy (day)", "fr" : "nuageux"},
206      "31" : { "en" : "clear (night)", "fr" : "clair"},
207      "32" : { "en" : "sunny", "fr" : "ensoleillé"},
208      "33" : { "en" : "fair (night)", "fr" : ""},
209      "34" : { "en" : "fair (day)", "fr" : ""},
210      "35" : { "en" : "mixed rain and hail", "fr" : "pluie"},
211      "36" : { "en" : "hot", "fr" : "chaud"},
212      "37" : { "en" : "isolated thunderstorms", "fr" : "orages"},
213      "38" : { "en" : "scattered thunderstorms", "fr" : "orages"},
214      "39" : { "en" : "scattered thunderstorms", "fr" : "orages"},
215      "40" : { "en" : "scattered showers", "fr" : "averses"},
216      "41" : { "en" : "heavy snow", "fr" : "neige"},
217      "42" : { "en" : "scattered snow showers", "fr" : "averses"},
218      "43" : { "en" : "heavy snow", "fr" : "neige"},
219      "44" : { "en" : "partly cloudy", "fr" : "nuageux"},
220      "45" : { "en" : "thundershowers", "fr" : "orages"},
221      "46" : { "en" : "snow showers", "fr" : "neige"},
222      "47" : { "en" : "isolated thundershowers", "fr" : "orages"},
223      "3200" : { "en" : "not available", "fr" : "non disponible"}
224    };
225
226    function contact__InitWeather(){
227      if($(".map-details-paris .weather").length ){
228        var weatherParis =  $.simpleWeather({
229                            zipcode: '',
230                            woeid: '615702', //615702 ==> paris
231                            location: '',
232                            unit: 'c',
233                            success: function(weather) {
234                              $(".map-details-paris .weather").html('<i class="bs-icon-'+weather.code+'"></i>'+'<div>'+weather.temp+'&deg;</div>');
235                              $(".map-details-paris .weather-txt").html(weatherCode[weather.code]["fr"]);
236                            },
237                            error: function(error) {
238                              console.log('simpleWeather error');
239                              $(".map-details-paris .weather").html('<i class="bs-icon-32"></i>'+'<div>12&deg;</div>');
240                              $(".map-details-paris .weather-txt").html('ensoleillé');
241                            }
242                          });
243      }
244      
245      if($(".map-details-lyon .weather").length ){
246        var weatherLyon =  $.simpleWeather({
247                    zipcode: '',
248                    woeid: '609125', //609125 ==> lyon
249                    location: '',
250                    unit: 'c',
251                    success: function(weather) {
252                      $(".map-details-lyon .weather").html('<i class="bs-icon-'+weather.code+'"></i>'+'<div>'+weather.temp+'&deg;</div>');
253                      $(".map-details-lyon .weather-txt").html(weatherCode[weather.code]["fr"]);
254                    },
255                    error: function(error) {
256                      console.log('simpleWeather error');
257                      $(".map-details-lyon .weather").html('<i class="bs-icon-26"></i>'+'<div>13&deg;</div>');
258                      $(".map-details-lyon .weather-txt").html('nuageux');
259                    }
260                  });
261      }
262
263    }
264
265    $( document ).ready(function() {
266      if( $('.page-contact .weather').length >= 0){
267        contact__InitWeather();
268      }
269    });
270
271  /* -------------------------------- ABOUT carousel */
272    if(  $('.page-about .carousel').length ){
273      $('.page-about .carousel').carousel({
274        interval: 2000
275      });
276    }
277
278  /* -------------------------------- SINGLE portfolio */
279    function nextSlide(){
280      $('#slides-trophy .slide').removeClass('showing');
281      var nbslide = $('#slides-trophy .slide').length;
282      currentSlide = (currentSlide+1)%nbslide;
283      $('#slides-trophy .slide:eq('+ currentSlide +')').addClass('showing');
284    }
285
286    var currentSlide = 0;
287    $( document ).ready(function() {
288      if(  $('.single-portfolio #slides-trophy').length ){
289        $('.single-portfolio .trophy.hidden').appendTo( $('.single-portfolio .ref-trophy').find('h2').parent() );
290        $('.single-portfolio .ref-trophy .trophy').removeClass('hidden');
291        currentSlide = 0;
292        nextSlide();
293        var slideInterval = setInterval(nextSlide,5000);
294      }
295    });
296
297})(window, 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.