PageSourceSearch

https://www.patrimonionacional.es/modules/contrib/smart_content_utm/js/url-parser.js?v=2.x

js patrimonionacional.es collected 2026-09-24 08:54:41 UTC 1,545 bytes, 55 lines download raw bytes

1/**
2 * @file
3 */
4
5(function (Drupal, options) {
6
7  "use strict";
8
9  Drupal.smartContent = Drupal.smartContent || {};
10  Drupal.smartContent.utm = Drupal.smartContent.utm || {};
11
12  var utmParamKeys = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'];
13
14  Drupal.behaviors.urlParser = {
15    attach: function () {
16      Drupal.smartContent.utm.init();
17    }
18  };
19
20  Drupal.smartContent.utm.init = function () {
21    Drupal.smartContent.utm['_initialized'] = Drupal.smartContent.utm['_initialized'] || false;
22    // Check if has been initialized yet.
23    if (!Drupal.smartContent.utm['_initialized']) {
24      Drupal.smartContent.utm['_initialized'] = true;
25      Drupal.smartContent.utm.mapValues();
26    }
27  }
28
29  Drupal.smartContent.utm.mapValues = function () {
30    var queryString = window.location.search;
31    var queryParams = new URLSearchParams(queryString);
32    var values = {};
33    for (var i = 0; i < utmParamKeys.length; i++) {
34      var key = utmParamKeys[i];
35      if (queryParams.has(key)) {
36        values[key] = queryParams.get(key);
37      }
38      else {
39        values[key] = Drupal.smartContent.utm.getValue(key);
40      }
41    }
42    Drupal.smartContent.storage.setValue('utm', values, options.expireDays * 24 * 60 * 60 * 1000);
43  }
44
45  Drupal.smartContent.utm.getValue = function (key) {
46    Drupal.smartContent.utm.init();
47    var values = Drupal.smartContent.storage.getValue('utm') || {};
48    if (values.hasOwnProperty(key)) {
49      return values[key];
50    }
51    return null;
52  }
53
54
55})(Drupal, {expireDays: 30});

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.