@ -1,6 +1,6 @@
/ * !
/ * !
* Native JavaScript for Bootstrap v3 . 0.1 0 ( https : //thednp.github.io/bootstrap.native/)
* Native JavaScript for Bootstrap v3 . 0.1 5 ( https : //thednp.github.io/bootstrap.native/)
* Copyright 2015 - 202 0 © dnp _theme
* Copyright 2015 - 202 1 © dnp _theme
* Licensed under MIT ( https : //github.com/thednp/bootstrap.native/blob/master/LICENSE)
* Licensed under MIT ( https : //github.com/thednp/bootstrap.native/blob/master/LICENSE)
* /
* /
( function ( global , factory ) {
( function ( global , factory ) {
@ -15,10 +15,14 @@
var transitionDuration = 'webkitTransition' in document . head . style ? 'webkitTransitionDuration' : 'transitionDuration' ;
var transitionDuration = 'webkitTransition' in document . head . style ? 'webkitTransitionDuration' : 'transitionDuration' ;
var transitionProperty = 'webkitTransition' in document . head . style ? 'webkitTransitionProperty' : 'transitionProperty' ;
function getElementTransitionDuration ( element ) {
function getElementTransitionDuration ( element ) {
var duration = supportTransition ? parseFloat ( getComputedStyle ( element ) [ transitionDuration ] ) : 0 ;
var computedStyle = getComputedStyle ( element ) ,
duration = typeof duration === 'number' && ! isNaN ( duration ) ? duration * 1000 : 0 ;
property = computedStyle [ transitionProperty ] ,
return duration ;
duration = supportTransition && property && property !== 'none'
? parseFloat ( computedStyle [ transitionDuration ] ) : 0 ;
return ! isNaN ( duration ) ? duration * 1000 : 0 ;
}
}
function emulateTransitionEnd ( element , handler ) {
function emulateTransitionEnd ( element , handler ) {
@ -35,9 +39,15 @@
return selector instanceof Element ? selector : lookUp . querySelector ( selector ) ;
return selector instanceof Element ? selector : lookUp . querySelector ( selector ) ;
}
}
function bootstrapCustomEvent ( eventName , componentName , related ) {
function bootstrapCustomEvent ( eventName , componentName , eventProperties ) {
var OriginalCustomEvent = new CustomEvent ( eventName + '.bs.' + componentName , { cancelable : true } ) ;
var OriginalCustomEvent = new CustomEvent ( eventName + '.bs.' + componentName , { cancelable : true } ) ;
OriginalCustomEvent . relatedTarget = related ;
if ( typeof eventProperties !== 'undefined' ) {
Object . keys ( eventProperties ) . forEach ( function ( key ) {
Object . defineProperty ( OriginalCustomEvent , key , {
value : eventProperties [ key ]
} ) ;
} ) ;
}
return OriginalCustomEvent ;
return OriginalCustomEvent ;
}
}
@ -352,7 +362,7 @@
} ;
} ;
self . slideTo = function ( next ) {
self . slideTo = function ( next ) {
if ( vars . isSliding ) { return ; }
if ( vars . isSliding ) { return ; }
var activeItem = self . getActiveIndex ( ) , orientation ;
var activeItem = self . getActiveIndex ( ) , orientation , eventProperties ;
if ( activeItem === next ) {
if ( activeItem === next ) {
return ;
return ;
} else if ( ( activeItem < next ) || ( activeItem === 0 && next === slides . length - 1 ) ) {
} else if ( ( activeItem < next ) || ( activeItem === 0 && next === slides . length - 1 ) ) {
@ -363,8 +373,9 @@
if ( next < 0 ) { next = slides . length - 1 ; }
if ( next < 0 ) { next = slides . length - 1 ; }
else if ( next >= slides . length ) { next = 0 ; }
else if ( next >= slides . length ) { next = 0 ; }
orientation = vars . direction === 'left' ? 'next' : 'prev' ;
orientation = vars . direction === 'left' ? 'next' : 'prev' ;
slideCustomEvent = bootstrapCustomEvent ( 'slide' , 'carousel' , slides [ next ] ) ;
eventProperties = { relatedTarget : slides [ next ] , direction : vars . direction , from : activeItem , to : next } ;
slidCustomEvent = bootstrapCustomEvent ( 'slid' , 'carousel' , slides [ next ] ) ;
slideCustomEvent = bootstrapCustomEvent ( 'slide' , 'carousel' , eventProperties ) ;
slidCustomEvent = bootstrapCustomEvent ( 'slid' , 'carousel' , eventProperties ) ;
dispatchCustomEvent . call ( element , slideCustomEvent ) ;
dispatchCustomEvent . call ( element , slideCustomEvent ) ;
if ( slideCustomEvent . defaultPrevented ) { return ; }
if ( slideCustomEvent . defaultPrevented ) { return ; }
vars . index = next ;
vars . index = next ;
@ -615,7 +626,7 @@
}
}
}
}
self . show = function ( ) {
self . show = function ( ) {
showCustomEvent = bootstrapCustomEvent ( 'show' , 'dropdown' , relatedTarget ) ;
showCustomEvent = bootstrapCustomEvent ( 'show' , 'dropdown' , { relatedTarget : relatedTarget } ) ;
dispatchCustomEvent . call ( parent , showCustomEvent ) ;
dispatchCustomEvent . call ( parent , showCustomEvent ) ;
if ( showCustomEvent . defaultPrevented ) { return ; }
if ( showCustomEvent . defaultPrevented ) { return ; }
menu . classList . add ( 'show' ) ;
menu . classList . add ( 'show' ) ;
@ -626,12 +637,12 @@
setTimeout ( function ( ) {
setTimeout ( function ( ) {
setFocus ( menu . getElementsByTagName ( 'INPUT' ) [ 0 ] || element ) ;
setFocus ( menu . getElementsByTagName ( 'INPUT' ) [ 0 ] || element ) ;
toggleDismiss ( ) ;
toggleDismiss ( ) ;
shownCustomEvent = bootstrapCustomEvent ( 'shown' , 'dropdown' , relatedTarget ) ;
shownCustomEvent = bootstrapCustomEvent ( 'shown' , 'dropdown' , { relatedTarget : relatedTarget } ) ;
dispatchCustomEvent . call ( parent , shownCustomEvent ) ;
dispatchCustomEvent . call ( parent , shownCustomEvent ) ;
} , 1 ) ;
} , 1 ) ;
} ;
} ;
self . hide = function ( ) {
self . hide = function ( ) {
hideCustomEvent = bootstrapCustomEvent ( 'hide' , 'dropdown' , relatedTarget ) ;
hideCustomEvent = bootstrapCustomEvent ( 'hide' , 'dropdown' , { relatedTarget : relatedTarget } ) ;
dispatchCustomEvent . call ( parent , hideCustomEvent ) ;
dispatchCustomEvent . call ( parent , hideCustomEvent ) ;
if ( hideCustomEvent . defaultPrevented ) { return ; }
if ( hideCustomEvent . defaultPrevented ) { return ; }
menu . classList . remove ( 'show' ) ;
menu . classList . remove ( 'show' ) ;
@ -643,7 +654,7 @@
setTimeout ( function ( ) {
setTimeout ( function ( ) {
element . Dropdown && element . addEventListener ( 'click' , clickHandler , false ) ;
element . Dropdown && element . addEventListener ( 'click' , clickHandler , false ) ;
} , 1 ) ;
} , 1 ) ;
hiddenCustomEvent = bootstrapCustomEvent ( 'hidden' , 'dropdown' , relatedTarget ) ;
hiddenCustomEvent = bootstrapCustomEvent ( 'hidden' , 'dropdown' , { relatedTarget : relatedTarget } ) ;
dispatchCustomEvent . call ( parent , hiddenCustomEvent ) ;
dispatchCustomEvent . call ( parent , hiddenCustomEvent ) ;
} ;
} ;
self . toggle = function ( ) {
self . toggle = function ( ) {
@ -749,7 +760,7 @@
setFocus ( modal ) ;
setFocus ( modal ) ;
modal . isAnimating = false ;
modal . isAnimating = false ;
toggleEvents ( 1 ) ;
toggleEvents ( 1 ) ;
shownCustomEvent = bootstrapCustomEvent ( 'shown' , 'modal' , relatedTarget ) ;
shownCustomEvent = bootstrapCustomEvent ( 'shown' , 'modal' , { relatedTarget : relatedTarget } ) ;
dispatchCustomEvent . call ( modal , shownCustomEvent ) ;
dispatchCustomEvent . call ( modal , shownCustomEvent ) ;
}
}
function triggerHide ( force ) {
function triggerHide ( force ) {
@ -804,7 +815,7 @@
} ;
} ;
self . show = function ( ) {
self . show = function ( ) {
if ( modal . classList . contains ( 'show' ) && ! ! modal . isAnimating ) { return }
if ( modal . classList . contains ( 'show' ) && ! ! modal . isAnimating ) { return }
showCustomEvent = bootstrapCustomEvent ( 'show' , 'modal' , relatedTarget ) ;
showCustomEvent = bootstrapCustomEvent ( 'show' , 'modal' , { relatedTarget : relatedTarget } ) ;
dispatchCustomEvent . call ( modal , showCustomEvent ) ;
dispatchCustomEvent . call ( modal , showCustomEvent ) ;
if ( showCustomEvent . defaultPrevented ) { return ; }
if ( showCustomEvent . defaultPrevented ) { return ; }
modal . isAnimating = true ;
modal . isAnimating = true ;
@ -1193,7 +1204,7 @@
if ( dropLink && ! dropLink . classList . contains ( 'active' ) ) {
if ( dropLink && ! dropLink . classList . contains ( 'active' ) ) {
dropLink . classList . add ( 'active' ) ;
dropLink . classList . add ( 'active' ) ;
}
}
dispatchCustomEvent . call ( element , bootstrapCustomEvent ( 'activate' , 'scrollspy' , vars . items [ index ] ) ) ;
dispatchCustomEvent . call ( element , bootstrapCustomEvent ( 'activate' , 'scrollspy' , { relatedTarget : vars . items [ index ] } ) ) ;
} else if ( isActive && ! inside ) {
} else if ( isActive && ! inside ) {
item . classList . remove ( 'active' ) ;
item . classList . remove ( 'active' ) ;
if ( dropLink && dropLink . classList . contains ( 'active' ) && ! item . parentNode . getElementsByClassName ( 'active' ) . length ) {
if ( dropLink && dropLink . classList . contains ( 'active' ) && ! item . parentNode . getElementsByClassName ( 'active' ) . length ) {
@ -1278,7 +1289,7 @@
} else {
} else {
tabs . isAnimating = false ;
tabs . isAnimating = false ;
}
}
shownCustomEvent = bootstrapCustomEvent ( 'shown' , 'tab' , activeTab ) ;
shownCustomEvent = bootstrapCustomEvent ( 'shown' , 'tab' , { relatedTarget : activeTab } ) ;
dispatchCustomEvent . call ( next , shownCustomEvent ) ;
dispatchCustomEvent . call ( next , shownCustomEvent ) ;
}
}
function triggerHide ( ) {
function triggerHide ( ) {
@ -1287,8 +1298,8 @@
nextContent . style . float = 'left' ;
nextContent . style . float = 'left' ;
containerHeight = activeContent . scrollHeight ;
containerHeight = activeContent . scrollHeight ;
}
}
showCustomEvent = bootstrapCustomEvent ( 'show' , 'tab' , activeTab ) ;
showCustomEvent = bootstrapCustomEvent ( 'show' , 'tab' , { relatedTarget : activeTab } ) ;
hiddenCustomEvent = bootstrapCustomEvent ( 'hidden' , 'tab' , next ) ;
hiddenCustomEvent = bootstrapCustomEvent ( 'hidden' , 'tab' , { relatedTarget : next } ) ;
dispatchCustomEvent . call ( next , showCustomEvent ) ;
dispatchCustomEvent . call ( next , showCustomEvent ) ;
if ( showCustomEvent . defaultPrevented ) { return ; }
if ( showCustomEvent . defaultPrevented ) { return ; }
nextContent . classList . add ( 'active' ) ;
nextContent . classList . add ( 'active' ) ;
@ -1331,7 +1342,7 @@
nextContent = queryElement ( next . getAttribute ( 'href' ) ) ;
nextContent = queryElement ( next . getAttribute ( 'href' ) ) ;
activeTab = getActiveTab ( ) ;
activeTab = getActiveTab ( ) ;
activeContent = getActiveContent ( ) ;
activeContent = getActiveContent ( ) ;
hideCustomEvent = bootstrapCustomEvent ( 'hide' , 'tab' , next ) ;
hideCustomEvent = bootstrapCustomEvent ( 'hide' , 'tab' , { relatedTarget : next } ) ;
dispatchCustomEvent . call ( activeTab , hideCustomEvent ) ;
dispatchCustomEvent . call ( activeTab , hideCustomEvent ) ;
if ( hideCustomEvent . defaultPrevented ) { return ; }
if ( hideCustomEvent . defaultPrevented ) { return ; }
tabs . isAnimating = true ;
tabs . isAnimating = true ;
@ -1637,7 +1648,7 @@
}
}
}
}
var version = "3.0.1 0 ";
var version = "3.0.1 5 ";
var index = {
var index = {
Alert : Alert ,
Alert : Alert ,