PageSourceSearch

https://www.gov.pl/scripts/vendors/b_util.js

js www.gov.pl collected 2026-09-24 06:44:27 UTC 6,252 bytes, 172 lines download raw bytes

1"use strict";
2
3function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
5/*!
6  * Bootstrap util.js v4.3.1 (https://getbootstrap.com/)
7  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
8  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
9  */
10(function (global, factory) {
11  (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) : typeof define === 'function' && define.amd ? define(['jquery'], factory) : (global = global || self, global.Util = factory(global.jQuery));
12})(void 0, function ($) {
13  'use strict';
14
15  $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
16  /**
17   * --------------------------------------------------------------------------
18   * Bootstrap (v4.3.1): util.js
19   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
20   * --------------------------------------------------------------------------
21   */
22
23  /**
24   * ------------------------------------------------------------------------
25   * Private TransitionEnd Helpers
26   * ------------------------------------------------------------------------
27   */
28
29  var TRANSITION_END = 'transitionend';
30  var MAX_UID = 1000000;
31  var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
32
33  function toType(obj) {
34    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
35  }
36
37  function getSpecialTransitionEndEvent() {
38    return {
39      bindType: TRANSITION_END,
40      delegateType: TRANSITION_END,
41      handle: function handle(event) {
42        if ($(event.target).is(this)) {
43          return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
44        }
45
46        return undefined; // eslint-disable-line no-undefined
47      }
48    };
49  }
50
51  function transitionEndEmulator(duration) {
52    var _this = this;
53
54    var called = false;
55    $(this).one(Util.TRANSITION_END, function () {
56      called = true;
57    });
58    setTimeout(function () {
59      if (!called) {
60        Util.triggerTransitionEnd(_this);
61      }
62    }, duration);
63    return this;
64  }
65
66  function setTransitionEndSupport() {
67    $.fn.emulateTransitionEnd = transitionEndEmulator;
68    $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
69  }
70  /**
71   * --------------------------------------------------------------------------
72   * Public Util Api
73   * --------------------------------------------------------------------------
74   */
75
76
77  var Util = {
78    TRANSITION_END: 'bsTransitionEnd',
79    getUID: function getUID(prefix) {
80      do {
81        // eslint-disable-next-line no-bitwise
82        prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
83      } while (document.getElementById(prefix));
84
85      return prefix;
86    },
87    getSelectorFromElement: function getSelectorFromElement(element) {
88      var selector = element.getAttribute('data-target');
89
90      if (!selector || selector === '#') {
91        var hrefAttr = element.getAttribute('href');
92        selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
93      }
94
95      try {
96        return document.querySelector(selector) ? selector : null;
97      } catch (err) {
98        return null;
99      }
100    },
101    getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
102      if (!element) {
103        return 0;
104      } // Get transition-duration of the element
105
106
107      var transitionDuration = $(element).css('transition-duration');
108      var transitionDelay = $(element).css('transition-delay');
109      var floatTransitionDuration = parseFloat(transitionDuration);
110      var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
111
112      if (!floatTransitionDuration && !floatTransitionDelay) {
113        return 0;
114      } // If multiple durations are defined, take the first
115
116
117      transitionDuration = transitionDuration.split(',')[0];
118      transitionDelay = transitionDelay.split(',')[0];
119      return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
120    },
121    reflow: function reflow(element) {
122      return element.offsetHeight;
123    },
124    triggerTransitionEnd: function triggerTransitionEnd(element) {
125      $(element).trigger(TRANSITION_END);
126    },
127    // TODO: Remove in v5
128    supportsTransitionEnd: function supportsTransitionEnd() {
129      return Boolean(TRANSITION_END);
130    },
131    isElement: function isElement(obj) {
132      return (obj[0] || obj).nodeType;
133    },
134    typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
135      for (var property in configTypes) {
136        if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
137          var expectedTypes = configTypes[property];
138          var value = config[property];
139          var valueType = value && Util.isElement(value) ? 'element' : toType(value);
140
141          if (!new RegExp(expectedTypes).test(valueType)) {
142            throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
143          }
144        }
145      }
146    },
147    findShadowRoot: function findShadowRoot(element) {
148      if (!document.documentElement.attachShadow) {
149        return null;
150      } // Can find the shadow root otherwise it'll return the document
151
152
153      if (typeof element.getRootNode === 'function') {
154        var root = element.getRootNode();
155        return root instanceof ShadowRoot ? root : null;
156      }
157
158      if (element instanceof ShadowRoot) {
159        return element;
160      } // when we don't find a shadow root
161
162
163      if (!element.parentNode) {
164        return null;
165      }
166
167      return Util.findShadowRoot(element.parentNode);
168    }
169  };
170  setTransitionEndSupport();
171  return Util;
172});

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.