1jQuery(document).ready(function () { 2 3 /* 4 * Contact form 7 5 */ 6 7 document.addEventListener( 'wpcf7mailsent', function( event ) { 8 /* 9 * Script pour trouver la rusticité 10 */ 11 if ( '339' == event.detail.contactFormId ) { 12 13 var inputs = event.detail.inputs; 14 15 for ( var j = 1; j < 10; j++) { 16 jQuery(".rust-zone-" + j).removeClass("standout"); 17 } 18 19 for ( var i = 0; i < inputs.length; i++ ) { 20 if ( 'code-postal' == inputs[i].name ) { 21 22 var $zone; 23 24 jQuery.ajax({ url: '/wp-content/themes/Avada-Child-Theme/js/hardiness_zones.php', 25 data: {postal_code: inputs[i].value}, 26 dataType: "json", 27 type: 'POST', 28 success: function(data) { 29 30 if (data.length > 0) { 31 $zone = data[0].zone; 32 jQuery(".rust-zone-" + $zone).addClass("standout"); 33 jQuery(".fusion-alert-content").html("Ce code postal correspond à la zone " + $zone + "."); 34 } else { 35 jQuery(".fusion-alert-content").html("Désolé, aucun résultat pour ce code postal."); 36 } 37 } 38 }); 39 40 break; 41 } 42 } 43 44 /* 45 * Script pour vérifier bon de commande 46 * 47 * exécute bons_commandes.php pour trouver la saisie et retourne 48 * soit la liste des fichiers ou rien du tout. 49 */ 50 } else if ( '2450' == event.detail.contactFormId) { 51 52 var inputs = event.detail.inputs; 53 54 for ( var i = 0; i < inputs.length; i++ ) { 55 if ( 'numero-client' == inputs[i].name ) { 56 57 jQuery.ajax({ url: '/wp-content/themes/Avada-Child-Theme/js/bons_commandes.php', 58 data: {numero_client: inputs[i].value}, 59 dataType: "json", 60 type: 'POST', 61 success: function(data) { 62 if (data.length > 0) { 63 if (data[0] === 1) { // fr 64 var output = 'Vous trouvez ci-dessous les bons de commande des catalogues de NORSECO.</p><p>Vous nâavez quâà  télécharger le bon de commande de votre choix, le sauvegarder dans vos documents, choisir les items et indiquer les quantités. Le total sâeffectue automatiquement.</p><p>Joignez ce bon de commande à un courriel et envoyez le tout à  : <a href="mailto:[email protected]">[email protected]</a>.</p><p>Cliquez ici pour télécharger votre bon de commande.</p>'; 65 output += '<div class="fusion-text"><h3>Ornemental:</h3><p>'; 66 67 68 for (var i = 0; i < data[1].length; i++) { 69 output += '<a href="/wp-content/uploads/bons_commandes/fr/01_Ornemental/' + data[1][i]['name'] + '?edited=' + data[1][i]['edited'] + '">' + data[1][i]['name'] + '</a></br>'; 70 } 71 72 output += '</p><h3>Maraîcher:</h3><p>'; 73 74 for (var i = 0; i < data[2].length; i++) { 75 output += '<a href="/wp-content/uploads/bons_commandes/fr/02_Maraîcher/' + data[2][i]['name'] + '?edited=' + data[2][i]['edited'] + '">' + data[2][i]['name'] + '</a></br>'; 76 } 77 78 /* 79 output += '</p><h3>Semences W. H. Perron:</h3><p>'; 80 81 for (var i = 0; i < data[3].length; i++) { 82 output += '<a href="/wp-content/uploads/bons_commandes/fr/03_Semences W. H. Perron/' + data[3][i]['name'] + '?edited=' + data[3][i]['edited'] + '">' + data[3][i]['name'] + '</a></br>'; 83 } 84 85 output += '</p></div>'; 86 */ 87 88 } else { 89 var output = 'You will find below the purchase orders for Norseco catalogs.</p><p>You can download the purchase order form of your choice, save it in your documents, choose your desired items and quantities. The total will be calculated.</P>Join this form to your email and send it to : <a href="mailto:[email protected]">[email protected]</a>.</p><p>Click here to download your purchase order form.</p>'; 90 output += '<div class="fusion-text"><h3>Ornamental:</h3><p>'; 91 92 for (var i = 0; i < data[1].length; i++) { 93 output += '<a href="/en/wp-content/uploads/bons_commandes/en/01_Ornamental/' + data[1][i]['name'] + '?edited=' + data[1][i]['edited'] + '">' + data[1][i]['name'] + '</a></br>'; 94 } 95 96 output += '</p><h3>Vegetable Growers:</h3><p>'; 97 98 for (var i = 0; i < data[2].length; i++) { 99 output += '<a href="/en/wp-content/uploads/bons_commandes/en/02_Vegetable Growers/' + data[2][i]['name'] + '?edited=' + data[2][i]['edited'] + '">' + data[2][i]['name'] + '</a></br>'; 100 } 101 102 output += '</p></div>'; 103 } 104 105 jQuery('#bc-container').html(output); 106 } else { 107 jQuery(".fusion-alert-content").html( cs_strings.val
107idateaccountnumber ); 108 } 109 } 110 }); 111 112 break; 113 } 114 } 115 116 } 117 }, false ); 118 119 /* 120 * Rajouter des labels 121 */ 122 123 jQuery( ".menu-item input#username" ).before( "<span class='login-box-only'>" + cs_strings.username + "</span>" ); 124 jQuery( ".menu-item input#password" ).before( "<span class='login-box-only'>" + cs_strings.password + "</span>" ); 125 126 /* 127 * Add style to semaine dropdown 128 */ 129 jQuery( "#semaine" ).wrap('<div class="avada-select-parent"></div>'); 130 jQuery( "#semaine" ).after('<div class="select-arrow" style="height: 38px; width: 38px; line-height: 38px;">î</div>'); 131 132 /* add Label */ 133 jQuery( "#semaine").before("<label for='semaine'>" + cs_strings.week + "</label>"); 134 135 if (!jQuery('aside.fusion-shoparchive').length) { 136 jQuery('#content').css('float','left'); 137 } 138 jQuery('.prefix_cart_shipping').on('change keyup paste',function(){ 139 jQuery('.cart_totals').block({ 140 message: null, 141 overlayCSS: { 142 background: '#fff', 143 opacity: 0.6 144 } 145 }); 146 var cart_id = jQuery(this).data('cart-id'); 147 jQuery.ajax( 148 { 149 type: 'POST', 150 url: cs_strings.ajaxurl, 151 data: { 152 action: 'prefix_update_cart_notes', 153 security: jQuery('#woocommerce-cart-nonce').val(), 154 pshipping: jQuery('#cart_shipping_' + cart_id).val(), 155 cart_id: cart_id 156 }, 157 success: function( response ) { 158 jQuery('.cart_totals').unblock(); 159 } 160 } 161 ) 162 }); 163 164 jQuery('.woocommerce').on('click', 'td.product-edit a', function(e) { 165 e.preventDefault(); 166 167 jQuery.ajax({ 168 type: "POST", 169 url: cs_strings.ajaxurl, 170 data: { 171 action : 'edit_item_from_cart', 172 security: jQuery('#woocommerce-cart-nonce').val(), 173 product_id : jQuery(this).first().data('productId'), 174 cart_item_key : jQuery(this).first().data('cartItemKey') 175 }, 176 success: function (response) { 177 window.location.href = response + '&edit=true'; 178 } 179 }); 180 }) 181 182}); 183 184/* 185* Refresh des variations single product page 186*/ 187(function( $ ) { 188 'use strict'; 189 $(function() { 190 191 var variation_form = $( '.variations_form' ); 192 193 $('#pa_producteur').on("change", function() { 194 195 if ($(this).val() == '') { 196 $('.format-table tbody').empty(); 197 $('.format-table tfoot').empty(); 198 $('.remarque').html(''); 199 $('.etq').html(''); 200 $('.format-table').hide(); 201 $(this).removeClass('reset_variations'); 202 } else { 203 204 setTimeout(function() { 205 $('#pa_producteur').addClass('reset_variations'); 206 },300); 207 208 if( $('#pa_formulation').val() != '' ) { 209 setTimeout(function() { 210 $("#pa_sku option:eq(1)").attr('selected','selected').change(); 211 },100); 212 } 213 214 $('.norseco_validation_notice').fadeOut(300, function() { $(this).remove(); }); 215 } 216 }) 217 218 $('#pa_formulation').on( "change" , function () { 219 220 if($(this).val() == '') { 221 $('.format-table tbody').empty(); 222 $('.format-table tfoot').empty(); 223 $('.remarque').html(''); 224 $('.etq').html(''); 225 $('.format-table').hide(); 226 $(this).removeClass('reset_variations'); 227 } else { 228 229 setTimeout(function() { 230 $('#pa_formulation').addClass('reset_variations'); 231 },300); 232 233 setTimeout(function() { 234 jQuery("#pa_sku").val(jQuery("#pa_sku option").eq("1").val()); 235 $("#pa_sku option:eq(1)").attr('selected','selected').change(); 236 },100); 237 $('.norseco_validation_notice').fadeOut(300, function() { $(this).remove(); }); 238 } 239 }); 240 241 $('#pa_sku').attr('disabled', 'disabled'); 242 243 // Override du breadcrumbs de produit avec variété 244 245 if ($('#variety').length) { 246 $('.breadcrumb-leaf').html( $('#variety').html() ); 247 } 248 249 if ($('label[for="pa_sku"]')) { 250 $('label[for="pa_sku"]').html(cs_strings.productcode); 251 } 252 253 /* 254 * Refresh d'éléments spécifiques lors du choix (dropdown) d'un produit avec variation 255 */ 256 257 variation_form.on( "show_variation", function ( event, variation ) { 258 259 jQuery.ajax({ 260 url: cs_strings.ajaxurl, 261 //url: '/wp-content/themes/Avada-Child-Theme/js/variation_result.php', 262 data: { 263 action: 'variation_result', 264 v_id : variation.variation_id 265 }, 266 dataType: "json", 267 type: 'POST', 268 success: function(data) { 269 270 var semaine_debut, semaine_fin, qty_min, price, pa_unit, pa_description_serie, pa_format_disponible, pa_remplacant, pa_statut, pa_etiquette; 271 272 $.each(data, function( index, value ) { 273 if(value.meta_key == 'pa_disponibilite_debut') { 274 semaine_debut = parseInt(value.meta_value); 275 } else if (value.meta_key == 'pa_disponibilite_fin') { 276 semaine_fin = parseInt(value.meta_value); 277 } else if (value.meta_key == 'pa_qte_minimum') { 278 qty_min = value.meta_value; 279 } else if (value.meta_key == "_price") { 280 price = value.meta_value; 281 } else if (value.meta_key == "pa_unit") { 282 pa_unit = value.meta_value; 283 } else if (value.meta_key == "pa_description_serie") { 284 pa_description_serie = value.meta_value; 285 } else if (value.meta_key == "pa_format_disponible") { 286 pa_format_disponible = value.meta_value; 287 } else if (value.meta_key == 'pa_statut') { 288 pa_statut = value.meta_value; 289 } else if (value.meta_key == 'pa_remplacant') { 290 pa_remplacant = value.meta_value; 291 } else if (value.meta_key == 'pa_etat_etiquette') { 292 pa_etiquette = value.meta_value; 293 } 294 295 }); 296 297 // Remarque / remplacé 298 if (pa_statut == 'R' && pa_remplacant != '') { 299 var url_remplacant = ''; 300 301 $('.format-table').hide(); 302 $('.thwepo-extra-options').hide(); 303 $('.single_add_to_cart_button').attr("disabled", "disabled"); 304 $('.remarque').html('<p class="n-d">
304' + cs_strings.replacedby + ' <a href="' + url_remplacant + '">' + pa_remplacant + '</a></p>') 305 306 $.ajax({ url: '/wp-content/themes/Avada-Child-Theme/js/remplacant_url.php', 307 data: {post_sku : pa_remplacant}, 308 dataType: "json", 309 type: 'POST', 310 success: function(data) { 311 if (data.length > 0 && url_remplacant == '') { 312 $.each(data, function( index, value ) { 313 var req = '/wc-api/v3/products/' + value.post_id; 314 315 $.ajax({ 316 url: req, 317 type: "GET", 318 beforeSend: function (xhr){ 319 xhr.setRequestHeader("Authorization", "Basic " + btoa('ck_ba5a36b7aa56183d78b81aac6d43a80ed3185d2b' + ":" + 'cs_4ed666ecaedefd9296c18362a496e399f7d58315')); 320 }, 321 success: function(res){ 322 url_remplacant = res.product.permalink; 323 $('.remarque a').attr("href", url_remplacant); 324 }, 325 error: function(error){ 326 console.log('Error: ' + error); 327 } 328 }) 329 330 }); 331 } else if (data.length == 0 && url_remplacant == '') { 332 333 $.ajax({ url: '/wp-content/themes/Avada-Child-Theme/js/remplacant_url.php', 334 data: {post_sku : pa_remplacant.substr(0,7)}, 335 dataType: "json", 336 type: 'POST', 337 success: function(data) { 338 $.each(data, function( index, value ) { 339 340 var req = '/wc-api/v3/products/' + value.post_id; 341 342 $.ajax({ 343 url: req, 344 type: "GET", 345 beforeSend: function (xhr){ 346 xhr.setRequestHeader("Authorization", "Basic " + btoa('ck_ba5a36b7aa56183d78b81aac6d43a80ed3185d2b' + ":" + 'cs_4ed666ecaedefd9296c18362a496e399f7d58315')); 347 }, 348 success: function(res){ 349 url_remplacant = res.product.permalink; 350 $('.remarque a').attr("href", url_remplacant); 351 }, 352 error: function(error){ 353 console.log('Error: ' + error); 354 } 355 }) 356 357 }); 358 } 359 }) 360 } 361 362 } 363 }); 364 365 } else if (pa_statut == 'D') { 366 $('.format-table').hide(); 367 $('.thwepo-extra-options').hide(); 368 $('.single_add_to_cart_button').attr("disabled", "disabled"); 369 $('.remarque').html("<p class='n-d'>" + cs_strings.unavailable + "</p>"); 370 } else { 371 // Afficher seulement prix variation + changer le unit 372 if (price == "#N/A" || price == '' || price == 0) { 373 $('.remarque').html("<p class='n-d' style='text-align: center;'>" + cs_strings.priceondemand + "</p>"); 374 } else { 375 $('.price').html('<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>' + price + '</span> / ' + pa_unit); 376 } 377 378 $('.format-table').show(); 379 $('.thwepo-extra-options').show(); 380 $('.single_add_to_cart_button').removeAttr("disabled"); 381 } 382 383 // Description Série 384 if (pa_description_serie) {
385 $('.serie-content').html('<h3>' + cs_strings.seriedescription + '</h3><p>' + pa_description_serie + '</p>'); 386 } 387 388 if (pa_etiquette) { 389 $('.etq').html("<p>" + cs_strings.taglabel + ": <span>" + pa_etiquette + "</span></p>"); 390 } 391 392 // Vider le select semaines 393 $('#semaine').find('option').remove().end(); 394 $('#semaine').append('<option value="">' + cs_strings.chooseweek + '</option>'); 395 396 // Rajouter les options semaines 397 if (!semaine_debut && !semaine_fin) { 398 //Retirer par demande du client - SU-6609 399 /*semaine_debut = 1; 400 401 if(moment().week(52).day(1).year() == moment().week(53).day(1).year()){ 402 semaine_fin = 53; 403 }else{ 404 semaine_fin = 52; 405 }*/ 406 semaine_debut = 2; 407 semaine_fin = 51; 408 } 409 moment.locale('fr'); 410 var j = 0; 411 var apres_fin = 0; 412 413 for (var i = semaine_debut; i <= semaine_fin; i++) { 414 if (moment().week(i) >= moment()) { 415 j++; 416 $('#semaine').append($('<option>', { 417 value: i, 418 text: i + ': ' + cs_strings.from + ' ' + moment().week(i).day(1).format('D MMMM YYYY') + ' ' + cs_strings.to + ' ' + moment().week(i).day(5).format('D MMMM YYYY') 419 })); 420 } else { 421 if (i > apres_fin) { 422 apres_fin = i+1; 423 } 424 } 425 } 426 427 if (apres_fin != 0) { 428 for (var i = semaine_debut; i <= apres_fin; i++) { 429 j++; 430 $('#semaine').append($('<option>', { 431 value: i, 432 text: i + ': ' + cs_strings.from + ' ' + moment().year(moment().year()+1).week(i).day(1).format('D MMMM YYYY') + ' ' + cs_strings.to + ' ' + moment().year(moment().year()+1).week(i).day(5).format('D MMMM YYYY') 433 })); 434 } 435 } 436 437 if (j == 0) { 438 $('#semaine').append($('<option>', { 439 value: 'N/A', 440 text: 'Veuillez communiquer avec le service client pour disponibilités' 441 })); 442 } 443 444 // Add ID to qty input data (for price update) 445 $('input.qty').attr('data-id', variation.variation_id); 446 447 } 448 449 }); 450 451 } 452 453 ); 454 455 /* Custom verification */ 456 $('.single_add_to_cart_button').click(function() { 457 458 $('.norseco_validation_notice').fadeOut(300, function() { $(this).remove(); }); 459 460 if ($('#pa_producteur').length) { 461 if ($('#pa_producteur').val() == '') { 462 $('.close-modal').after('<div class="norseco_validation_notice">' + cs_strings.validateproducer + '</div>').hide().fadeIn(); 463 $(".atc-wrapper").scrollTop(0); 464 465 return false 466 } 467 } 468 if ($('#pa_formulation').length) { 469 if ($('#pa_formulation').val() == '') { 470 $('.close-modal').after('<div class="norseco_validation_notice">' + cs_strings.validateformulation + '</div>').hide().fadeIn(); 471 $(".atc-wrapper").scrollTop(0); 472 473 return false 474 } 475 } 476 if ($('#pa_sku').length) { 477 if ($('#pa_sku').val() == '') { 478 $('.close-modal').after('<div class="norseco_validation_notice">' + cs_strings.validatesku + '</div>').hide().fadeIn(); 479 $(".atc-wrapper").scrollTop(0); 480 481 return false 482 } 483 } 484 if ($('#semaine').length) { 485 if ($('#semaine').val() == '') { 486 $('.close-modal').after('<div class="norseco_validation_notice">
486' + cs_strings.validateweek + '</div>').hide().fadeIn(); 487 $(".atc-wrapper").scrollTop(0); 488 489 return false 490 } 491 } 492 493 if ($('.quantity.hidden').length) { 494 if ($('.quantity.quantity input.qty').val() == "0" && $('.format-table table').length) { 495 $('.close-modal').after('<div class="norseco_validation_notice">' + cs_strings.validatequantity + '</div>').hide().fadeIn(); 496 $(".atc-wrapper").scrollTop(0); 497 498 return false 499 500 } else if ($('.format-table table').length == 0) { 501 $('.quantity.hidden input.qty').val('1'); 502 } 503 } 504 }) 505 506 $('#toggleGuestCheckout').click(function() { 507 $('form.checkout #customer_details').slideDown('slow').delay(500).parent().removeClass('not-visible'); 508 }) 509 510 if ($(window).width() <= 800) { 511 if ($('table.cart').length) { 512 $('table.cart td').each(function () { 513 514 let dataTitle = $(this).data('title'); 515 if ($(this).html().trim().length <= 7) return; 516 517 if (dataTitle != undefined && dataTitle != 'Produit') { 518 $(this).prepend('<span class="responsive-dt">' + dataTitle + '</span>'); 519 } 520 }) 521 } 522 } 523 524 $('.woocommerce').on('click', '.tooltipstered', function() { 525 526 if (window.location.href.indexOf("ornemental-5552") > -1 || window.location.href.indexOf("ornamental-5552en") > -1 || window.location.href.indexOf("jeunes-plants-2370") > -1 || window.location.href.indexOf("young-plants-2370en") > -1) { 527 window.open("https://www.norseco.com/pdf/Formulation/Formulations%20Fleurs.pdf", '_blank'); 528 } else if (window.location.href.indexOf("maraicher-1169") > -1 || window.location.href.indexOf("vegetables-1169en") > -1) { 529 window.open("https://www.norseco.com/pdf/Formulation/Formulations%20L%C3%A9gumes.pdf",'_blank'); 530 } 531 532 }); 533 534 }); 535 536})( 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.