2018-11-13 07:41:12 +01:00
/ * !
2020-08-06 18:22:43 +02:00
* Bootstrap util . js v4 . 5.2 ( https : //getbootstrap.com/)
2020-05-12 18:53:07 +02:00
* Copyright 2011 - 2020 The Bootstrap Authors ( https : //github.com/twbs/bootstrap/graphs/contributors)
2020-08-04 18:24:33 +02:00
* Licensed under MIT ( https : //github.com/twbs/bootstrap/blob/main/LICENSE)
2018-11-13 07:41:12 +01:00
* /
2018-07-24 02:51:14 +02:00
( function ( global , factory ) {
typeof exports === 'object' && typeof module !== 'undefined' ? module . exports = factory ( require ( 'jquery' ) ) :
typeof define === 'function' && define . amd ? define ( [ 'jquery' ] , factory ) :
2020-08-04 18:24:33 +02:00
( global = typeof globalThis !== 'undefined' ? globalThis : global || self , global . Util = factory ( global . jQuery ) ) ;
2019-11-26 18:12:00 +01:00
} ( this , ( function ( $ ) { 'use strict' ;
2018-07-24 02:51:14 +02:00
2020-05-12 18:53:07 +02:00
$ = $ && Object . prototype . hasOwnProperty . call ( $ , 'default' ) ? $ [ 'default' ] : $ ;
2017-09-30 23:28:03 +02:00
2015-05-08 01:34:28 +02:00
/ * *
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
2020-08-06 18:22:43 +02:00
* Bootstrap ( v4 . 5.2 ) : util . js
2020-08-04 18:24:33 +02:00
* Licensed under MIT ( https : //github.com/twbs/bootstrap/blob/main/LICENSE)
2015-05-08 01:34:28 +02:00
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* /
2018-11-13 07:41:12 +01:00
/ * *
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* Private TransitionEnd Helpers
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* /
2017-09-30 23:28:03 +02:00
2018-11-13 07:41:12 +01:00
var TRANSITION _END = 'transitionend' ;
var MAX _UID = 1000000 ;
var MILLISECONDS _MULTIPLIER = 1000 ; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
function toType ( obj ) {
2020-05-12 18:53:07 +02:00
if ( obj === null || typeof obj === 'undefined' ) {
return "" + obj ;
}
2018-11-13 07:41:12 +01:00
return { } . toString . call ( obj ) . match ( /\s([a-z]+)/i ) [ 1 ] . toLowerCase ( ) ;
}
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
2018-07-24 02:51:14 +02:00
}
2017-09-30 23:28:03 +02:00
2020-05-12 18:53:07 +02:00
return undefined ;
2018-11-13 07:41:12 +01:00
}
} ;
}
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 ( ) {
$ . fn . emulateTransitionEnd = transitionEndEmulator ;
$ . event . special [ Util . TRANSITION _END ] = getSpecialTransitionEndEvent ( ) ;
}
/ * *
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* Public Util Api
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* /
2015-05-07 21:48:22 +02:00
2018-11-13 07:41:12 +01:00
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 ) ) ;
2018-07-24 02:51:14 +02:00
2018-11-13 07:41:12 +01:00
return prefix ;
} ,
getSelectorFromElement : function getSelectorFromElement ( element ) {
var selector = element . getAttribute ( 'data-target' ) ;
if ( ! selector || selector === '#' ) {
var hrefAttr = element . getAttribute ( 'href' ) ;
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr . trim ( ) : '' ;
}
2018-08-19 05:22:08 +02:00
2019-01-04 17:29:45 +01:00
try {
return document . querySelector ( selector ) ? selector : null ;
} catch ( err ) {
return null ;
}
2018-11-13 07:41:12 +01:00
} ,
getTransitionDurationFromElement : function getTransitionDurationFromElement ( element ) {
if ( ! element ) {
return 0 ;
} // Get transition-duration of the element
var transitionDuration = $ ( element ) . css ( 'transition-duration' ) ;
var transitionDelay = $ ( element ) . css ( 'transition-delay' ) ;
var floatTransitionDuration = parseFloat ( transitionDuration ) ;
var floatTransitionDelay = parseFloat ( transitionDelay ) ; // Return 0 if element or transition duration is not found
if ( ! floatTransitionDuration && ! floatTransitionDelay ) {
return 0 ;
} // If multiple durations are defined, take the first
transitionDuration = transitionDuration . split ( ',' ) [ 0 ] ;
transitionDelay = transitionDelay . split ( ',' ) [ 0 ] ;
return ( parseFloat ( transitionDuration ) + parseFloat ( transitionDelay ) ) * MILLISECONDS _MULTIPLIER ;
} ,
reflow : function reflow ( element ) {
return element . offsetHeight ;
} ,
triggerTransitionEnd : function triggerTransitionEnd ( element ) {
$ ( element ) . trigger ( TRANSITION _END ) ;
} ,
// TODO: Remove in v5
supportsTransitionEnd : function supportsTransitionEnd ( ) {
return Boolean ( TRANSITION _END ) ;
} ,
isElement : function isElement ( obj ) {
return ( obj [ 0 ] || obj ) . nodeType ;
} ,
typeCheckConfig : function typeCheckConfig ( componentName , config , configTypes ) {
for ( var property in configTypes ) {
if ( Object . prototype . hasOwnProperty . call ( configTypes , property ) ) {
var expectedTypes = configTypes [ property ] ;
var value = config [ property ] ;
var valueType = value && Util . 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 + "\"." ) ) ;
2015-08-19 05:28:28 +02:00
}
2015-05-13 23:46:50 +02:00
}
}
2018-12-16 00:13:22 +01:00
} ,
findShadowRoot : function findShadowRoot ( element ) {
if ( ! document . documentElement . attachShadow ) {
return null ;
} // Can find the shadow root otherwise it'll return the document
if ( typeof element . getRootNode === 'function' ) {
var root = element . getRootNode ( ) ;
return root instanceof ShadowRoot ? root : null ;
}
if ( element instanceof ShadowRoot ) {
return element ;
} // when we don't find a shadow root
if ( ! element . parentNode ) {
return null ;
}
return Util . findShadowRoot ( element . parentNode ) ;
2019-11-26 18:12:00 +01:00
} ,
jQueryDetection : function jQueryDetection ( ) {
if ( typeof $ === 'undefined' ) {
throw new TypeError ( 'Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.' ) ;
}
var version = $ . fn . jquery . split ( ' ' ) [ 0 ] . split ( '.' ) ;
var minMajor = 1 ;
var ltMajor = 2 ;
var minMinor = 9 ;
var minPatch = 1 ;
var maxMajor = 4 ;
if ( version [ 0 ] < ltMajor && version [ 1 ] < minMinor || version [ 0 ] === minMajor && version [ 1 ] === minMinor && version [ 2 ] < minPatch || version [ 0 ] >= maxMajor ) {
throw new Error ( 'Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0' ) ;
}
2018-11-13 07:41:12 +01:00
}
} ;
2019-11-26 18:12:00 +01:00
Util . jQueryDetection ( ) ;
2018-11-13 07:41:12 +01:00
setTransitionEndSupport ( ) ;
2018-07-24 02:51:14 +02:00
2015-05-08 01:34:28 +02:00
return Util ;
2018-07-24 02:51:14 +02:00
2019-11-26 18:12:00 +01:00
} ) ) ) ;
2018-07-24 02:51:14 +02:00
//# sourceMappingURL=util.js.map