PageSourceSearch

https://www.hologic.es/modules/custom/custom_general/custom_general.js?tm4wcr

js hologic.es collected 2026-10-08 20:32:28 UTC 2,831 bytes, 88 lines download raw bytes

1/**
2 * @file
3 * General customization.
4 */
5
6(function ($, Drupal, drupalSettings, once) {
7
8  'use strict';
9
10  /**
11   * Attach "k" parameter from window URL to various links.
12   *
13   * Some links rendered using views headers and footers cannot customize
14   * their query strings. Hence, clicking on these links makes the user
15   * loose their search keywords. This behavior attaches the keywords to
16   * the query string of such links to make them carry the "key" as in
17   * "keyword" parameter.
18   *
19   * @type {Drupal~behavior}
20   */
21  Drupal.behaviors.custom_search_attach_keyword = {
22    attach: function(context, drupalSettings) {
23      $(once('custom_global_search_attach_keyword', '.custom-search-more-results', context))
24        .each(function () {
25          // Use URLSearchParams to safely extract query parameters.
26          const params = new URLSearchParams(window.location.search);
27          const keyword = params.get('k');
28          if (keyword) {
29            // Re-use the decoded value, then re-encode only once when adding.
30            const href = new URL(this.href, window.location.origin);
31            href.searchParams.set('k', keyword); // automatically encodes
32            this.href = href.toString();
33          }
34        });
35    }
36  };
37
38  /**
39   * Initializes toggle trigger blocks.
40   *
41   * @type {Drupal~behavior}
42   */
43  // Drupal.behaviors.custom_toggle_trigger = {
44  //   attach: function (context, drupalSettings) {
45  //     $(context).find('.custom-toggle-trigger')
46  //       .once('custom-toggle-trigger').trigger('click');
47  //   }
48  // };
49
50  /**
51   * Adds target blank to external links.
52   *
53   * @type {Drupal~behavior}
54   */
55  Drupal.behaviors.external_link = {
56    attach: function () {
57      var entries = [
58        '#block-views-block-product-block-links a'
59      ];
60      $(entries.join(', ')).each(function() {
61        var $this = $(this);
62        var href = $this.attr('href');
63        if (href.indexOf('/') != 0) {
64          $this.attr('target', '_blank');
65        }
66      });
67    }
68  };
69
70})(jQuery, Drupal, drupalSettings, once);
71
72
73(function ($) {
74    $(document).ready(function()
75    {
76        // $("#edit-field-customer-account-0-value").on("focus touchstart", function(){$(this).attr("type","number")});
77        // $("#edit-field-customer-account-0-value").blur(function(){$(this).attr("type","text")});
78
79        $("#edit-field-customer-account-0-value").attr("type", "number");
80        $("#edit-field-customer-account-0-value").attr("pattern", "[0-9]*");
81
82        // $("#edit-field-fax-0-value").focus(function(){$(this).attr("type","number")});
83        // $("#edit-field-fax-0-value").blur(function(){$(this).attr("type","text")});
84
85        $("#edit-field-fax-0-value").attr("type", "number");
86        $("#edit-field-fax-0-value").attr("pattern", "[0-9]*");
87    });
88})(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.