PageSourceSearch

https://www.gmv.com/themes/gmv/js/jquery-compat.js?v=1.0.0

js gmv.com collected 2026-10-02 02:40:44 UTC 2,848 bytes, 97 lines download raw bytes

1/**
2 * @file
3 * Restores the jQuery 3.x helpers that jQuery 4.0 removed.
4 *
5 * Drupal 11 ships jQuery 4.0, which deleted the whole block of helpers that had
6 * been deprecated during 3.x. Three of the unmaintained jQuery plugins bundled
7 * with this theme still call them and throw a TypeError on init:
8 *
9 *   - owl.carousel.min.js    $.camelCase() in its trigger() -> every carousel
10 *                            stays at the stylesheet's display:none, because
11 *                            only a successful init adds .owl-loaded.
12 *   - jquery.colorbox-min.js $.isFunction()
13 *   - autocomplete/jquery-ui.min.js  $.isArray(), and the rest of the set.
14 *
15 * Each helper is restored with the jQuery 3.7.1 semantics and only when absent,
16 * so the file is a no-op on jQuery 3 (the theme still supports Drupal 10).
17 */
18
19(function ($) {
20
21  'use strict';
22
23  var class2type = {};
24
25  'Boolean Number String Function Array Date RegExp Object Error Symbol'.split(' ').forEach(function (name) {
26    class2type['[object ' + name + ']'] = name.toLowerCase();
27  });
28
29  if (typeof $.type === 'undefined') {
30    $.type = function (obj) {
31      if (obj == null) {
32        return obj + '';
33      }
34      return typeof obj === 'object' || typeof obj === 'function'
35        ? class2type[Object.prototype.toString.call(obj)] || 'object'
36        : typeof obj;
37    };
38  }
39
40  if (typeof $.camelCase === 'undefined') {
41    $.camelCase = function (string) {
42      return string.replace(/^-ms-/, 'ms-').replace(/-([a-z])/g, function (all, letter) {
43        return letter.toUpperCase();
44      });
45    };
46  }
47
48  if (typeof $.isFunction === 'undefined') {
49    $.isFunction = function (obj) {
50      return typeof obj === 'function' && typeof obj.nodeType !== 'number' && typeof obj.item !== 'function';
51    };
52  }
53
54  if (typeof $.isArray === 'undefined') {
55    $.isArray = Array.isArray;
56  }
57
58  if (typeof $.isWindow === 'undefined') {
59    $.isWindow = function (obj) {
60      return obj != null && obj === obj.window;
61    };
62  }
63
64  if (typeof $.isNumeric === 'undefined') {
65    $.isNumeric = function (obj) {
66      var type = $.type(obj);
67      return (type === 'number' || type === 'string') && !isNaN(obj - parseFloat(obj));
68    };
69  }
70
71  if (typeof $.trim === 'undefined') {
72    $.trim = function (text) {
73      return text == null ? '' : (text + '').replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
74    };
75  }
76
77  if (typeof $.now === 'undefined') {
78    $.now = Date.now;
79  }
80
81  if (typeof $.nodeName === 'undefined') {
82    $.nodeName = function (elem, name) {
83      return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
84    };
85  }
86
87  if (typeof $.parseJSON === 'undefined') {
88    $.parseJSON = function (data) {
89      return JSON.parse(data + '');
90    };
91  }
92
93  if (typeof $.unique === 'undefined') {
94    $.unique = $.uniqueSort;
95  }
96
97})(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.