PageSourceSearch

https://michiganlife.com/sites/default/files/js/js_wkGNr3ZKg8wnfYvFmj0t-p2oyCaAyfITup9gwMwpNYc.js

js michiganlife.com collected 2026-10-08 21:13:51 UTC 9,787 bytes, 298 lines download raw bytes

1(function($){
2/**
3 * To make a form auto submit, all you have to do is 3 things:
4 *
5 * ctools_add_js('auto-submit');
6 *
7 * On gadgets you want to auto-submit when changed, add the ctools-auto-submit
8 * class. With FAPI, add:
9 * @code
10 *  '#attributes' => array('class' => array('ctools-auto-submit')),
11 * @endcode
12 *
13 * If you want to have auto-submit for every form element,
14 * add the ctools-auto-submit-full-form to the form. With FAPI, add:
15 * @code
16 *   '#attributes' => array('class' => array('ctools-auto-submit-full-form')),
17 * @endcode
18 *
19 * If you want to exclude a field from the ctool-auto-submit-full-form auto submission,
20 * add the class ctools-auto-submit-exclude to the form element. With FAPI, add:
21 * @code
22 *   '#attributes' => array('class' => array('ctools-auto-submit-exclude')),
23 * @endcode
24 *
25 * Finally, you have to identify which button you want clicked for autosubmit.
26 * The behavior of this button will be honored if it's ajaxy or not:
27 * @code
28 *  '#attributes' => array('class' => array('ctools-use-ajax', 'ctools-auto-submit-click')),
29 * @endcode
30 *
31 * Currently only 'select', 'radio', 'checkbox' and 'textfield' types are supported. We probably
32 * could use additional support for HTML5 input types.
33 */
34
35Drupal.behaviors.CToolsAutoSubmit = {
36  attach: function(context) {
37    // 'this' references the form element
38    function triggerSubmit (e) {
39      if ($.contains(document.body, this)) {
40        var $this = $(this);
41        if (!$this.hasClass('ctools-ajaxing')) {
42          $this.find('.ctools-auto-submit-click').click();
43        }
44      }
45    }
46
47    // the change event bubbles so we only need to bind it to the outer form
48    $('form.ctools-auto-submit-full-form', context)
49      .add('.ctools-auto-submit', context)
50      .filter('form, select, input:not(:text, :submit)')
51      .once('ctools-auto-submit')
52      .change(function (e) {
53        // don't trigger on text change for full-form
54        if ($(e.target).is(':not(:text, :submit, .ctools-auto-submit-exclude)')) {
55          triggerSubmit.call(e.target.form);
56        }
57      });
58
59    // e.keyCode: key
60    var discardKeyCode = [
61      16, // shift
62      17, // ctrl
63      18, // alt
64      20, // caps lock
65      33, // page up
66      34, // page down
67      35, // end
68      36, // home
69      37, // left arrow
70      38, // up arrow
71      39, // right arrow
72      40, // down arrow
73       9, // tab
74      13, // enter
75      27  // esc
76    ];
77    // Don't wait for change event on textfields
78    $('.ctools-auto-submit-full-form input:text, input:text.ctools-auto-submit', context)
79      .filter(':not(.ctools-auto-submit-exclude)')
80      .once('ctools-auto-submit', function () {
81        // each textinput element has his own timeout
82        var timeoutID = 0;
83        $(this)
84          .bind('keydown keyup', function (e) {
85            if ($.inArray(e.keyCode, discardKeyCode) === -1) {
86              timeoutID && clearTimeout(timeoutID);
87            }
88          })
89          .keyup(function(e) {
90            if ($.inArray(e.keyCode, discardKeyCode) === -1) {
91              timeoutID = setTimeout($.proxy(triggerSubmit, this.form), 500);
92            }
93          })
94          .bind('change', function (e) {
95            if ($.inArray(e.keyCode, discardKeyCode) === -1) {
96              timeoutID = setTimeout($.proxy(triggerSubmit, this.form), 500);
97            }
98          });
99      });
100  }
101};
102})(jQuery);
103;
104(function ($) {
105
106Drupal.googleanalytics = {};
107
108$(document).ready(function() {
109
110  // Attach mousedown, keyup, touchstart events to document only and catch
111  // clicks on all elements.
112  $(document.body).bind("mousedown keyup touchstart", function(event) {
113
114    // Catch the closest surrounding link of a clicked element.
115    $(event.target).closest("a,area").each(function() {
116
117      // Is the clicked URL internal?
118      if (Drupal.googleanalytics.isInternal(this.href)) {
119        // Skip 'click' tracking, if custom tracking events are bound.
120        if ($(this).is('.colorbox') && (Drupal.settings.googleanalytics.trackColorbox)) {
121          // Do nothing here. The custom event will handle all tracking.
122          //console.info("Click on .colorbox item has been detected.");
123        }
124        // Is download tracking activated and the file extension configured for download tracking?
125        else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) {
126          // Download link clicked.
127          gtag('event', Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), {
128            event_category: 'Downloads',
129            event_label: Drupal.googleanalytics.getPageUrl(this.href),
130            transport_type: 'beacon'
131          });
132        }
133        else if (Drupal.googleanalytics.isInternalSpecial(this.href)) {
134          // Keep the internal URL for Google Analytics website overlay intact.
135          // @todo: May require tracking ID
136          var target = this;
137          $.each(Drupal.settings.googleanalytics.account, function () {
138            gtag('config', this, {
139              page_path: Drupal.googleanalytics.getPageUrl(target.href),
140              transport_type: 'beacon'
141            });
142          });
143        }
144      }
145      else {
146        if (Drupal.settings.googleanalytics.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) {
147          // Mailto link clicked.
148          gtag('event', 'Click', {
149            event_category: 'Mails',
150            event_label: this.href.substring(7),
151            transport_type: 'beacon'
152          });
153        }
154        else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) {
155          if (Drupal.settings.googleanalytics.trackDomainMode !== 2 || (Drupal.settings.googleanalytics.trackDomainMode === 2 && !Drupal.googleanalytics.isCrossDomain(this.hostname, Drupal.settings.googleanalytics.trackCrossDomains))) {
156            // External link clicked / No top-level cross domain clicked.
157            gtag('event', 'Click', {
158              event_category: 'Outbound links',
159              event_label: this.href,
160              transport_type: 'beacon'
161            });
162          }
163        }
164      }
165    });
166  });
167
168  // Track hash changes as unique pageviews, if this option has been enabled.
169  if (Drupal.settings.googleanalytics.trackUrlFragments) {
170    window.onhashchange = function() {
171      $.each(Drupal.settings.googleanalytics.account, function () {
172        gtag('config', this, {
173          page_path: location.pathname + location.search + location.hash
174        });
175      });
176    };
177  }
178
179  // Colorbox: This event triggers when the transition has completed and the
180  // newly loaded content has been revealed.
181  if (Drupal.settings.googleanalytics.trackColorbox) {
182    $(document).bind("cbox_complete", function () {
183      var href = $.colorbox.element().attr("href");
184      if (href) {
185        $.each(Drupal.settings.googleanalytics.account, function () {
186          gtag('config', this, {
187            page_path: Drupal.googleanalytics.getPageUrl(href)
188          });
189        });
190      }
191    });
192  }
193
194});
195
196/**
197 * Check whether the hostname is part of the cross domains or not.
198 *
199 * @param string hostname
200 *   The hostname of the clicked URL.
201 * @param array crossDomains
202 *   All cross domain hostnames as JS array.
203 *
204 * @return boolean
205 */
206Drupal.googleanalytics.isCrossDomain = function (hostname, crossDomains) {
207  /**
208   * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is
209   * `null` or `undefined`, https://bugs.jquery.com/ticket/10076,
210   * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174
211   *
212   * @todo: Remove/Refactor in D8
213   */
214  if (!crossDomains) {
215    return false;
216  }
217  else {
218    return $.inArray(hostname, crossDomains) > -1 ? true : false;
219  }
220};
221
222/**
223 * Check whether this is a download URL or not.
224 *
225 * @param string url
226 *   The web url to check.
227 *
228 * @return boolean
229 */
230Drupal.googleanalytics.isDownload = function (url) {
231  var isDownload = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i");
232  return isDownload.test(url);
233};
234
235/**
236 * Check whether this is an absolute internal URL or not.
237 *
238 * @param string url
239 *   The web url to check.
240 *
241 * @return boolean
242 */
243Drupal.googleanalytics.isInternal = function (url) {
244  var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
245  return isInternal.test(url);
246};
247
248/**
249 * Check whether this is a special URL or not.
250 *
251 * URL types:
252 *  - gotwo.module /go/* links.
253 *
254 * @param string url
255 *   The web url to check.
256 *
257 * @return boolean
258 */
259Drupal.googleanalytics.isInternalSpecial = function (url) {
260  var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
261  return isInternalSpecial.test(url);
262};
263
264/**
265 * Extract the relative internal URL from an absolute internal URL.
266 *
267 * Examples:
268 * - https://mydomain.com/node/1 -> /node/1
269 * - https://example.com/foo/bar -> https://example.com/foo/bar
270 *
271 * @param string url
272 *   The web url to check.
273 *
274 * @return string
275 *   Internal website URL
276 */
277Drupal.googleanalytics.getPageUrl = function (url) {
278  var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i");
279  return url.replace(extractInternalUrl, '');
280};
281
282/**
283 * Extract the download file extension from the URL.
284 *
285 * @param string url
286 *   The web url to check.
287 *
288 * @return string
289 *   The file extension of the passed url. e.g. "zip", "txt"
290 */
291Drupal.googleanalytics.getDownloadExtension = function (url) {
292  var extractDownloadextension = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i");
293  var extension = extractDownloadextension.exec(url);
294  return (extension === null) ? '' : extension[1];
295};
296
297})(jQuery);
298;

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.