PageSourceSearch

https://sajas.co.za/plugins/themes/default/js/lib/bootstrap/util.js?v=3.5.0.4

js sajas.co.za collected 2026-09-28 10:48:24 UTC 4,193 bytes, 152 lines download raw bytes

1/**
2 * --------------------------------------------------------------------------
3 * Bootstrap (v4.0.0-beta): util.js
4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 * --------------------------------------------------------------------------
6 */
7
8var Util = function ($) {
9
10  /**
11   * ------------------------------------------------------------------------
12   * Private TransitionEnd Helpers
13   * ------------------------------------------------------------------------
14   */
15
16  var transition = false;
17
18  var MAX_UID = 1000000;
19
20  var TransitionEndEvent = {
21    WebkitTransition: 'webkitTransitionEnd',
22    MozTransition: 'transitionend',
23    OTransition: 'oTransitionEnd otransitionend',
24    transition: 'transitionend'
25
26    // shoutout AngusCroll (https://goo.gl/pxwQGp)
27  };function toType(obj) {
28    return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
29  }
30
31  function isElement(obj) {
32    return (obj[0] || obj).nodeType;
33  }
34
35  function getSpecialTransitionEndEvent() {
36    return {
37      bindType: transition.end,
38      delegateType: transition.end,
39      handle: function handle(event) {
40        if ($(event.target).is(this)) {
41          return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
42        }
43        return undefined;
44      }
45    };
46  }
47
48  function transitionEndTest() {
49    if (window.QUnit) {
50      return false;
51    }
52
53    var el = document.createElement('bootstrap');
54
55    for (var name in TransitionEndEvent) {
56      if (el.style[name] !== undefined) {
57        return {
58          end: TransitionEndEvent[name]
59        };
60      }
61    }
62
63    return false;
64  }
65
66  function transitionEndEmulator(duration) {
67    var _this = this;
68
69    var called = false;
70
71    $(this).one(Util.TRANSITION_END, function () {
72      called = true;
73    });
74
75    setTimeout(function () {
76      if (!called) {
77        Util.triggerTransitionEnd(_this);
78      }
79    }, duration);
80
81    return this;
82  }
83
84  function setTransitionEndSupport() {
85    transition = transitionEndTest();
86
87    $.fn.emulateTransitionEnd = transitionEndEmulator;
88
89    if (Util.supportsTransitionEnd()) {
90      $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
91    }
92  }
93
94  /**
95   * --------------------------------------------------------------------------
96   * Public Util Api
97   * --------------------------------------------------------------------------
98   */
99
100  var Util = {
101
102    TRANSITION_END: 'bsTransitionEnd',
103
104    getUID: function getUID(prefix) {
105      do {
106        // eslint-disable-next-line no-bitwise
107        prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
108      } while (document.getElementById(prefix));
109      return prefix;
110    },
111    getSelectorFromElement: function getSelectorFromElement(element) {
112      var selector = element.getAttribute('data-target');
113      if (!selector || selector === '#') {
114        selector = element.getAttribute('href') || '';
115      }
116
117      try {
118        var $selector = $(selector);
119        return $selector.length > 0 ? selector : null;
120      } catch (error) {
121        return null;
122      }
123    },
124    reflow: function reflow(element) {
125      return element.offsetHeight;
126    },
127    triggerTransitionEnd: function triggerTransitionEnd(element) {
128      $(element).trigger(transition.end);
129    },
130    supportsTransitionEnd: function supportsTransitionEnd() {
131      return Boolean(transition);
132    },
133    typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
134      for (var property in configTypes) {
135        if (configTypes.hasOwnProperty(property)) {
136          var expectedTypes = configTypes[property];
137          var value = config[property];
138          var valueType = value && isElement(value) ? 'element' : toType(value);
139
140          if (!new RegExp(expectedTypes).test(valueType)) {
141            throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
142          }
143        }
144      }
145    }
146  };
147
148  setTransitionEndSupport();
149
150  return Util;
151}(jQuery);
152//# sourceMappingURL=util.js.map

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.