1/** 2 * @file 3 * A/B testing helper behavior. 4 */ 5(function ($, Drupal, window) { 6 'use strict'; 7 8 /** 9 * Behavior for A/B testing variants. 10 * 11 * @type {Drupal~behavior} 12 */ 13 Drupal.behaviors.ab_helper = { 14 attach: function (context, settings) { 15 // Get current URL and check for the variant query parameter 16 const urlParams = new URLSearchParams(window.location.search); 17 const variant = urlParams.get('variant'); 18 19 // Check if the variant is "form-sanitaire" 20 if (variant === 'form-sanitaire') { 21 this.applyFormSanitaireVariant(context); 22 } 23 }, 24 25 // Function to apply form-sanitaire variant styles (exposed as method) 26 applyFormSanitaireVariant: function(context) { 27 // Remove the d-node class from the variant block 28 $('div.header-container-overlay .container .row .col-left', context).addClass('col-lg-12 col-xl-6'); 29 $('div.header-container-overlay .container .row .col-left h1', context).addClass('mt-4 mt-xl-0'); 30 $('div.header-container-overlay .container .row .col-right', context).addClass('col-lg-12 col-xl-6'); 31 $('div.block-header-cta-variant.ab-form', context).removeClass('d-none'); 32 33 // Add the d-none class to the default block 34 $('div.block-header-cta.ab-default', context).addClass('d-none'); 35 } 36 }; 37 38 // Expose the applyFormSanitaireVariant function globally 39 window.applyFormSanitaireVariant = Drupal.behaviors.ab_helper.applyFormSanitaireVariant; 40 41})(jQuery, Drupal, window);
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.