diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-25 13:13:28 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-25 13:13:28 +0100 |
| commit | ca88c377f918a9178c56e206b7bb13baefd30c91 (patch) | |
| tree | e4ee2a5fda2ed378e9d103c627e9cb2a40f47310 /templates/assets/bootstrap/js/dist/util.js | |
| parent | b1bbeb2e2db4a287e7ccf627c2dc450cf5a53b62 (diff) | |
| download | minionlivesmatter-ca88c377f918a9178c56e206b7bb13baefd30c91.tar.gz minionlivesmatter-ca88c377f918a9178c56e206b7bb13baefd30c91.zip | |
accidentally committed minionlivesmatter changes to meta
Diffstat (limited to 'templates/assets/bootstrap/js/dist/util.js')
| -rw-r--r-- | templates/assets/bootstrap/js/dist/util.js | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/templates/assets/bootstrap/js/dist/util.js b/templates/assets/bootstrap/js/dist/util.js new file mode 100644 index 0000000..6eadcc3 --- /dev/null +++ b/templates/assets/bootstrap/js/dist/util.js @@ -0,0 +1,153 @@ +/** + * -------------------------------------------------------------------------- + * Bootstrap (v4.0.0-alpha.6): util.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- + */ + +var Util = function ($) { + + /** + * ------------------------------------------------------------------------ + * Private TransitionEnd Helpers + * ------------------------------------------------------------------------ + */ + + var transition = false; + + var MAX_UID = 1000000; + + var TransitionEndEvent = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' + }; + + // shoutout AngusCroll (https://goo.gl/pxwQGp) + function toType(obj) { + return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); + } + + function isElement(obj) { + return (obj[0] || obj).nodeType; + } + + function getSpecialTransitionEndEvent() { + return { + bindType: transition.end, + delegateType: transition.end, + handle: function handle(event) { + if ($(event.target).is(this)) { + return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params + } + return undefined; + } + }; + } + + function transitionEndTest() { + if (window.QUnit) { + return false; + } + + var el = document.createElement('bootstrap'); + + for (var name in TransitionEndEvent) { + if (el.style[name] !== undefined) { + return { + end: TransitionEndEvent[name] + }; + } + } + + return false; + } + + function transitionEndEmulator(duration) { + var _this = this; + + var called = false; + + $(this).one(Util.TRANSITION_END, function () { + called = true; + }); + + setTimeout(function () { + if (!called) { + Util.triggerTransitionEnd(_this); + } + }, duration); + + return this; + } + + function setTransitionEndSupport() { + transition = transitionEndTest(); + + $.fn.emulateTransitionEnd = transitionEndEmulator; + + if (Util.supportsTransitionEnd()) { + $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); + } + } + + /** + * -------------------------------------------------------------------------- + * Public Util Api + * -------------------------------------------------------------------------- + */ + + var Util = { + + TRANSITION_END: 'bsTransitionEnd', + + getUID: function getUID(prefix) { + do { + // eslint-disable-next-line no-bitwise + prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here + } while (document.getElementById(prefix)); + return prefix; + }, + getSelectorFromElement: function getSelectorFromElement(element) { + var selector = element.getAttribute('data-target'); + if (!selector || selector === '#') { + selector = element.getAttribute('href') || ''; + } + + try { + var $selector = $(selector); + return $selector.length > 0 ? selector : null; + } catch (error) { + return null; + } + }, + reflow: function reflow(element) { + return element.offsetHeight; + }, + triggerTransitionEnd: function triggerTransitionEnd(element) { + $(element).trigger(transition.end); + }, + supportsTransitionEnd: function supportsTransitionEnd() { + return Boolean(transition); + }, + typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { + for (var property in configTypes) { + if (configTypes.hasOwnProperty(property)) { + var expectedTypes = configTypes[property]; + var value = config[property]; + var valueType = value && isElement(value) ? 'element' : toType(value); + + if (!new RegExp(expectedTypes).test(valueType)) { + throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".')); + } + } + } + } + }; + + setTransitionEndSupport(); + + return Util; +}(jQuery); +//# sourceMappingURL=util.js.map |
