1/** 2 * @file 3 * JavaScript behaviors for AdWords context. 4 */ 5 6(function ($, Drupal) { 7 8 'use strict'; 9 10 /** 11 * Behavior for setting Adwords context. 12 * 13 * @type {Drupal~behavior} 14 */ 15 Drupal.behaviors.domusviContextAdwords = { 16 attach: function (context) { 17 initAdwords(); 18 19 $(context).find('#contact-forms-form, #contact-residence-form, #demande-de-devis-form, #etre-rappele-form, #nous-contacter-form, #prendre-un-rdv-form, #demande-urgente-form').once('domusvi-context-adwords').each(function () { 20 $(this).find('input[name="adwords"]').val(getAdwords()); 21 }); 22 } 23 }; 24 25 function initAdwords() { 26 if (getAdwords() === void 0 || getAdwords() === null) { 27 let parameters = retrieveParameters(); 28 29 if (parameters[Drupal.settings.adwords.reroute.param]) { 30 sessionStorage.setItem('Domusvi.context.adwords', parameters[Drupal.settings.adwords.reroute.param]); 31 } 32 } 33 } 34 35 function getAdwords() { 36 return sessionStorage.getItem('Domusvi.context.adwords'); 37 } 38 39 function retrieveParameters() { 40 let parts = {}; 41 42 window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { 43 parts[key] = value; 44 }); 45 46 return parts; 47 } 48 49})(jQuery, Drupal);
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.