PageSourceSearch

https://www.sinaihealth.ca/themes/custom/sinai_health/js/match-height.js?tm556i

js sinaihealth.ca collected 2026-10-02 05:18:44 UTC 2,810 bytes, 72 lines download raw bytes

1// https://drupal.stackexchange.com/questions/200498/hide-the-term-id-on-autocomplete-widget/295790#295790
2(function($, Drupal, drupalSettings){
3  'use strict';
4  Drupal.behaviors.matchHeight = {
5    attach: function(context) {
6      Drupal.matchHeight.matchHeightDebounce();
7    }
8  };
9  Drupal.matchHeight = {
10    matchHeightDebounce: function() {
11      this.matchHeightFunction();
12      let heightDebounce = this.debounce(() => {
13        this.matchHeightFunction();
14      }, 250);
15      window.addEventListener('resize', heightDebounce);
16    },
17    debounce: function(func, wait, immediate) {
18      var timeout;
19      return function executedFunction() {
20        var context = this;
21        var args = arguments;
22        var later = function() {
23          timeout = null;
24          if (!immediate) func.apply(context, args);
25        };
26        var callNow = immediate && !timeout;
27        clearTimeout(timeout);
28        timeout = setTimeout(later, wait);
29        if (callNow) func.apply(context, args);
30      };
31    },
32    matchHeightFunction: function () {
33      let sections = document.querySelectorAll('.layout.yes-match-height, .layout.force-match-height');
34      let matchHeights = document.querySelectorAll('.match-height');
35
36      for (let m = 0; m < matchHeights.length; m++) {
37        matchHeights[m].style.height = 'auto';
38      }
39
40      for (let i = 0; i < sections.length; i++) {
41        let directChildren = sections[i].querySelector('.layout__region--container').children;
42
43        let forceMatchHeight = (sections[i].classList.contains('force-match-height') ? true : false); // Warning: Could produce unexpected results.
44        let noMatchHeight = (sections[i].classList.contains('no-match-height') ? true : false);
45        let containersToMatchHeight = [];
46        let maxHeight = 0;
47
48
49        if (!noMatchHeight && window.innerWidth >= 1024) {
50          let classToMatchAgainst = null;
51          if (sections[i].querySelector('.match-against') != null) {
52            classToMatchAgainst = sections[i].querySelector('.match-against').classList[0];
53          }
54
55          for (let j = 0; j < directChildren.length; j++) {
56            let matchHeightObject = directChildren[j].querySelector('.match-height');
57
58            if (matchHeightObject != null && (directChildren[j].children[0].classList[0] == classToMatchAgainst || forceMatchHeight)) {
59              containersToMatchHeight.push(matchHeightObject);
60              if (matchHeightObject.offsetHeight > maxHeight) {
61                maxHeight = matchHeightObject.offsetHeight;
62              }
63            }
64          }
65          for (let k = 0; k < containersToMatchHeight.length; k++) {
66            containersToMatchHeight[k].style.height = maxHeight + 'px';
67          }
68        }
69      }
70    }
71  };
72})(jQuery, Drupal, drupalSettings);

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.