1/** 2* File theme.js 3*/ 4 5 6( function( $ ) { 7 var commande = "" ; 8 var commande_field = ""; 9 var at_more_content = [] ; 10 var coupons_list = {}; 11 const apply_coupon = { 12 '+' : function (x, y) { return (x + y); }, 13 '-' : function (x, y) { return (x - y); }, 14 '%' : function (x, y) { return Math.floor(x * (1 - ( y / 100 ))) ; } 15 }; 16 17 $(document).ready(function () { 18 var main_profile; 19 20 $(document).on('change', '.price-choice[type="checkbox"]', function(e) { 21 var is_checked = $(this).prop('checked'); 22 var the_index = $(this).data('index'); 23 $('.price-choice[data-index="'+the_index+'"]').prop('checked', is_checked); 24 update_quotation(); 25 }); 26 27 $('.price-coupon[type="checkbox"]').each(function () { 28 var coupon_index = $(this).data('index'); 29 var coupon_operand = $(this).data('operand'); 30 coupons_list[coupon_index] = {}; 31 coupons_list[coupon_index]["value"] = $(this).attr("value") ; 32 coupons_list[coupon_index]["operand"] = coupon_operand; 33 coupons_list[coupon_index]["on"] = false; 34 }); 35 $(document).on('change', '.price-coupon[type="checkbox"]', function(e) { 36 var is_checked = $(this).prop('checked'); 37 var coupon_index = $(this).data('index'); 38 $('.price-coupon[data-index="'+coupon_index+'"]').prop('checked', is_checked); 39 coupons_list[$(this).data('index')]["on"] = is_checked ; 40 apply_coupons(); 41 update_quotation(); 42 }); 43 44 $('.discard label').click(function() { 45 var parent_article = $(this).parent().parent().parent(); 46 parent_article.find('input[data-index]').each(function () { 47 var the_index = $(this).data('index'); 48 $('.price-choice[data-index="'+the_index+'"]').prop('checked', false); 49 }) 50 next_step_quotation($(this)); 51 parent_article.find('.next').click(); 52 }); 53 54 $('.main-profile .next').click(function() { 55 purge_profile_quotation($(this).parent().parent().parent().data('price_id')); 56 next_step_quotation($(this)); 57 }); 58 59 $('.optional-profile .next').click(function() { 60 next_step_quotation($(this)); 61 }); 62 63 commande_field = $('.quotation_form').parent().attr('id'); 64 update_quotation(); 65 66 67 // home page swiper 68 const headerSwiper = new Swiper('.swiper', { 69 direction: 'horizontal', 70 loop: true, 71 autoplay: { 72 delay: 5000, 73 }, 74 pagination: { 75 el: '.swiper-pagination', 76 }, 77 navigation: { 78 nextEl: '.swiper-button-next', 79 prevEl: '.swiper-button-prev', 80 }, 81 }); 82 83 // - waypoints 84 // -- switch logo color 85 var black_waypoints = $('.need-black').waypoint(function(direction) { 86 if (direction=='up') { 87 $('body').removeClass('black-header'); 88 } else { 89 $('body').addClass('black-header'); 90 } 91 }, { 92 offset: '50' 93 }); 94 // -- active events navigation 95 var b4b_navigation_waypoints = $('.single-b4bconnection [role="section"]').waypoint(function(direction) { 96 $('.b4b-connection-navigation li').removeClass('current'); 97 if (direction=='up') { 98 var previousSection = $(this.element).prev('section'); 99 if(previousSection.length>0) { 100 $('.b4b-connection-navigation [href=#'+ previousSection.attr("id") + ']').parent().addClass('current'); 101 } else { 102 $('body').removeClass('scrolled-b4bconnection'); 103 } 104 } else { 105 $('body').addClass('scrolled-b4bconnection'); 106 $('.b4b-connection-navigation [href=#'+ this.element.id + ']').parent().addClass('current'); 107 } 108 }, { 109 offset: '50%' 110 }); 111 // -- infinite scroll 112 var nav_links_waypoints = $('.nav-links').waypoint(function(direction) { 113 if (direction=='up') { 114 $('body').removeClass('at-nav-links'); 115 } else { 116 $('body').addClass('at-nav-links'); 117 } 118 }, { 119 offset: '50%' 120 }); 121 122 // news && job board infinite scroll 123 $(document).on('click', 'body:not(.home) .more-content .ajax-me:not(.loading)', function(e) { 124 e.preventDefault(); 125 $(this).addClass('loading'); 126 $.ajax({ 127 url : $(this).attr('href'), 128 method : 'POST', 129 success : function(data) { 130 if(at_more_content.length>0) { 131 at_more_content[0].destroy(); 132 } 133 $('.more-content').replaceWith($(data).find('#list.jobs, #list.newsletters, #list.news>.content-inner, #list.b4bconnections>.content-inner').html());
134 watch_more(); 135 }, 136 error : function( data ) { 137 console.log( 'Erreurâ¦' ); 138 } 139 }); 140 }); 141 function watch_more() { 142 at_more_content = $('body:not(.home) .more-content .ajax-me').waypoint(function(direction) { 143 if(!$(this.element).hasClass('loading')) { 144 $(this.element).click(); 145 } 146 }, { 147 offset: '100%' 148 }); 149 } 150 // uncomment to release infinite scroll 151 watch_more(); 152 153 // copy newsletter feed 154 if (navigator.clipboard) { 155 $('.tocopy').click(function () { 156 navigator.clipboard.writeText($(this).data('target')) 157 .then(() => { 158 $(this).addClassAndRemove('copied',0,6000); 159 }); 160 }); 161 } 162 163 // active fields on focus 164 $('.gform_wrapper').find('input[type="text"], input[type="email"], input[type="password"], textarea').each(function() { 165 $(this).on('focus', function() { 166 $(this).parent().parent('.gfield').addClass('active'); 167 }); 168 $(this).on('blur', function() { 169 if ($(this).val().length == 0) { 170 $(this).parent().parent('.gfield').removeClass('active'); 171 } 172 }); 173 if ($(this).val() != '') $(this).parent().parent('.gfield').addClass('active'); 174 }); 175 176 }); 177 178 $( window ).on( "load", function() { 179 $('.video.lazy, .source.lazy, .mood.lazy').each(function(){ 180 if($(this).data('src')) { 181 $(this).attr('src', $(this).data('src')); 182 if($(this).is('video')) { 183 $(this).trigger('play'); 184 } 185 } 186 $(this).removeClass('lazy'); 187 }); 188 }); 189 190 function apply_coupons() { 191 $('.price-choice:not(.selected-price)').each(function () { 192 var my_coupons = $(this).data('coupons'); 193 if (typeof(my_coupons)!=='undefined' && (my_coupons!='')) { 194 var my_price = parseInt($(this).data('original_value')); 195 var my_coupons_array = []; 196 if (typeof(my_coupons)=='number') { 197 my_coupons_array.push(my_coupons); 198 } else if (typeof(my_coupons)=='string') { 199 my_coupons_array = my_coupons.split('_'); 200 } 201 var item_price = $(this); 202 $.each(my_coupons_array, function (key, coup) { 203 if(coupons_list[coup]["on"]) { 204 my_price = apply_coupon[coupons_list[coup]["operand"]](my_price, coupons_list[coup]["value"]); 205 } 206 }); 207 item_price.val(my_price); 208 item_price.next().find('em').text(my_price); 209 } 210 }); 211 } 212 213 function purge_profile_quotation (the_profile_index) { 214 var selected_options = []; 215 $('.main-profile[data-price_id="' + the_profile_index + '"] .price-choice[type="checkbox"]').each(function () { 216 if($(this).prop('checked')) { 217 selected_options.push($(this).data('index')); 218 } 219 }); 220 $('.main-profile:not([data-price_id="' + the_profile_index + '"]) .price-choice[type="checkbox"]').each(function () { 221 var the_index; 222 the_index = $(this).data('index'); 223 if ($.inArray(the_index, selected_options)==-1) { 224 $('.price-choice[data-index="'+the_index+'"]').prop('checked', false); 225 } 226 }); 227 228 } 229 230 function update_quotation() { 231 var total = 0 ; 232 $('.price').each(function () { 233 var sub_total = 0; 234 $(this).find('.price-choice').each(function () { 235 if ($(this).attr('type')=='checkbox') { 236 if( $(this).prop('checked')) { 237 sub_total += parseInt($(this).val()); 238 } 239 } else { 240 sub_total += parseInt($(this).val()); 241 } 242 }); 243 $(this).find('.total').text(sub_total); 244 }); 245 transfert_quotation(); 246 } 247 248 function next_step_quotation(el) { 249 var parent_article = el.parent().parent(); 250 var target_article = $('.price[data-optional_id="' + el.data('target') + '"]'); 251 var article_total = parseInt(parent_article.find('.total').text()); 252 target_article.find('[name="selected-price"]').val(article_total); 253 update_quotation(); 254 } 255 256 function transfert_quotation() { 257 var quotation = '<table cellpadding="10" cellspacing="0" border="0">'; 258 $('.quotation_form').each(function () { 259 $(this).find('.price-coupon').each(function () { 260 if($(this).prop('checked')) { 261 var label = $(this).next().find('h4').text(); 262 var value = $(this).data('operand') + $(this).val(); 263 quotation += '<tr><td style="border-bottom:2px solid #eee;">'+label+'</td><td style="border-bottom:2px solid #eee;">'+value+'</td>'; 264 } 265 }); 266 $(this).find('li').each(function () { 267 var choice = $(this).find('.price-choice'); 268 var label = $(this).find('span').text();
269 if (choice.attr('type')=='hidden' || (choice.attr('type')=='checkbox' && choice.prop('checked'))) { 270 var value = choice.val(); 271 quotation += '<tr><td style="border-bottom:2px solid #eee;">'+label+'</td><td style="border-bottom:2px solid #eee;">'+(choice.val()!='0' ? choice.val() : '')+'</td>'; 272 } 273 }); 274 quotation += '<tr><th style="border-top:2px solid #eee;text-align:right">Total HT</th><th style="border-top:2px solid #eee;">'+$(this).find('.total').text()+'</th></tr></table>'; 275 $('[id="'+$(this).data('quotation_target')+'"]').val(quotation); 276 277 commande = $(this).clone(true, true); 278 }); 279 } 280 281 $(document).on('gform_post_render', function(){ 282 var commande_field_item = $('#'+commande_field); 283 if(commande!='' && !$.trim(commande_field_item.html())) { 284 commande_field_item.html(commande); 285 } 286 }); 287 288 $.fn.addClassAndRemove = function(classAdd, timeAdd, timeRemove) { 289 let element = this; 290 let addIt = function(){ 291 element.addClass(classAdd); 292 }; 293 let removeIt = function(){ 294 element.removeClass(classAdd); 295 }; 296 setTimeout(function() { addIt(); setTimeout(removeIt, timeRemove); }, timeAdd); 297 return this; 298 }; 299 300} )( 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.